resend invite sms in admin backend, admin view improvements
This commit is contained in:
parent
972277ebcd
commit
bf3b276e39
|
@ -19,10 +19,24 @@ class ShiftAdmin(admin.ModelAdmin):
|
||||||
return object.room.required_helpers - object.shiftregistration_set.count()
|
return object.room.required_helpers - object.shiftregistration_set.count()
|
||||||
|
|
||||||
|
|
||||||
# admin.site.register(Shift)
|
def send_login(modeladmin, request, queryset):
|
||||||
|
for helper in queryset:
|
||||||
|
helper.send_confirmation()
|
||||||
|
|
||||||
|
|
||||||
|
class RegistationInline(admin.TabularInline):
|
||||||
|
model = ShiftRegistration
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Helper)
|
||||||
|
class HelperAdmin(admin.ModelAdmin):
|
||||||
|
readonly_fields = ("phone",)
|
||||||
|
fields = ("name", "phone", "number_validated")
|
||||||
|
list_display = ("name",)
|
||||||
|
inlines = (RegistationInline,)
|
||||||
|
actions = (send_login,)
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Helper)
|
|
||||||
admin.site.register(ShiftRegistration)
|
admin.site.register(ShiftRegistration)
|
||||||
admin.site.register(Message)
|
admin.site.register(Message)
|
||||||
admin.site.register(LoginToken)
|
admin.site.register(LoginToken)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Shift(models.Model):
|
||||||
|
|
||||||
class Helper(models.Model):
|
class Helper(models.Model):
|
||||||
# todo: add propper phone number validation, maybe even country code?
|
# todo: add propper phone number validation, maybe even country code?
|
||||||
phone = models.CharField(max_length=200, primary_key=True)
|
phone = models.CharField(max_length=200, primary_key=True, editable=False)
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
# change this to a generic state variable to allow for number blocking/account deactivation?
|
# change this to a generic state variable to allow for number blocking/account deactivation?
|
||||||
number_validated = models.BooleanField(default=False)
|
number_validated = models.BooleanField(default=False)
|
||||||
|
@ -86,6 +86,9 @@ class ShiftRegistration(models.Model):
|
||||||
shift__start_at__lte=timezone.now() + timedelta(minutes=60),
|
shift__start_at__lte=timezone.now() + timedelta(minutes=60),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.helper.name}: {self.shift}"
|
||||||
|
|
||||||
|
|
||||||
class Message(models.Model):
|
class Message(models.Model):
|
||||||
# remove limit and send long messages in multiple messages?
|
# remove limit and send long messages in multiple messages?
|
||||||
|
|
Loading…
Reference in New Issue