Ejemplo n.º 1
0
def eventEdit(request, eventId=None):
    if eventId is None:
        item = Event()
        item.programmer = Programmer.objects.get(user=request.user)
    else:
        item = get_object_or_404(Event, id=eventId)
    return itemEdit(request, item, EventForm, EventAdminForm, 'editEvent.html')
Ejemplo n.º 2
0
def eventEdit(request, eventId=None):
    if eventId is None:
        item = Event()
        item.programmer = Programmer.objects.get(user=request.user)
    else:
        item = get_object_or_404(Event, id=eventId)
    return itemEdit(request, item, EventForm, EventAdminForm, 'editEvent.html')
Ejemplo n.º 3
0
def event(request, id):
    if id == '0' and request.user.is_authenticated():
        event = Event()
        event.programmer = Programmer.objects.get(user=request.user)
        event.startTime = time(19, 30)
        event.endTime = time(19, 30)
        try:
            year = int(request.GET['year'])
            month = int(request.GET['month'])
            if year in range(1970,2050) and month in range(1,13):
                event.startDate = date(year, month, 1)
            else:
                event.startDate = date.today()
        except:
            event.startDate = date.today()
        event.save()
    else:
        event = get_object_or_404(Event, id=id)
        if not request.user.is_authenticated():
            if event.deleted or not event.confirmed:
                raise Http404
    return render_to_response('programming/event.html',
                              {
                                  'maintitle': event.title,
                                  'event': event,
                                  'extramessage': event.extramessage(request),
                                  'fillerImage': Picture.objects.get(id=789),
                              },
                              context_instance=RequestContext(request)
    )