mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-13 18:31:10 +01:00
* Use markdown on knowledgebase pages
* KB item 'last updated' only gets set on a new item * Allow linking to /tickets/submit/?queue=slug to pre-populate the 'Queue' folder
This commit is contained in:
parent
3f8fc2cd68
commit
5914e98d43
6
admin.py
6
admin.py
@ -20,6 +20,10 @@ class AttachmentInline(admin.StackedInline):
|
||||
class FollowUpAdmin(admin.ModelAdmin):
|
||||
inlines = [TicketChangeInline, AttachmentInline]
|
||||
|
||||
class KBItemAdmin(admin.ModelAdmin):
|
||||
list_display = ('category', 'title', 'last_updated',)
|
||||
list_display_links = ('title')
|
||||
|
||||
admin.site.register(Ticket, TicketAdmin)
|
||||
admin.site.register(Queue, QueueAdmin)
|
||||
admin.site.register(FollowUp, FollowUpAdmin)
|
||||
@ -27,4 +31,4 @@ admin.site.register(PreSetReply)
|
||||
admin.site.register(EscalationExclusion)
|
||||
admin.site.register(EmailTemplate)
|
||||
admin.site.register(KBCategory)
|
||||
admin.site.register(KBItem)
|
||||
admin.site.register(KBItem, KBItemAdmin)
|
||||
|
File diff suppressed because one or more lines are too long
@ -794,9 +794,11 @@ class KBItem(models.Model):
|
||||
_('Last Updated'),
|
||||
help_text=_('The date on which this question was most recently '
|
||||
'changed.'),
|
||||
blank=True,
|
||||
)
|
||||
|
||||
def save(self, force_insert=False, force_update=False):
|
||||
if not self.last_updated:
|
||||
self.last_updated = datetime.now()
|
||||
return super(KBItem, self).save(force_insert, force_update)
|
||||
|
||||
@ -924,4 +926,3 @@ def create_usersettings(sender, created_models=[], instance=None, created=False,
|
||||
|
||||
models.signals.post_syncdb.connect(create_usersettings)
|
||||
models.signals.post_save.connect(create_usersettings, sender=User)
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<tr class='row_columnheads'><th colspan='3'>{% trans "Article" %}</th></tr>
|
||||
|
||||
{% for item in items %}
|
||||
<tr class='row_even row_hover'><th><a href='{{ item.get_absolute_url }}'>{{ item.title }}</a></th><td>{{ item.score }}</td><td>{{ item.last_updated|timesince }}</td></tr>
|
||||
<tr class='row_even row_hover'><th><a href='{{ item.get_absolute_url }}'>{{ item.title }}</a></th><td>Rating: {{ item.score }}</td><td>Last Update: {{ item.last_updated|timesince }} ago</td></tr>
|
||||
<tr class='row_odd'><td colspan='3'>{{ item.question }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "helpdesk/public_base.html" %}{% load i18n %}
|
||||
{% extends "helpdesk/public_base.html" %}{% load i18n %}{% load markup %}
|
||||
|
||||
{% block helpdesk_body %}
|
||||
<h2>{% blocktrans with item.title as item %}Knowledgebase: {{ item }}{% endblocktrans %}</h2>
|
||||
@ -7,7 +7,7 @@
|
||||
<tr class='row_tablehead'><td>{{ item.title }}</td></tr>
|
||||
|
||||
<tr class='row_even row_hover'><th>{{ item.question }}</th></tr>
|
||||
<tr class='row_odd'><td>{{ item.answer }}</td></tr>
|
||||
<tr class='row_odd'><td>{{ item.answer|markdown }}</td></tr>
|
||||
</table>
|
||||
|
||||
<p>{% blocktrans with item.category.title as category_title and item.category.get_absolute_url as category_url %}View <a href='{{ category_url }}'>other <em>{{ category_title }}</em> articles</a>, or continue <a href='../'>viewing other knowledgebase articles</a>.{% endblocktrans %}</p>
|
||||
|
@ -38,7 +38,14 @@ def homepage(request):
|
||||
ticket.submitter_email)
|
||||
)
|
||||
else:
|
||||
form = PublicTicketForm()
|
||||
try:
|
||||
queue = Queue.objects.get(slug=request.GET.get('queue', None))
|
||||
except Queue.DoesNotExist:
|
||||
queue = None
|
||||
initial_data = {}
|
||||
if queue:
|
||||
initial_data['queue'] = queue.id
|
||||
form = PublicTicketForm(initial=initial_data)
|
||||
form.fields['queue'].choices = [('', '--------')] + [[q.id, q.title] for q in Queue.objects.filter(allow_public_submission=True)]
|
||||
|
||||
return render_to_response('helpdesk/public_homepage.html',
|
||||
|
Loading…
Reference in New Issue
Block a user