new FT test_theme for theme switcher functionality; theme-switcher content added to home.html, several dashboard views & urls, all appropriate ITs & UTs; lyric user model saves theme (migrations run); django-compressor and django-libsass libraries added to dependencies
This commit is contained in:
@@ -7,6 +7,9 @@ from .models import Item, List
|
||||
from apps.lyric.models import User
|
||||
|
||||
|
||||
UNLOCKED_THEMES = frozenset(["theme-default"])
|
||||
|
||||
|
||||
def home_page(request):
|
||||
return render(request, "apps/dashboard/home.html", {"form": ItemForm()})
|
||||
|
||||
@@ -59,3 +62,13 @@ def share_list(request, list_id):
|
||||
pass
|
||||
messages.success(request, "An invite has been sent if that address is registered.")
|
||||
return redirect(our_list)
|
||||
|
||||
def set_theme(request):
|
||||
if not request.user.is_authenticated:
|
||||
return redirect("home")
|
||||
if request.method == "POST":
|
||||
theme = request.POST.get("theme", "")
|
||||
if theme in UNLOCKED_THEMES:
|
||||
request.user.theme = theme
|
||||
request.user.save(update_fields=["theme"])
|
||||
return redirect("home")
|
||||
|
||||
Reference in New Issue
Block a user