mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
Merge remote-tracking branch 'shash/fix_vote' into develop for #652
This commit is contained in:
commit
3a5e49452b
65
helpdesk/migrations/0018_auto_20181017_1737.py
Normal file
65
helpdesk/migrations/0018_auto_20181017_1737.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# Generated by Django 2.1.2 on 2018-10-17 17:37
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('helpdesk', '0017_default_owner_on_delete_null'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='kbitem',
|
||||||
|
name='voted_by',
|
||||||
|
field=models.ManyToManyField(to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='followup',
|
||||||
|
name='public',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Public tickets are viewable by the submitter and all staff, but non-public tickets can only be seen by staff.', verbose_name='Public'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ignoreemail',
|
||||||
|
name='keep_in_mailbox',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Do you want to save emails from this address in the mailbox? If this is unticked, emails from this address will be deleted.', verbose_name='Save Emails in Mailbox?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='queue',
|
||||||
|
name='allow_email_submission',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Do you want to poll the e-mail box below for new tickets?', verbose_name='Allow E-Mail Submission?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='queue',
|
||||||
|
name='allow_public_submission',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Should this queue be listed on the public submission form?', verbose_name='Allow Public Submission?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='queue',
|
||||||
|
name='email_box_ssl',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Whether to use SSL for IMAP or POP3 - the default ports when using SSL are 993 for IMAP and 995 for POP3.', verbose_name='Use SSL for E-Mail?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='savedsearch',
|
||||||
|
name='shared',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Should other users see this query?', verbose_name='Shared With Other Users?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ticket',
|
||||||
|
name='on_hold',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='If a ticket is on hold, it will not automatically be escalated.', verbose_name='On Hold'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ticketcc',
|
||||||
|
name='can_update',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Can this CC login and update the ticket?', verbose_name='Can Update Ticket?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ticketcc',
|
||||||
|
name='can_view',
|
||||||
|
field=models.BooleanField(blank=True, default=False, help_text='Can this CC login to view the ticket details?', verbose_name='Can View Ticket?'),
|
||||||
|
),
|
||||||
|
]
|
@ -1060,6 +1060,7 @@ class KBItem(models.Model):
|
|||||||
An item within the knowledgebase. Very straightforward question/answer
|
An item within the knowledgebase. Very straightforward question/answer
|
||||||
style system.
|
style system.
|
||||||
"""
|
"""
|
||||||
|
voted_by= models.ManyToManyField(settings.AUTH_USER_MODEL)
|
||||||
category = models.ForeignKey(
|
category = models.ForeignKey(
|
||||||
KBCategory,
|
KBCategory,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
@ -46,9 +46,11 @@ def vote(request, item):
|
|||||||
item = get_object_or_404(KBItem, pk=item)
|
item = get_object_or_404(KBItem, pk=item)
|
||||||
vote = request.GET.get('vote', None)
|
vote = request.GET.get('vote', None)
|
||||||
if vote in ('up', 'down'):
|
if vote in ('up', 'down'):
|
||||||
item.votes += 1
|
if request.user not in item.voted_by:
|
||||||
if vote == 'up':
|
|
||||||
item.recommendations += 1
|
item.votes += 1
|
||||||
item.save()
|
if vote == 'up':
|
||||||
|
item.recommendations += 1
|
||||||
|
item.save()
|
||||||
|
|
||||||
return HttpResponseRedirect(item.get_absolute_url())
|
return HttpResponseRedirect(item.get_absolute_url())
|
||||||
|
Loading…
Reference in New Issue
Block a user