8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 17:33:45 +00:00

Le ban a comme date de début sa création

This commit is contained in:
Gabriel Detraz 2016-07-03 01:29:26 +02:00
parent 19c830ba25
commit c486cc03f2
8 changed files with 47 additions and 2 deletions

View file

@ -13,6 +13,7 @@
<th>Prix unitaire</th>
<th>Moyen de paiement</th>
<th>Date</th>
<th></th>
</tr>
</thead>
{% for facture in facture_list %}
@ -23,6 +24,7 @@
<td>{{ facture.prix }}</td>
<td>{{ facture.paiement }}</td>
<td>{{ facture.date }}</td>
<td><a href="{% url 'cotisations:edit-facture' facture.id %}">Editer</a></td>
</tr>
{% endfor %}
</table>

View file

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_ban'),
]
operations = [
migrations.AlterField(
model_name='ban',
name='date_start',
field=models.DateTimeField(auto_now_add=True),
),
]

View file

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20160702_2322'),
]
operations = [
migrations.AddField(
model_name='user',
name='registered',
field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2016, 7, 2, 23, 25, 21, 698883, tzinfo=utc)),
preserve_default=False,
),
]

View file

@ -21,6 +21,7 @@ class User(models.Model):
pwd_ssha = models.CharField(max_length=255)
pwd_ntlm = models.CharField(max_length=255)
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
registered = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.pseudo
@ -50,7 +51,7 @@ class ListRight(models.Model):
class Ban(models.Model):
user = models.ForeignKey('User', on_delete=models.PROTECT)
raison = models.CharField(max_length=255)
date_start = models.DateTimeField(help_text='%m/%d/%y %H:%M:%S')
date_start = models.DateTimeField(auto_now_add=True)
date_end = models.DateTimeField(help_text='%m/%d/%y %H:%M:%S')
def __str__(self):
@ -113,7 +114,6 @@ class DelRightForm(ModelForm):
class BanForm(ModelForm):
def __init__(self, *args, **kwargs):
super(BanForm, self).__init__(*args, **kwargs)
self.fields['date_start'].label = 'Date de début'
self.fields['date_end'].label = 'Date de fin'
class Meta:

View file

@ -10,6 +10,7 @@
<th>Prénom</th>
<th>Nom</th>
<th>Pseudo</th>
<th>Inscrit le</th>
<th>Modifier</th>
</tr>
</thead>
@ -18,6 +19,7 @@
<td>{{ user.name }}</td>
<td>{{ user.surname }}</td>
<td>{{ user.pseudo }}</td>
<td>{{ user.registered }}</td>
<td><a href="{% url 'users:edit-info' user.id %}">Editer</a></td>
</tr>
{% endfor %}