mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +00:00
pedagogy: don't update uv comment publish date at each save
This commit is contained in:
parent
d18f0aa829
commit
2aa465b138
@ -1640,7 +1640,7 @@ def migrate_pedagogy():
|
|||||||
grade_interest=convert_number(comment["note_interet"], -1),
|
grade_interest=convert_number(comment["note_interet"], -1),
|
||||||
grade_teaching=convert_number(comment["note_enseignement"], -1),
|
grade_teaching=convert_number(comment["note_enseignement"], -1),
|
||||||
grade_work_load=convert_number(comment["note_travail"], -1),
|
grade_work_load=convert_number(comment["note_travail"], -1),
|
||||||
publish_date=comment["date"],
|
publish_date=comment["date"].replace(tzinfo=timezone("Europe/Paris")),
|
||||||
).save()
|
).save()
|
||||||
|
|
||||||
print("Migrating UV Results")
|
print("Migrating UV Results")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by Django 1.11.20 on 2019-06-18 15:02
|
# Generated by Django 1.11.20 on 2019-06-18 20:07
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -248,7 +248,7 @@ class Migration(migrations.Migration):
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
"publish_date",
|
"publish_date",
|
||||||
models.DateTimeField(auto_now=True, verbose_name="publish date"),
|
models.DateTimeField(blank=True, verbose_name="publish date"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"author",
|
"author",
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils import timezone
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
@ -211,7 +212,12 @@ class UVComment(models.Model):
|
|||||||
null=False,
|
null=False,
|
||||||
default=-1,
|
default=-1,
|
||||||
)
|
)
|
||||||
publish_date = models.DateTimeField(_("publish date"), auto_now=True)
|
publish_date = models.DateTimeField(_("publish date"), blank=True)
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if self.publish_date is None:
|
||||||
|
self.publish_date = timezone.now()
|
||||||
|
super(UVComment, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class UVResult(models.Model):
|
class UVResult(models.Model):
|
||||||
|
Loading…
Reference in New Issue
Block a user