I'm using a formset, and i'm trying to iterate through all the cleaned
data except I keep getting a Keyerror no matter what field I try..
for form in formset:
data = form.cleaned_data
name = data["name"]
---> KeyError: "name"
class VariableForm(forms.Form):
name =
to be working.
On Monday, July 22, 2019 at 5:21:08 PM UTC-7, Mei B wrote:
>
> I'm trying to use the admin widget FilteredSelectMultiple, I can get it to
> render on my page, but I want to customize it a bit more.
>
> I want to change the labels from available/chosen, change the size,
I'm trying to use the admin widget FilteredSelectMultiple, I can get it to
render on my page, but I want to customize it a bit more.
I want to change the labels from available/chosen, change the size, and
reorder the boxes (have chosen be on the left) How do I go about doing that?
--
You
;
>
> https://docs.djangoproject.com/en/2.2/topics/forms/
> https://docs.djangoproject.com/en/2.2/topics/forms/formsets/
>
> Missatge de Mei B > del dia dt., 11 de
> juny 2019 a les 4:33:
>
>>if request.method == "POST":
>> fo
if request.method == "POST":
formset = forms.Formset(data=request.POST, initial=initial)
if not formset.has_changed(): #has_changed always returns true!
msg = "No changes detected."
if formset.has_changed() and formset.is_valid()
I have a form for a model that contains a ManyToMany relationship to model
B.
By default, manytomany relationship on forms are SelectMuliple and orders
them by alphabetical.
How can I order by if they already have a relation?
In my forms.py
class FormA(forms.ModelForm):
class Meta:
I'm using a legacy DB with postgres. In one of my models:
class case(models.Model):
id = models.AutoField(primary_key=True)
case_id = models.ForeignKey(.)
user_id = models.ForeignKey(...)
When I'm saving or creating a new case object, I always get "null value in
column 'id'
7 matches
Mail list logo