new models: Department, Phone and Social
This commit is contained in:
parent
22e01ad2b2
commit
223fae94c4
5 changed files with 88 additions and 3 deletions
|
@ -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)
|
||||
admin.site.register(Profile)
|
||||
admin.site.register(Department)
|
||||
admin.site.register(Phone)
|
||||
admin.site.register(Social)
|
19
fiches/migrations/0002_department_name.py
Normal file
19
fiches/migrations/0002_department_name.py
Normal file
|
@ -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,
|
||||
),
|
||||
]
|
32
fiches/migrations/0003_phone_social.py
Normal file
32
fiches/migrations/0003_phone_social.py
Normal file
|
@ -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')),
|
||||
],
|
||||
),
|
||||
]
|
18
fiches/migrations/0004_auto_20190213_1212.py
Normal file
18
fiches/migrations/0004_auto_20190213_1212.py
Normal file
|
@ -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'),
|
||||
),
|
||||
]
|
|
@ -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'))
|
Loading…
Reference in a new issue