Skip to content
Advertisement

Tag: django-forms

django getting all objects from select

I also need the field (commentGroupDesc) from the foreign keys objects. models.py views.py Here I get the commentGroup fine but I also need commentGroupDesc to put into my form. Answer At first, it’s not a good thing to name same your model field as model name which is commentGroup kindly change field name, and run migration commands. You can simply

Saving related model objects in single view

I am beginner and I am working on Django project – risk assessment application. I have a trouble to achieve saving on related objects for my application risk record. I am using MultiModelForm to achieve the following. I am successfully creating Whatif instance and connecting it with GuideWordi instance on save, however, I am not able to connect my RiskRecordi

Django is_active field is not changing

I’m using django 4.0 when i change the is_active to False from django admin, it doesn’t make any changes to the object, I have override the save method in models. models.py admin.py Can anyone advise ? The problem started when i added the save() in models.py Answer The .save() method should always call the super method, regardless whether pk is

Django Rendering Form in HTML Issue

I’m attempting to render a form, in html and have tried the normal {{ form }}. However when I go to the site set up by: python manage.py runserver. I get the following where the form should go (highlighted section on screen-capture) webpage This is the code for the form in question. forms.py This is the html in question. I’ve

Advertisement