permiere version profile
This commit is contained in:
parent
2d9594ef68
commit
22e01ad2b2
4 changed files with 64 additions and 1 deletions
|
@ -27,7 +27,6 @@ DEBUG = True
|
|||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
@ -37,6 +36,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'fiches'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from django.contrib import admin
|
||||
from fiches.models import Profile
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Profile)
|
41
fiches/migrations/0001_initial.py
Normal file
41
fiches/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Generated by Django 2.2b1 on 2019-02-11 22:49
|
||||
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Department',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Profile',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('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')),
|
||||
('promotion', models.IntegerField(validators=[django.core.validators.MinValueValidator(1980)], verbose_name='promotion')),
|
||||
('birth_date', models.DateField(verbose_name='date de naissance')),
|
||||
('thurne', models.CharField(max_length=100, verbose_name='thurne')),
|
||||
('text_field', models.TextField(verbose_name='champ libre')),
|
||||
('printing', models.BooleanField(verbose_name="apparaître sur l'annuaire papier ?")),
|
||||
('keep_me', models.BooleanField(verbose_name='conserver la fiche annuaire ?')),
|
||||
('department', models.ManyToManyField(to='fiches.Department', verbose_name='département')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='utilisateur')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,3 +1,23 @@
|
|||
from django.db import models
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
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'))
|
||||
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'))
|
||||
department = models.ManyToManyField("Department", verbose_name = _('département'))
|
||||
promotion = models.IntegerField(validators = [MinValueValidator(1980)], verbose_name = _('promotion'))
|
||||
birth_date = models.DateField(verbose_name = _('date de naissance'))
|
||||
thurne = models.CharField(max_length = 100, verbose_name = _('thurne'))
|
||||
text_field = models.TextField(verbose_name = _('champ libre'))
|
||||
printing = models.BooleanField(verbose_name = _("apparaître sur l'annuaire papier ?"))
|
||||
keep_me = models.BooleanField(verbose_name = _('conserver la fiche annuaire ?'))
|
||||
# Champ pour les très vielleux plus en scolarité qui veulent garder leur fiche annuaire
|
||||
|
||||
class Department(models.Model):
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue