diff --git a/vrobbler/apps/profiles/forms.py b/vrobbler/apps/profiles/forms.py index 043a092..200b9db 100644 --- a/vrobbler/apps/profiles/forms.py +++ b/vrobbler/apps/profiles/forms.py @@ -33,6 +33,7 @@ class UserProfileForm(forms.ModelForm): "ntfy_enabled", "redirect_to_webpage", "enable_public_widgets", + "widget_custom_css", ] widgets = { "lastfm_password": forms.PasswordInput(render_value=True), diff --git a/vrobbler/apps/profiles/migrations/0030_userprofile_widget_custom_css.py b/vrobbler/apps/profiles/migrations/0030_userprofile_widget_custom_css.py new file mode 100644 index 0000000..a75e53d --- /dev/null +++ b/vrobbler/apps/profiles/migrations/0030_userprofile_widget_custom_css.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.29 on 2026-03-20 17:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("profiles", "0029_userprofile_enable_public_widgets"), + ] + + operations = [ + migrations.AddField( + model_name="userprofile", + name="widget_custom_css", + field=models.TextField(blank=True, null=True), + ), + ] diff --git a/vrobbler/apps/profiles/models.py b/vrobbler/apps/profiles/models.py index 34ae732..0b75aa7 100644 --- a/vrobbler/apps/profiles/models.py +++ b/vrobbler/apps/profiles/models.py @@ -62,6 +62,7 @@ class UserProfile(TimeStampedModel): redirect_to_webpage = models.BooleanField(default=True) enable_public_widgets = models.BooleanField(default=False) + widget_custom_css = models.TextField(**BNULL) def __str__(self): return f"User profile for {self.user}" diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index fe7561a..394c938 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -1037,6 +1037,7 @@ class EmbeddableTopArtistWidget(TemplateView): raise Http404("Public widgets are not enabled for this user") context["user"] = user + context["custom_css"] = profile.widget_custom_css artist = { "user": user, @@ -1071,6 +1072,7 @@ class EmbeddableTopBoardGamesMonthWidget(TemplateView): raise Http404("Public widgets are not enabled for this user") context["user"] = user + context["custom_css"] = profile.widget_custom_css now = timezone.now() if user.is_authenticated: @@ -1117,6 +1119,7 @@ class EmbeddableTopBoardGamesWeekWidget(TemplateView): raise Http404("Public widgets are not enabled for this user") context["user"] = user + context["custom_css"] = profile.widget_custom_css now = timezone.now() if user.is_authenticated: @@ -1161,6 +1164,7 @@ class EmbeddableTopBoardGamesYearWidget(TemplateView): raise Http404("Public widgets are not enabled for this user") context["user"] = user + context["custom_css"] = profile.widget_custom_css now = timezone.now() if user.is_authenticated: diff --git a/vrobbler/templates/base.html b/vrobbler/templates/base.html index 273c4ec..96051c5 100644 --- a/vrobbler/templates/base.html +++ b/vrobbler/templates/base.html @@ -185,6 +185,13 @@ {{ imdb_form }} {% endif %} + {% if user.is_authenticated %} + + {% endif %}