Relative Content

Tag Archive for pythondjangodjango-forms

show chekbox in django marked when instantiating a form

I have the following code:
views.py
def actualizar_rutina(request, id_rutina):
if not request.user.es_entrenador:
messages.error(request, ‘Usted no tiene permisos para acceder a esta pagina’)
return redirect(‘mostrar_rutina’)

show chekbox in django marked when instantiating a form

I have the following code:
views.py
def actualizar_rutina(request, id_rutina):
if not request.user.es_entrenador:
messages.error(request, ‘Usted no tiene permisos para acceder a esta pagina’)
return redirect(‘mostrar_rutina’)

how to create a form using multiple models in django?

So I am trying to make a student result management project.Where I can add students subhect grade and exam result.In the project i need to make a form where i can add marks of a subject to all the students of a grade(Class) at once.I want the look like the photo.Example Example .

Interact with inbuilt django DB in python files

I have a form that needs to interact with the DB inbuilt into django. How would I do that in my forms.py file. Do I just use the default sqlite3 built into python or does django have a different way of doing it?

Raise error for when there is no header matching the specified row name from CSV

The issue is that when user clicks upload csv and picks a file and tries to submit the file. If the header of the file is not equal to “IP Address”, then I get the debug menu from Django. The CSV file does not exist in any directory, so it is handled via upload, I was wondering what’s best practice for raising an error, I have tried some methods below but still get the debug menu.

Making modelformset_factory editing forms

I have been learning django for the last few months, and have been working on an ecommerce project to further my learning, but I’ve been absolutely stumped by an issue I’ve been having recently.