コード例 #1
0
    def post(self, request, *args, **kwargs):
        try:
            self.party = get_object_or_404(Party,
                                           reference=self.kwargs['party_ref'])
            self.party.save()

            for guest in self.party.guests().filter(attending=True):
                starter_id = self.request.POST.get(
                    '{}_starter_id'.format(guest.id), None)
                main_id = self.request.POST.get('{}_main_id'.format(guest.id),
                                                None)
                dessert_id = self.request.POST.get(
                    '{}_dessert_id'.format(guest.id), None)
                guest.starter_id = starter_id
                guest.main_id = main_id
                guest.dessert_id = dessert_id
                guest.save()

            send_email('Meal Option Responded',
                       render_to_string('wedding/guest_meals_email.html',
                                        {'party': self.party}),
                       settings.OUR_EMAILS,
                       html=True)
            messages.success(
                self.request,
                'Thank you for submitting. Your response has been saved.',
            )
        except Exception as e:
            messages.error(
                self.request,
                'An error occurred. It has been logged, please try later.')
            capture_exception(e)
        return HttpResponseRedirect(reverse_lazy('home', host='wedding'))
コード例 #2
0
 def post(self, request, *args, **kwargs):
     try:
         party = Party.objects.get(pin=self.request.POST['pin'])
         return HttpResponseRedirect(party.get_meal_url())
     except Exception as e:
         pass
     return HttpResponseRedirect(
         reverse_lazy('meal_pin', host='wedding') + '?e=1')
コード例 #3
0
    def get(self, request, *args, **kwargs):
        self.party = get_object_or_404(Party,
                                       reference=self.kwargs['party_ref'])
        self.party.last_accessed = timezone.now()
        self.party.save()

        if not settings.CAN_CHANGE_MEAL_CHOICE:
            messages.error(self.request,
                           'You can no longer change your meal choice.')
            return HttpResponseRedirect(reverse_lazy('home', host='wedding'))

        return super().get(self, request, *args, **kwargs)
コード例 #4
0
    def post(self, request, *args, **kwargs):
        try:
            self.party = get_object_or_404(Party,
                                           reference=self.kwargs['party_ref'])
            self.party.phone_number = self.request.POST.get(
                'phone_number', None)
            self.party.email_address = self.request.POST.get(
                'email_address', None)
            # self.party.attending = True if self.request.POST.get('attending', False) == 'Yes' else False
            self.party.rsvp_responded = True

            if self.party.offering_hotel_room:
                self.party.wants_hotel_room = True if self.request.POST.get(
                    'hotel_room', False) == 'Yes' else False
            if self.party.offering_hotel_room_day_before:
                self.party.wants_hotel_room_day_before = True if self.request.POST.get(
                    'hotel_room_night_before', False) == 'Yes' else False
            self.party.save()

            for guest in self.party.guests():
                dietary_req = self.request.POST.get(
                    '{}_dietary_req'.format(guest.id), None)
                guest.dietary_requirements_text = dietary_req
                guest.attending = True if self.request.POST.get(
                    '{}_attending'.format(guest.id), False) == 'Yes' else False
                if guest.is_plus_one:
                    guest_name = self.request.POST.get(
                        '{}_guest_name'.format(guest.id),
                        'none').split(' ', 1)
                    last = guest.surname
                    first = guest_name[0]
                    if len(guest_name) > 1:
                        last = guest_name[1]
                    guest.first_name = first
                    guest.surname = last
                guest.save()

            send_email(
                'RSVP Responded',
                '{} party has responded.'.format(self.party.description),
                settings.OUR_EMAILS)
            messages.success(
                self.request,
                'Thank you for submitting. Your response has been saved.')
        except Exception as e:
            messages.error(
                self.request,
                'An error occurred. It has been logged, please try later.')
            capture_exception(e)
        return HttpResponseRedirect(reverse_lazy('home', host='wedding'))
