зеркало из https://github.com/mozilla/FlightDeck.git
is_active_today should be only be triggered when new revisions are made
This commit is contained in:
Родитель
71e6518168
Коммит
1111618063
|
@ -1471,7 +1471,7 @@ class Package(BaseModel, SearchMixin):
|
||||||
|
|
||||||
# activity
|
# activity
|
||||||
year_of_activity = models.CharField(max_length=365, default='0'*365)
|
year_of_activity = models.CharField(max_length=365, default='0'*365)
|
||||||
is_active_today = models.BooleanField(default=False, blank=True)
|
is_active_today = models.BooleanField(default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
" Set the ordering of objects "
|
" Set the ordering of objects "
|
||||||
|
@ -2239,8 +2239,10 @@ def index_package(instance, **kwargs):
|
||||||
post_save.connect(index_package, sender=Package)
|
post_save.connect(index_package, sender=Package)
|
||||||
|
|
||||||
def mark_active_today(instance, **kw):
|
def mark_active_today(instance, **kw):
|
||||||
instance.is_active_today = True
|
if instance.package:
|
||||||
pre_save.connect(mark_active_today, sender=Package)
|
instance.package.is_active_today = True
|
||||||
|
instance.package.save()
|
||||||
|
pre_save.connect(mark_active_today, sender=PackageRevision)
|
||||||
|
|
||||||
unindex_package = lambda instance, **kwargs: instance.remove_from_index()
|
unindex_package = lambda instance, **kwargs: instance.remove_from_index()
|
||||||
post_delete.connect(unindex_package, sender=Package)
|
post_delete.connect(unindex_package, sender=Package)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче