1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-11-06 07:12:28 +01:00

Merge branch 'app_download_links' into 'main'

apps: add download links on login page

See merge request bde/nk20!358
This commit is contained in:
alexismdr
2025-11-04 11:30:58 +01:00
9 changed files with 286 additions and 0 deletions

View File

@@ -50,6 +50,15 @@ class CustomLoginView(LoginView):
self.request.session['permission_mask'] = form.cleaned_data['permission_mask'].rank
return super().form_valid(form)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user_agent = self.request.META.get('HTTP_USER_AGENT', '').lower()
context['display_appstore_badge'] = 'iphone' in user_agent or 'android' not in user_agent
context['display_playstore_badge'] = 'android' in user_agent or 'iphone' not in user_agent
return context
class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
"""