Esempio n. 1
0
def create(request):
    form = CreateForm()
    if request.method == 'POST':
        form = CreateForm(request.POST)
        if form.is_valid():
            v = emod.Venue()
            v.name = form.cleaned_data.get('name')
            v.address = form.cleaned_data.get('address')
            v.city = form.cleaned_data.get('city')
            v.state = form.cleaned_data.get('state')
            v.zip = form.cleaned_data.get('zip')
            v.save()
            return HttpResponseRedirect('/event/venues/')

    template_vars = {
        'form': form,
    }
    return dmp_render_to_response(request, 'venues.create.html', template_vars)
Esempio n. 2
0
File: venues.py Progetto: dvnrsn/CHF
def create(request):
    '''Creates a venues'''
    form = CreateForm()
    if request.method == 'POST': # just submitted the form
        form = CreateForm(request.POST)
        if form.is_valid():
            # print('>>>>>>>>>>>>>>>>>> THE FORM IS VALID?')
            u = emod.Venue()
            u.name = form.cleaned_data.get('name')
            u.address = form.cleaned_data.get('address')
            u.city = form.cleaned_data.get('city')
            u.state = form.cleaned_data.get('state')
            u.zip_code = form.cleaned_data.get('zip_code')
            u.save()
            return HttpResponseRedirect('/event/venues')

    template_vars = {
        'form': form,
    }
    return dmp_render_to_response(request, 'venues.create.html', template_vars)
Esempio n. 3
0
###############################################
###   Venues and events

print()
print('Creating venues and events...')

# delete the existing ones
emod.Area.objects.all().delete()
emod.Event.objects.all().delete()
emod.Venue.objects.all().delete()

# create the venues
venues = []  # to save for use later
for i in range(1, 10):
    o = emod.Venue()
    o.name = 'Venue%i' % i
    o.address = 'Address %i' % i
    o.city = 'City%i' % i
    o.state = 'State%i' % i
    o.zip_code = 'ZipCode%i' % i
    o.save()
    print(o)
    venues.append(o)

# create the events
for i in range(1, 10):
    o = emod.Event()
    o.name = 'Event%i' % i
    o.description = 'Description of the event %i' % i
    o.start_date = datetime.datetime.now()