Fix Publication's fields

This commit is contained in:
Théophile Bastian 2017-09-21 19:58:42 +02:00
parent 0c34bc8f3e
commit c9a032236e
3 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,5 @@
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Publication)

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-21 09:34
# Generated by Django 1.11.5 on 2017-09-21 17:57
from __future__ import unicode_literals
from django.db import migrations, models
@ -18,9 +18,11 @@ class Migration(migrations.Migration):
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')),
('url', models.CharField(max_length=512, 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')),
('descr', models.CharField(blank=True, max_length=512, verbose_name='Description (optionnelle)')),
('custom_name', models.CharField(blank=True, help_text='Vide pour laisser le numéro seulement', max_length=128, verbose_name='Nom customisé')),
],
),
]

View file

@ -1,22 +1,25 @@
from django.db import models
from django.db.models import URLField, \
DateField, \
from django.db.models import DateField, \
CharField, \
BooleanField
class Publication(models.Model):
num = CharField('Numéro du BOcal', max_length=128)
url = URLField('Adresse sur le site')
url = CharField('Adresse sur le site', max_length=512)
# ^ This is not a URLField because we need internal URLS, eg `/static/blah`
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),
max_length=512,
blank=True)
custom_name = CharField('Nom customisé',
help_text='Vide pour laisser le numéro seulement',
max_length=128),
max_length=128,
blank=True)
def __str__(self):
if self.custom_name: