Ejemplo n.º 1
0
def event(request, event_id):
    from apps.schedule.models.message import EventModerationMessage, EventMessage

    event = Event.get_event_or_404(event_id, request.user)
    moderation_messages = EventModerationMessage.get_event_messages(event)
    event_messages = EventMessage.get_event_messages(event)

    return TemplateResponse(request, 'schedule/event.html', locals())
Ejemplo n.º 2
0
def change_interested(request, event_id):
    event = Event.get_event_or_404(event_id, request.user)
    if request.user in event.interested.all():
        event.interested.remove(request.user)
        messages.success(request, 'Nie obsereujesz już wydarzenia')
    else:
        event.interested.add(request.user)
        messages.success(request, 'Obserwujesz wydarzenie')

    return redirect(event)
Ejemplo n.º 3
0
 def test_get_event_or_404_returns_event_if_exists_and_user_can_see(self):
     employee = Employee.objects.get().user
     event = factories.EventFactory(author=employee)
     ret = Event.get_event_or_404(event.id, employee)
     self.assertEqual(event, ret)