|
@ -1,7 +1,9 @@ |
|
|
from django.contrib import admin |
|
|
from django.contrib import admin |
|
|
|
|
|
from django.contrib.auth import login as auth_login |
|
|
from django.contrib.auth.admin import UserAdmin |
|
|
from django.contrib.auth.admin import UserAdmin |
|
|
from django.contrib.auth.models import User |
|
|
from django.contrib.auth.models import User |
|
|
from django.db.models import Count, F |
|
|
from django.db.models import Count, F |
|
|
|
|
|
from django.shortcuts import redirect |
|
|
from django.template.loader import render_to_string |
|
|
from django.template.loader import render_to_string |
|
|
from django.urls import reverse |
|
|
from django.urls import reverse |
|
|
from django.utils.html import escape |
|
|
from django.utils.html import escape |
|
@ -121,6 +123,7 @@ class ProfileAdmin(admin.ModelAdmin): |
|
|
NumChecksFilter, |
|
|
NumChecksFilter, |
|
|
"theme", |
|
|
"theme", |
|
|
) |
|
|
) |
|
|
|
|
|
actions = ("login",) |
|
|
|
|
|
|
|
|
fieldsets = (ProfileFieldset.tuple(), TeamFieldset.tuple()) |
|
|
fieldsets = (ProfileFieldset.tuple(), TeamFieldset.tuple()) |
|
|
|
|
|
|
|
@ -160,6 +163,11 @@ class ProfileAdmin(admin.ModelAdmin): |
|
|
def sms(self, obj): |
|
|
def sms(self, obj): |
|
|
return "%d of %d" % (obj.sms_sent, obj.sms_limit) |
|
|
return "%d of %d" % (obj.sms_sent, obj.sms_limit) |
|
|
|
|
|
|
|
|
|
|
|
def login(self, request, qs): |
|
|
|
|
|
profile = qs.get() |
|
|
|
|
|
auth_login(request, profile.user, "hc.accounts.backends.EmailBackend") |
|
|
|
|
|
return redirect("hc-index") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Project) |
|
|
@admin.register(Project) |
|
|
class ProjectAdmin(admin.ModelAdmin): |
|
|
class ProjectAdmin(admin.ModelAdmin): |
|
|