This commit is contained in:
cuom1999 2022-09-04 12:32:10 -05:00
parent ba75b5c086
commit 9d9d171209
3 changed files with 23 additions and 11 deletions

View file

@ -176,7 +176,12 @@ class LogEntryAdmin(admin.ModelAdmin):
"object_link",
"diff_link",
)
search_fields = ("object_repr", "change_message", "user__username", "content_type__model")
search_fields = (
"object_repr",
"change_message",
"user__username",
"content_type__model",
)
list_filter = (UserListFilter, "content_type")
list_display_links = None
actions = None

View file

@ -394,10 +394,13 @@ class ProblemAdmin(CompareVersionAdmin):
admins = Profile.objects.filter(user__is_superuser=True).all()
users = users.union(users, admins)
link = reverse_lazy("admin:judge_problem_change", args=(obj.id,))
html = f"<a href=\"{link}\">{obj.name}</a>"
html = f'<a href="{link}">{obj.name}</a>'
for user in users:
notification = Notification(
owner=user, html_link=html, category="Problem public: " + str(obj.is_public), author=request.profile
owner=user,
html_link=html,
category="Problem public: " + str(obj.is_public),
author=request.profile,
)
notification.save()

View file

@ -6,18 +6,22 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0130_auto_20220831_1048'),
("judge", "0130_auto_20220831_1048"),
]
operations = [
migrations.AlterField(
model_name='notification',
name='category',
field=models.CharField(max_length=50, verbose_name='category'),
model_name="notification",
name="category",
field=models.CharField(max_length=50, verbose_name="category"),
),
migrations.AlterField(
model_name='problemtranslation',
name='language',
field=models.CharField(choices=[('en', 'English'), ('vi', 'Vietnamese')], max_length=7, verbose_name='language'),
model_name="problemtranslation",
name="language",
field=models.CharField(
choices=[("en", "English"), ("vi", "Vietnamese")],
max_length=7,
verbose_name="language",
),
),
]