Skip to content

Tag: django

Django Foreign Key to Multiple Models

Is there a way to make one model be able to foreignkey to more than one model? For example Answer So you want to connect both the model jeans and shirt with cloth so you an connect like that I am afraid that’s not possible which you are trying but you can connect both model like that or the second

Django Model form not rendering

Im trying to create a model form on django but it doesnt want to render even though I mapped it properly and created the path. models.py forms.py views.py it refuse to render but it displays the html tag that is in the file but not the fields from the form. this is the html template AppsForm.html Answer you v…

Multiple image in one queryset Django

How to add multiple images within one django queryset that will have a image field? It can be done through foreignkey but if i use different table for image then id’s will be generated differently Can anyone help me on how exactly i can upload multiple images on one django queryset? Example: We can uplo…

How to Redirect URLs to a certain URL Django Regex

In my URLs.py, I’m setting my URL like this Navigating to localhost:8000/mobile works as expected but if typed in the URL: localhost:8000/mobile/hello/world/234234hjhf8sc3 it should redirect to localhost:8000/mobile however this does not happen because my regex is incorrect (I’m not sure) How coul…