Fix some bugs
This commit is contained in:
parent
88845aebd8
commit
05ab90e1d4
3 changed files with 13 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import lxml.html as lh
|
import lxml.html as lh
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from lxml.html.clean import clean_html
|
from lxml_html_clean import clean_html
|
||||||
|
|
||||||
|
|
||||||
def strip_error_html(apps, schema_editor):
|
def strip_error_html(apps, schema_editor):
|
||||||
|
|
|
@ -9,6 +9,7 @@ from django.db.models.signals import post_delete, post_save
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
import judge
|
import judge
|
||||||
|
from judge import template_context
|
||||||
from judge.utils.problems import finished_submission
|
from judge.utils.problems import finished_submission
|
||||||
from .models import (
|
from .models import (
|
||||||
BlogPost,
|
BlogPost,
|
||||||
|
@ -25,6 +26,7 @@ from .models import (
|
||||||
Submission,
|
Submission,
|
||||||
NavigationBar,
|
NavigationBar,
|
||||||
Solution,
|
Solution,
|
||||||
|
ContestProblem,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,9 +171,16 @@ def contest_submission_update(sender, instance, **kwargs):
|
||||||
|
|
||||||
@receiver(post_save, sender=NavigationBar)
|
@receiver(post_save, sender=NavigationBar)
|
||||||
def navbar_update(sender, instance, **kwargs):
|
def navbar_update(sender, instance, **kwargs):
|
||||||
judge.template_context._nav_bar.dirty()
|
template_context._nav_bar.dirty()
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=Solution)
|
@receiver(post_save, sender=Solution)
|
||||||
def solution_update(sender, instance, **kwargs):
|
def solution_update(sender, instance, **kwargs):
|
||||||
cache.delete(make_template_fragment_key("solution_content", (instance.id,)))
|
cache.delete(make_template_fragment_key("solution_content", (instance.id,)))
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_delete, sender=ContestProblem)
|
||||||
|
def contest_problem_delete(sender, instance, **kwargs):
|
||||||
|
Submission.objects.filter(
|
||||||
|
contest_object=instance.contest, contest__isnull=True
|
||||||
|
).update(contest_object=None)
|
||||||
|
|
|
@ -44,3 +44,4 @@ mdx-breakless-lists
|
||||||
beautifulsoup4
|
beautifulsoup4
|
||||||
pre-commit
|
pre-commit
|
||||||
django-ratelimit
|
django-ratelimit
|
||||||
|
lxml_html_clean
|
Loading…
Reference in a new issue