コード例 #5
0
# !!! WARNING: when deploying, make sure that Nginx always either overwrites or removes the `X-Forwarded-Proto` header !!!
# (see https://docs.djangoproject.com/en/stable/ref/settings/#secure-proxy-ssl-header)
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# Default values
DATABASE = 'sqlite'  # (custom setting; used below for selecting database configuration)
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
SECRET_KEY = ' '
DEBUG = True
ALLOWED_HOSTS = ['*']
INTERNAL_IPS = ['127.0.0.1']
MEDIA_ROOT = BASE_DIR.parent / 'media'
MEDIA_URL = '/media/'
SOCIAL_AUTH_DATAPORTEN_KEY = ''
SOCIAL_AUTH_DATAPORTEN_SECRET = ''
LOGIN_URL = reverse_lazy('login')
LOGIN_REDIRECT_URL = reverse_lazy('front_page')
LOGOUT_REDIRECT_URL = reverse_lazy('front_page')
CHECKIN_KEY = ''  # (custom setting)
REDIS_IP = '127.0.0.1'  # (custom setting)
REDIS_PORT = 6379  # (custom setting)
STREAM_KEY = ''  # (custom setting)
FILE_MAX_SIZE = 25 * 2**20  # 25 MiB (custom setting; the max on the server is 50 MiB)

# When using more than one subdomain, the session cookie domain has to be set so
# that the subdomains can use the same session. Currently points to "makentnu.localhost"
# should be changed in production. Cannot use only "localhost", as domains for cookies
# are required to have two dots in them.
SESSION_COOKIE_DOMAIN = ".makentnu.localhost"

# For `django-hosts` to redirect correctly across subdomains, we have to specify the
コード例 #6
0
ファイル: models.py プロジェクト: mountinash789/Challenges
 def get_meal_url(self):
     return reverse_lazy('rsvp_meal',
                         host='wedding',
                         kwargs={'party_ref': self.reference})
コード例 #7
0
ファイル: models.py プロジェクト: mountinash789/Challenges
 def get_absolute_url(self):
     return reverse_lazy('rsvp',
                         host='wedding',
                         kwargs={'party_ref': self.reference})
コード例 #8
0
 def get_absolute_url(self):
     return reverse_lazy('view', kwargs={'pk': self.id}, host='cookbook')
コード例 #9
0
ファイル: urls.py プロジェクト: xenim/django-radioportal
    url(r'^episode/(?P<pk>[\w-]+)/$', views.EpisodeEditView.as_view(), name="admin-episode-edit"),
    url(r'^episode/(?P<pk>[\w-]+)/delete/$', views.EpisodeDeleteView.as_view(), name="admin-episode-delete"),

    url(r'^episodepart/(?P<pk>[\w-]+)/$', views.EpisodePartEditView.as_view(), name="admin-episodepart-edit"),

    url(r'^channel/create/$', views.ChannelCreateView.as_view(), name="admin-channel-create"),
    url(r'^channel/(?P<pk>[\w-]+)/$', views.ChannelEditView.as_view(), name="admin-channel-edit"),
    url(r'^cluster/(?P<slug>[\w-]+)/$', views.ChannelClusterEditView.as_view(), name="admin-channel-edit-cluster"),
    url(r'^channel/(?P<pk>[\w-]+)/delete/$', views.ChannelDeleteView.as_view(), name="admin-channel-delete"),
    url(r'^channel/(?P<pk>[\w-]+)/cce/$', views.ChannelChangeCurrentEpisode.as_view(), name="admin-channel-cce"),

    
    url(r'^accounts/login/$', django.contrib.auth.views.login, {}, name="login"),
    url(r'^accounts/logout/$', django.contrib.auth.views.logout_then_login, {}, name="logout"),
    url(r'^accounts/change-password/$', django.contrib.auth.views.password_change, {'template_name': 'registration/password_change.html'}),
    url(r'^accounts/changed-password/$', django.contrib.auth.views.password_change_done, {'template_name': 'registration/password_changed.html'}, name="password_change_done"),

    url(r'^accounts/reset-password/$', django.contrib.auth.views.password_reset, {'post_reset_redirect': reverse_lazy('password_reset_done', host="dashboard")}),
    url(r'^accounts/reset-password/sent/$', django.contrib.auth.views.password_reset_done, name="password_reset_done"),
    url(r'^accounts/reset-password/(?P<uidb64>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', django.contrib.auth.views.password_reset_confirm, name="password_reset_confirm"),
    url(r'^accounts/reset-password/done/$', django.contrib.auth.views.password_reset_complete, name="password_reset_complete"),

    url(r'^icecast/source-auth/$', views.icecast_source_auth),
    url(r'^icecast/sandbox-lauth/$', views.icecast_sandbox_lauth),
    url(r'^messages/$', views.MessageListView.as_view(), name="admin-messages-list"),
)
if settings.DEBUG:
    urlpatterns += patterns('', 
        url(r'^debug/fake-stream/$', debug.FakeStreamView.as_view(), name='debug-fake-stream'),
    )