Features: adding verbose name to all fields (mainly ForwardFile ones)

This commit is contained in:
Michael Bideau 2019-08-22 16:41:28 +00:00
parent a951f062f0
commit a739371cef
2 changed files with 28 additions and 45 deletions

View File

@ -1,23 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-08-21 12:31
# This file is part of passerelle-atreal-openads - a Publik connector to openADS
#
# Copyright (C) 2019 Atreal
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Generated by Django 1.11.18 on 2019-08-22 16:28
from __future__ import unicode_literals
import atreal_openads.utils
@ -62,7 +44,7 @@ class Migration(migrations.Migration):
name='Collectivite',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, default=b'', max_length=150)),
('name', models.CharField(blank=True, default=b'', max_length=150, verbose_name='Name')),
('openADS_id', models.PositiveIntegerField(help_text='ex: 3', verbose_name='openADS identifier')),
('connecteur', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='collectivites', related_query_name='collectivite', to='atreal_openads.AtrealOpenads')),
],
@ -76,18 +58,18 @@ class Migration(migrations.Migration):
name='ForwardFile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero_demande', models.CharField(max_length=20)),
('numero_dossier', models.CharField(max_length=20)),
('type_fichier', models.CharField(max_length=10)),
('file_hash', models.CharField(blank=True, default=b'', max_length=100)),
('orig_filename', models.CharField(blank=True, default=b'', max_length=100)),
('content_type', models.CharField(blank=True, default=b'', max_length=100)),
('size', models.PositiveIntegerField(default=0)),
('upload_file', models.FileField(blank=True, null=True, upload_to=atreal_openads.utils.get_upload_path)),
('upload_attempt', models.PositiveIntegerField(blank=True, default=0)),
('upload_status', models.CharField(choices=[(b'pending', 'Pending'), (b'uploading', 'Uploading'), (b'failed', 'Failed'), (b'success', 'Success')], default=b'pending', max_length=10)),
('upload_msg', models.CharField(blank=True, default=b'', max_length=255)),
('last_update_datetime', models.DateTimeField(auto_now=True)),
('numero_demande', models.CharField(max_length=20, verbose_name='Tracking code')),
('numero_dossier', models.CharField(max_length=20, verbose_name='Numero dossier')),
('type_fichier', models.CharField(max_length=10, verbose_name='Type')),
('file_hash', models.CharField(blank=True, default=b'', max_length=100, verbose_name='Hash')),
('orig_filename', models.CharField(blank=True, default=b'', max_length=100, verbose_name='Filename')),
('content_type', models.CharField(blank=True, default=b'', max_length=100, verbose_name='Content type')),
('size', models.PositiveIntegerField(default=0, verbose_name='Size')),
('upload_file', models.FileField(blank=True, null=True, upload_to=atreal_openads.utils.get_upload_path, verbose_name='File')),
('upload_attempt', models.PositiveIntegerField(blank=True, default=0, verbose_name='Upload attempt')),
('upload_status', models.CharField(choices=[(b'pending', 'Pending'), (b'uploading', 'Uploading'), (b'failed', 'Failed'), (b'success', 'Success')], default=b'pending', max_length=10, verbose_name='Upload status')),
('upload_msg', models.CharField(blank=True, default=b'', max_length=255, verbose_name='Upload message')),
('last_update_datetime', models.DateTimeField(auto_now=True, verbose_name='Last update')),
('collectivite', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='forward_files', related_query_name='forward_file', to='atreal_openads.Collectivite')),
('connecteur', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='forward_files', related_query_name='forward_file', to='atreal_openads.AtrealOpenads')),
],

View File

@ -81,18 +81,19 @@ class ForwardFile(models.Model, BaseModel): # pylint: disable=too-many-instance
on_delete=models.CASCADE,
related_name="forward_files",
related_query_name="forward_file")
numero_demande = models.CharField(max_length=20)
numero_dossier = models.CharField(max_length=20)
type_fichier = models.CharField(max_length=10)
file_hash = models.CharField(max_length=100, default='', blank=True)
orig_filename = models.CharField(max_length=100, default='', blank=True)
content_type = models.CharField(max_length=100, default='', blank=True)
size = models.PositiveIntegerField(default=0)
upload_file = models.FileField(upload_to=get_upload_path, blank=True, null=True)
upload_attempt = models.PositiveIntegerField(default=0, blank=True)
upload_status = models.CharField(max_length=10, choices=STATUSES, default='pending')
upload_msg = models.CharField(max_length=255, default='', blank=True)
last_update_datetime = models.DateTimeField(auto_now=True)
numero_demande = models.CharField(_('Tracking code'), max_length=20)
numero_dossier = models.CharField(_('Numero dossier'), max_length=20)
type_fichier = models.CharField(_('Type'), max_length=10)
file_hash = models.CharField(_('Hash'), max_length=100, default='', blank=True)
orig_filename = models.CharField(_('Filename'), max_length=100, default='', blank=True)
content_type = models.CharField(_('Content type'), max_length=100, default='', blank=True)
size = models.PositiveIntegerField(_('Size'), default=0)
upload_file = models.FileField(_('File'), upload_to=get_upload_path, blank=True, null=True)
upload_attempt = models.PositiveIntegerField(_('Upload attempt'), default=0, blank=True)
upload_status = models.CharField(_('Upload status'), max_length=10, choices=STATUSES,
default='pending')
upload_msg = models.CharField(_('Upload message'), max_length=255, default='', blank=True)
last_update_datetime = models.DateTimeField(_('Last update'), auto_now=True)
class Meta:
# pylint: disable=too-few-public-methods,no-init,old-style-class,missing-docstring
@ -196,7 +197,7 @@ class ForwardFile(models.Model, BaseModel): # pylint: disable=too-many-instance
class Collectivite(models.Model, BaseModel):
"""Represent a "collectivite"."""
name = models.CharField(max_length=150, default='', blank=True)
name = models.CharField(_('Name'), max_length=150, default='', blank=True)
connecteur = models.ForeignKey('AtrealOpenads',
on_delete=models.CASCADE,
related_name="collectivites",