urlpatterns = [
path('', views.home, name ='home'),
path('home/', views.allTurfs,name = 'allturfs'),
path('profile/', views.dashboard, name = 'profile'),
path('about/', views.about, name = 'about'),
path('add_venue/', views.add_Turf, name = 'add_turf'),
path('<slug:slug_p>/', views.allTurfs, name='turf_by_place'),
path('<slug:slug_p>/<slug_t>', views.Turf_det, name='turf_det'),
path('add_time_slot/<int:turf_id>/', views.add_time_slot, name=
'add_time_slot'),
]

On Wednesday, November 1, 2023 at 8:17:28 PM UTC+5:30 Migui Galan wrote:

> Hi! can you include the urls.py code? this is mainly because you have not 
> included the <id> within the url setup
>
> On Wed, Nov 1, 2023 at 10:42 PM Sudharsan <sudhar...@gmail.com> wrote:
>
>> i getting an error while doing python django project. i was tried many 
>> things but nothing works. Please help me guys.
>> [image: error.png]
>> *views.py*
>> # view for adding Turf page
>> def add_Turf(request):
>> submitted = False
>> if request.method == "POST":
>> form = TurfForm(request.POST)
>> if form.is_valid():
>> var = form.save(commit=False)
>> var.created_by = request.user
>> var.save()
>> messages.info(request, ' Your Turf has added successfully')
>> turf_id=var.id
>> return redirect('add_time_slot',turf_id=turf_id)
>> else:
>> form = TurfForm
>> if 'submitted' in request.GET:
>> submitted = True
>> return render(request, 'addvenue.html',{'form': form, 'submitted': 
>> submitted})
>>
>>
>> # view for adding time slot
>>
>> def add_time_slot(request,turf_id):
>> turf = Venue.objects.get(pk=turf_id)
>> if request.method == 'POST':
>> form = TimeSlotForm(request.POST)
>> if form.is_valid():
>> timeslot = form.save(commit=False)
>> timeslot.turf = turf # Set the Turf for this TimeSlot
>> timeslot.save()
>> return redirect('add_time_slot', turf_id=turf)
>> else:
>> form = TimeSlotForm()
>> return render(request, 'add_time_slot.html', {'form': form, 'turf': 
>> turf})
>>
>>
>>
>> [image: modelspy.png][image: modelspy2.png][image: error3.png]
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/439756cf-9e61-430f-8d28-c72afb9b4a49n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/439756cf-9e61-430f-8d28-c72afb9b4a49n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a80543c-1b04-4e13-ba06-8b6ab029886en%40googlegroups.com.

Reply via email to