mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-20 15:02:31 +00:00
Add button for creating forum thread draft from event detail
TODO: Allow RIGS to ingest POST requests sent from the forum on new posts in RIG info to link up the forum thread RE https://forum.nottinghamtec.co.uk/t/rigs-discourse-integration/15592/21
This commit is contained in:
@@ -3,6 +3,7 @@ import datetime
|
||||
import re
|
||||
import premailer
|
||||
import simplejson
|
||||
import urllib
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
@@ -377,3 +378,20 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView):
|
||||
context['to_name'] = self.request.GET.get('to_name', None)
|
||||
context['target'] = 'event_authorise_form_preview'
|
||||
return context
|
||||
|
||||
|
||||
class CreateForumThread(generic.base.RedirectView):
|
||||
permanent = False
|
||||
|
||||
def get_redirect_url(self, *args, **kwargs):
|
||||
event = get_object_or_404(models.Event, pk=kwargs['pk'])
|
||||
|
||||
if event.forum_url:
|
||||
return event.forum_url
|
||||
|
||||
params = {
|
||||
'title': str(event),
|
||||
'body': 'https://rigs.nottinghamtec.co.uk/event/{}'.format(event.pk),
|
||||
'category': 'rig-info'
|
||||
}
|
||||
return 'https://forum.nottinghamtec.co.uk/new-topic' + "?" + urllib.parse.urlencode(params)
|
||||
|
||||
Reference in New Issue
Block a user