Skip to content

Commit

Permalink
Add custom css background
Browse files Browse the repository at this point in the history
  • Loading branch information
cuom1999 committed Sep 2, 2023
1 parent 036509c commit 5f80859
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 80 deletions.
2 changes: 2 additions & 0 deletions judge/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ class Meta:
"ace_theme",
"user_script",
"profile_image",
"css_background",
]
widgets = {
"user_script": AceWidget(theme="github"),
"timezone": Select2Widget(attrs={"style": "width:200px"}),
"language": Select2Widget(attrs={"style": "width:200px"}),
"ace_theme": Select2Widget(attrs={"style": "width:200px"}),
"profile_image": ImageWidget,
"css_background": forms.TextInput(),
}

has_math_config = bool(settings.MATHOID_URL)
Expand Down
24 changes: 24 additions & 0 deletions judge/migrations/0168_css_background.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 3.2.18 on 2023-09-02 00:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("judge", "0167_ultimate_contest_format"),
]

operations = [
migrations.AddField(
model_name="profile",
name="css_background",
field=models.TextField(
blank=True,
help_text='CSS custom background properties: url("image_url"), color, etc',
max_length=300,
null=True,
verbose_name="Custom background",
),
),
]
7 changes: 7 additions & 0 deletions judge/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ class Profile(models.Model):
)
profile_image = models.ImageField(upload_to=profile_image_path, null=True)
email_change_pending = models.EmailField(blank=True, null=True)
css_background = models.TextField(
verbose_name=_("Custom background"),
null=True,
blank=True,
help_text=_('CSS custom background properties: url("image_url"), color, etc'),
max_length=300,
)

@cached_property
def organization(self):
Expand Down
Loading

0 comments on commit 5f80859

Please sign in to comment.