mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 18:00:45 +01:00
Added unique related_name “usersetttings_helpdesk” for the one-to-one relation to User in UserSettings.
This commit is contained in:
parent
9fbe464445
commit
4e018db5a6
@ -253,7 +253,7 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
||||
|
||||
if ticket.assigned_to and \
|
||||
ticket.assigned_to != user and \
|
||||
ticket.assigned_to.usersettings.settings.get('email_on_ticket_assign', False) and \
|
||||
ticket.assigned_to.usersettings_helpdesk.settings.get('email_on_ticket_assign', False) and \
|
||||
ticket.assigned_to.email and \
|
||||
ticket.assigned_to.email not in messages_sent_to:
|
||||
send_templated_mail(
|
||||
|
@ -1084,10 +1084,12 @@ class UserSettings(models.Model):
|
||||
as notification preferences and other things that should probably be
|
||||
configurable.
|
||||
|
||||
We should always refer to user.usersettings.settings['setting_name'].
|
||||
We should always refer to user.usersettings_helpdesk.settings['setting_name'].
|
||||
"""
|
||||
|
||||
user = models.OneToOneField(settings.AUTH_USER_MODEL)
|
||||
user = models.OneToOneField(
|
||||
settings.AUTH_USER_MODEL,
|
||||
related_name="usersettings_helpdesk")
|
||||
|
||||
settings_pickled = models.TextField(
|
||||
_('Settings Dictionary'),
|
||||
|
@ -27,7 +27,7 @@ def homepage(request):
|
||||
(request.user.is_authenticated() and
|
||||
helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE):
|
||||
try:
|
||||
if request.user.usersettings.settings.get('login_view_ticketlist', False):
|
||||
if request.user.usersettings_helpdesk.settings.get('login_view_ticketlist', False):
|
||||
return HttpResponseRedirect(reverse('helpdesk:list'))
|
||||
else:
|
||||
return HttpResponseRedirect(reverse('helpdesk:dashboard'))
|
||||
|
@ -578,10 +578,10 @@ def update_ticket(request, ticket_id, public=False):
|
||||
|
||||
if (not reassigned or
|
||||
(reassigned and
|
||||
ticket.assigned_to.usersettings.settings.get(
|
||||
ticket.assigned_to.usersettings_helpdesk.settings.get(
|
||||
'email_on_ticket_assign', False))) or \
|
||||
(not reassigned and
|
||||
ticket.assigned_to.usersettings.settings.get(
|
||||
ticket.assigned_to.usersettings_helpdesk.settings.get(
|
||||
'email_on_ticket_change', False)):
|
||||
send_templated_mail(
|
||||
template_staff,
|
||||
@ -914,7 +914,7 @@ def ticket_list(request):
|
||||
return render(request, 'helpdesk/ticket_list.html', dict(
|
||||
context,
|
||||
tickets=ticket_qs,
|
||||
default_tickets_per_page=request.user.usersettings.settings.get('tickets_per_page') or 25,
|
||||
default_tickets_per_page=request.user.usersettings_helpdesk.settings.get('tickets_per_page') or 25,
|
||||
user_choices=User.objects.filter(is_active=True, is_staff=True),
|
||||
queue_choices=user_queues,
|
||||
status_choices=Ticket.STATUS_CHOICES,
|
||||
@ -965,7 +965,7 @@ def create_ticket(request):
|
||||
return HttpResponseRedirect(reverse('helpdesk:dashboard'))
|
||||
else:
|
||||
initial_data = {}
|
||||
if request.user.usersettings.settings.get('use_email_as_submitter', False) and request.user.email:
|
||||
if request.user.usersettings_helpdesk.settings.get('use_email_as_submitter', False) and request.user.email:
|
||||
initial_data['submitter_email'] = request.user.email
|
||||
if 'queue' in request.GET:
|
||||
initial_data['queue'] = request.GET['queue']
|
||||
@ -1312,7 +1312,7 @@ delete_saved_query = staff_member_required(delete_saved_query)
|
||||
|
||||
|
||||
def user_settings(request):
|
||||
s = request.user.usersettings
|
||||
s = request.user.usersettings_helpdesk
|
||||
if request.POST:
|
||||
form = UserSettingsForm(request.POST)
|
||||
if form.is_valid():
|
||||
|
Loading…
Reference in New Issue
Block a user