I need 4 forms to: sign up for an event (1), un-sign up for an event (2), 
type in a passcode to manage an event (3) which then shows a modal box that 
allows that person to check in everyone that shows up at the event (4). I'm 
using a (ListView, FormView) to allow looping through the numerous events, 
each of which has a form on it (but it's the same class of form that's used 
for signing up).

My current CBV:

class EventsDisplay(ListView, FormView):
    template_name='events/index.html'
    context_object_name = "events_list"
    queryset = Events.objects.all().order_by("date")
    form_class = SignUpForm
    success_url = "/events/success"

    def get_context_data(self, **kwargs):
        self.object_list = self.get_queryset()
        context = super(EventsDisplay, self).get_context_data(**kwargs)
        context['announcement'] = 
Announcement.objects.all().order_by("-datetime")
        context['signup'] = SignUps.objects.all().order_by("fullname")
        return context

    def form_valid(self, form):
        instance = form.save(commit=False)
        instance.ip = get_ip(self.request)
        instance.save()
        return super(EventsDisplay, self).form_valid(form)

How would I modify this to support up to 4 different classes of forms.


I'll provided screenshots of my website to better clarify what I want to do:

All the events are displayed on one page, each event has a sign up form 
(with a hidden input containing the {{ events.name }}: 
https://i.gyazo.com/d8da1b0aefb9093b6b63a7f2da0bf428.png

Clicking on OCC Check-Ins, a modal shows up where a passcode is needed to 
access the check-ins: 
https://i.gyazo.com/998330055f27feedb12491d6fd0ac60c.png

Not yet made, but after the passcode is validated for the given event, 
another modal appears where the person can check in people at the event, so 
I'll need a form there.

Clicking on the down arrow brings up a modal that allows users to remove 
themselves (unsign up): 
https://i.gyazo.com/71c8598f77f79643e3b10a8dd67a733d.png I'm using a form 
to POST the {{ events.name }} (hidden input) and the {{ signups.fullname}} 
(hidden 
input) to .delete() the sign up/object.


If it's not possible to do this, will it work if I only have 2 distinct 
forms?

If you would like any additional information/code/clarification, I will 
gladly post them.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/11378ba0-7beb-44d8-8dfd-fc2cf14096a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to