Questions tagged [modelform]
Questions related to the usage of a Django helper class ModelForm that let programmers create a Form class from a model.
modelform
691
questions
0
votes
1
answer
24
views
ModelForm in Django doesn't know attribute is already filled - NOT NULL constraint failed: teretana_pretplatnik.first_name
I am making a Django Gym app following this tutorial https://www.youtube.com/watch?v=Mag1n3MFDFk&list=PL2aJidc6QnyOe-fp1m4yKHjcInCRTF53N&index=3
I wanted to write a form page that the user (...
0
votes
0
answers
25
views
Django Cloudinary Form Field Display Image
I would like to change the way a Cloudinary field is displayed. By defauly, a link is supplied for the user to see the current image. I would like to display the image directly on the page. Can anyone ...
0
votes
1
answer
22
views
Passing Parent PK to ModelForm in Class Based Create and Update View
I'm updating function based views to class based views and having issues re-establishing the link between campaign and books. My Book Model has a foreign key link to Campaigns.
campaign = models....
0
votes
1
answer
39
views
Django simple ModelForm not showing on page (I'm using class based-views), what could be the problem?
I'm trying to build a form to use it as a filter for my project search page, but the {{form}} shows nothing. Here is how everything is set up:
The model I'm trying to use from models.py
class Exemplar(...
0
votes
2
answers
60
views
Initial Value in modelForm through init
It could be that I'm trying to solve this issue the wrong way. But if someone has a good idea of how to solve this I'm all ears for it.
What I want to achieve. I have a model with a Charfield, that I ...
0
votes
0
answers
25
views
DJANGO MODEL FORM INITIAL VALUE
Please I need help with setting initial value for my model form.
from django import forms
from multipage_form.forms import MultipageForm, ChildForm
import calculation
from .models import VinanPetLtd
...
0
votes
0
answers
28
views
How to create a Djano ModelForm and a view that handles a Foreign key relationship
I have a model which consists of fk's to other models.
class ParkingSpace(models.Model):
name = models.CharField(max_length=50, blank=False)
description = models.TextField(blank=False)
...
0
votes
1
answer
50
views
How to reuse Django Model Form with changed labels?
Inside a Django app I have a Person model that I want to use in a form to capture both student and teacher data. The fields are identical in both forms, but the labels should be different. How can I ...
1
vote
1
answer
298
views
Change django.forms.models.ModelChoiceIterator
The choices variable of one of my fields (django.forms.models.ModelChoiceIterator) in ModelForm contains 3 items.
In some cases, I want to use only one of them (the first one in the "list") ...
0
votes
1
answer
93
views
Add a set of 'sub-forms' (probably form set) to a ModelForm
I'm making some progress in solving this. What I want to model is this:
I have a model for materials, a model for projects, and an intermediary model to specify more data to the many-to-many ...
0
votes
1
answer
64
views
Validating a model based on the value set for a separate model
Background
I am creating an E-commerce application that allows users to submit bids on any active item listings – where Bid & Listing are distinct Django models in models.py (below).
For each new ...
2
votes
1
answer
64
views
Django ModelForm is_valid method always false
i'am getting an error using Django ModelForm.
The method form.is_valid is always false and i don't understand why.
After have put all the values in the form it doesn't enter inside the method and then ...
0
votes
1
answer
152
views
django Contact Form data not being saved
I am building a website for my brother and it needs a contact form, the HTML template had one pre built so i custom build a model form based off what was included in the template, so far it all works, ...
0
votes
1
answer
39
views
No data is sent when submitting the django form
I'm trying to create an Order object via ModelForm, but nothing comes out.
Forms.py
class OrderCreateForm(forms.ModelForm):
user = forms.ModelChoiceField(queryset=get_user_model().objects.all(), ...
0
votes
1
answer
17
views
Interaction between UpdateView, ModelForm and URL
I really don't understand what I'm doing wrong.
I am trying to create a view in which it will be possible to update information about the model object. I do this using UpdateView and ModelForm.
Here ...