Plain is headed towards 1.0! Subscribe for development updates →

plain-support

Captcha...

Security considerations

Most support forms allow you to type in an email address. Be careful, because anybody can pretend to be anybody else at this point. Converations either need to continue over email (which confirms they have access to the email account), or include a verification step (emailing a code to the email address, for example).

 1from plain.staff.cards import Card
 2from plain.staff.views import (
 3    StaffModelDetailView,
 4    StaffModelListView,
 5    StaffModelViewset,
 6    register_viewset,
 7)
 8
 9from .models import SupportFormEntry
10
11
12@register_viewset
13class SupportFormEntryStaff(StaffModelViewset):
14    class ListView(StaffModelListView):
15        model = SupportFormEntry
16        nav_section = "Support"
17        title = "Form entries"
18        fields = ["user", "email", "name", "form_slug", "created_at"]
19
20    class DetailView(StaffModelDetailView):
21        model = SupportFormEntry
22
23
24class UserSupportFormEntriesCard(Card):
25    title = "Recent support"
26    template_name = "support/card.html"
27
28    def get_template_context(self):
29        context = super().get_template_context()
30
31        context["entries"] = SupportFormEntry.objects.filter(user=self.view.object)
32
33        return context