make quests optionially impolite
This commit is contained in:
parent
175261747e
commit
88fb835949
3 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 5.0.8 on 2024-12-26 16:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('control', '0017_userpermissions_quests'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='userpermissions',
|
||||
name='impolite_quests',
|
||||
field=models.BooleanField(default=False, verbose_name='dont say thanks after completing a quest'),
|
||||
),
|
||||
]
|
|
@ -43,6 +43,7 @@ class UserPermissions(models.Model):
|
|||
|
||||
nonpublic_themes = models.BooleanField(default=False, verbose_name=_('show non-public themes in theme selector'))
|
||||
quests: list[str] = SchemaField(schema=list[str], default=list)
|
||||
impolite_quests = models.BooleanField(default=False, verbose_name=_('dont say thanks after completing a quest'))
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('User Permissions')
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.urls import reverse_lazy
|
|||
from django.views.generic.edit import FormView
|
||||
|
||||
from c3nav.mapdata.quests.base import get_quest_for_request
|
||||
from c3nav.site.views import close_response
|
||||
|
||||
|
||||
class QuestFormView(FormView):
|
||||
|
@ -39,4 +40,6 @@ class QuestFormView(FormView):
|
|||
|
||||
def form_valid(self, form):
|
||||
form.save()
|
||||
if self.request.user_permissions.impolite_quests:
|
||||
return close_response(self.request)
|
||||
return super().form_valid(form)
|
Loading…
Add table
Add a link
Reference in a new issue