Re: help with "Key 'timeout' not found in "
timeout field is just an INTEGER.. just saying the amount of time the space will be reserved.
class Reservation(models.Model): user = models.ForeignKey(User) park = models.ForeignKey(Park) notification = models.ForeignKey(Notification) timeout = models.IntegerField() active = models.BooleanField() parked = models.BooleanField() reservation_date = models.DateTimeField('date reserved')
On Thursday, May 3, 2012 11:58:19 PM UTC+1, Kurtis wrote:
Can we see what your "Reservation" model looks like? Specifically, that 'timeout' field?
hi i have done a succefull query and i converted the results into links so i can make a post by clicking on the links to make a reservation.my problem is, theres a variable timeout that i want to specify manually, but i get a "Key 'timeout' not found in <QueryDict: {}>"i know i am supposed to pass that variable but i just dont know how.my code is :--def reserve (request,user_id,park_id):#only works if the user exists in databaseu = get_object_or_404(User, pk=user_id)n = get_object_or_404(Notification, pk=park_id) p = get_object_or_404(Park, pk=1)r = Reservation(user=u ,notification=n, park=p, timeout=int(request.POST['timeout']),active=True,parked= False,reservation_date= datetime.now()) r.save()return HttpResponse('Spot reserved')html:{% if parks %} <p>You searched for: <strong>{{ query }}</strong></p> <p>Found {{ parks|length }} park{{ parks|pluralize }}.</p> <ul> {% for park in parks %} <input type="text" name="timeout" value="60" id="timeout"> <li><a href="/accounts/{{ user.id }}/reserve/{{ park.id }}">{{ park.park_address }}</a></li> {% endfor %} </ul> {% endif %}can someone help me?
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ .iTBJptqGhyoJ
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com .
For more options, visit this group at http://groups.google.com/group/django-users?hl=en .
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/KGbfHKRKmrYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home