Key Error in form.cleaned_data

2019-08-08 Thread Mei B
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 =

Re: How to customize AdminWidget FilteredSelectMultiple?

2019-07-23 Thread Mei B
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,

How to customize AdminWidget FilteredSelectMultiple?

2019-07-22 Thread Mei B
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

Re: formset has_changed always return true.

2019-06-11 Thread Mei B
; > > 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

formset has_changed always return true.

2019-06-10 Thread Mei B
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()

Order_by ManyToMany relation?

2019-06-05 Thread Mei B
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:

Legacy DB: ID is null when .save or .create

2019-05-17 Thread Mei B
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'