Add tentative model for a publication
This commit is contained in:
parent
9f4ed6432e
commit
aa4812e337
2 changed files with 48 additions and 1 deletions
26
mainsite/migrations/0001_initial.py
Normal file
26
mainsite/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.5 on 2017-09-21 09:34
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Publication',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('num', models.CharField(max_length=128, verbose_name='Numéro du BOcal')),
|
||||||
|
('url', models.URLField(verbose_name='Adresse sur le site')),
|
||||||
|
('date', models.DateField(verbose_name='Publication')),
|
||||||
|
('is_special', models.BooleanField(default=False, help_text='Numéro du BOcal non-numéroté', verbose_name='Numéro spécial')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,3 +1,24 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db.models import URLField, \
|
||||||
|
DateField, \
|
||||||
|
CharField, \
|
||||||
|
BooleanField
|
||||||
|
|
||||||
# Create your models here.
|
|
||||||
|
class Publication(models.Model):
|
||||||
|
num = CharField('Numéro du BOcal', max_length=128)
|
||||||
|
url = URLField('Adresse sur le site')
|
||||||
|
date = DateField('Publication')
|
||||||
|
is_special = BooleanField('Numéro spécial',
|
||||||
|
help_text='Numéro du BOcal non-numéroté',
|
||||||
|
default=False)
|
||||||
|
descr = CharField('Description (optionnelle)',
|
||||||
|
max_length=512),
|
||||||
|
custom_name = CharField('Nom customisé',
|
||||||
|
help_text='Vide pour laisser le numéro seulement',
|
||||||
|
max_length=128),
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
if self.custom_name:
|
||||||
|
return self.custom_name
|
||||||
|
return 'BOcal n°{}'.format(self.num)
|
||||||
|
|
Loading…
Add table
Reference in a new issue