diff --git a/fiches/admin.py b/fiches/admin.py index 39d9d23..97f45d4 100644 --- a/fiches/admin.py +++ b/fiches/admin.py @@ -1,5 +1,11 @@ from django.contrib import admin from fiches.models import Profile +from fiches.models import Department +from fiches.models import Phone +from fiches.models import Social # Register your models here. -admin.site.register(Profile) \ No newline at end of file +admin.site.register(Profile) +admin.site.register(Department) +admin.site.register(Phone) +admin.site.register(Social) \ No newline at end of file diff --git a/fiches/migrations/0002_department_name.py b/fiches/migrations/0002_department_name.py new file mode 100644 index 0000000..35a9fec --- /dev/null +++ b/fiches/migrations/0002_department_name.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2b1 on 2019-02-13 11:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fiches', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='department', + name='name', + field=models.CharField(default=' ', max_length=1023, verbose_name='nom du département'), + preserve_default=False, + ), + ] diff --git a/fiches/migrations/0003_phone_social.py b/fiches/migrations/0003_phone_social.py new file mode 100644 index 0000000..fe35941 --- /dev/null +++ b/fiches/migrations/0003_phone_social.py @@ -0,0 +1,32 @@ +# Generated by Django 2.2b1 on 2019-02-13 12:07 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('fiches', '0002_department_name'), + ] + + operations = [ + migrations.CreateModel( + name='Social', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=1023, verbose_name='type')), + ('content', models.TextField(verbose_name='contenu')), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='fiches.Profile', verbose_name='profil')), + ], + ), + migrations.CreateModel( + name='Phone', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=1023, verbose_name='type')), + ('number', models.CharField(max_length=1023, verbose_name='numéro')), + ('profile', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='fiches.Profile', verbose_name='profil')), + ], + ), + ] diff --git a/fiches/migrations/0004_auto_20190213_1212.py b/fiches/migrations/0004_auto_20190213_1212.py new file mode 100644 index 0000000..f714cea --- /dev/null +++ b/fiches/migrations/0004_auto_20190213_1212.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2b1 on 2019-02-13 12:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fiches', '0003_phone_social'), + ] + + operations = [ + migrations.AlterField( + model_name='social', + name='content', + field=models.CharField(max_length=1023, verbose_name='contenu'), + ), + ] diff --git a/fiches/models.py b/fiches/models.py index 6bc39a4..60de0a6 100644 --- a/fiches/models.py +++ b/fiches/models.py @@ -6,7 +6,7 @@ from django.contrib.auth.models import User # Create your models here. class Profile(models.Model): - user = models.OneToOneField(User, on_delete = models.CASCADE,verbose_name = _('utilisateur')) + user = models.OneToOneField(User, on_delete = models.CASCADE, verbose_name = _('utilisateur')) full_name = models.CharField(max_length = 1023, verbose_name = _('nom')) nickname = models.CharField(max_length = 1023, verbose_name = _('surnom')) picture = models.ImageField(upload_to = 'picture', verbose_name = _('photo')) @@ -20,4 +20,14 @@ class Profile(models.Model): # Champ pour les très vielleux plus en scolarité qui veulent garder leur fiche annuaire class Department(models.Model): - pass + name = models.CharField(max_length = 1023, verbose_name = _('nom du département')) + +class Phone(models.Model): + profile = models.OneToOneField(Profile, on_delete = models.CASCADE, verbose_name = _('profil')) + name = models.CharField(max_length = 1023, verbose_name = _('type')) + number = models.CharField(max_length = 1023, verbose_name = _('numéro')) + +class Social(models.Model): + profile = models.OneToOneField(Profile, on_delete = models.CASCADE, verbose_name = _('profil')) + name = models.CharField(max_length = 1023, verbose_name = _('type')) + content = models.CharField(max_length = 1023, verbose_name = _('contenu')) \ No newline at end of file