def event_create(request): context = { 'sadmin2_menu_main_active': 'events', 'sadmin2_breadcrumbs_active': 'events_create', 'sadmin2_menu_tab': menu.sadmin2_menu_tab_events, 'sadmin2_menu_tab_active': 'events' } return generic_create_view( request, EventForm, redirect_success_url_callback=lambda instance: reverse('sadmin2:event_attendees', kwargs={'event_pk': instance.pk}), message_success=_('Event created'), context=context )
def users_create(request): context = { 'sadmin2_menu_main_active': 'users', 'sadmin2_breadcrumbs_active': 'users_create', 'sadmin2_menu_tab': menu.sadmin2_menu_tab_users, 'sadmin2_menu_tab_active': 'users' } return generic_create_view( request, UserForm, redirect_success_url_callback=lambda instance: reverse('sadmin2:user', kwargs={'user_pk': instance.pk}), message_success=_('User created'), context=context, template='sadmin2/generic/form.html' )
def event_attendee_payments(request, event_pk, attendee_pk): event = get_object_or_404(Event, pk=event_pk) attendee = get_object_or_404(event.attendees, pk=attendee_pk) payment_keys = request_attendee_pks_signal.send(None, attendee=attendee) payments = attendee.payment_set.all() context = { 'sadmin2_menu_main_active': 'events', 'sadmin2_breadcrumbs_active': 'event_attendees_attendee_payments', 'sadmin2_menu_tab': menu.sadmin2_menu_tab_attendee, 'sadmin2_menu_tab_active': 'payments', 'event': event, 'attendee': attendee, 'payment_keys': payment_keys, 'payments': payments, } def save_callback(payment): payment.note = 'Manual payment' payment.signee = request.user payment.attendee = attendee payment.user = attendee.user payment.save() attendee_updated_signal.send(event_attendee_selections, attendee=attendee) return generic_create_view( request, PaymentForm, redirect_success_url=reverse('sadmin2:event_attendee_payments', kwargs={ 'event_pk': event.pk, 'attendee_pk': attendee.pk }), message_success=_('Payment registered'), instance_save_callback=save_callback, template='sadmin2/event/attendee_payments.html', context=context )
def event_selections_edit_group(request, event_pk, group_pk): event = get_object_or_404(Event, pk=event_pk) group = get_object_or_404(event.optiongroups, pk=group_pk) context = { "sadmin2_menu_main_active": "events", "sadmin2_breadcrumbs_active": "event_selections_edit_group", "sadmin2_menu_tab": menu.sadmin2_menu_tab_event, "sadmin2_menu_tab_active": "selections", "event": event, "option_group": group, } return generic_create_view( request, OptionGroupForm, reverse("sadmin2:event_settings_selections", kwargs={"event_pk": event.pk}), message_success=_("Option group saved"), context=context, instance=group, )
def event_selections_create_group(request, event_pk): event = get_object_or_404(Event, pk=event_pk) context = { "sadmin2_menu_main_active": "events", "sadmin2_breadcrumbs_active": "event_selections_create_group", "sadmin2_menu_tab": menu.sadmin2_menu_tab_event, "sadmin2_menu_tab_active": "selections", "event": event, } def save_callback(instance): instance.event = event instance.save() return generic_create_view( request, OptionGroupForm, reverse("sadmin2:event_settings_selections", kwargs={"event_pk": event.pk}), message_success=_("Option group created"), context=context, instance_save_callback=save_callback, )