inline formset data not save

2021-09-11 Thread Anirban Singha
models.py class product_list(models.Model): date=models.DateTimeField(auto_now_add=True,null=True) deal=models.ForeignKey(dealForm, null=True, blank=True , on_delete =models.CASCADE) pro_name=models.ForeignKey(wareForm, null=True, on_delete=models.CASCADE) pro_quantity=models.IntegerFi

Re: Inline Formset

2020-09-20 Thread Gabriel Araya Garcia
com>) escribió: > Good day friends, Please i have a small challenge, I have an inline > formset in my admin where users can add more products to a store. The user > can also add a product if It doesn’t already exist. The problem is when the > user adds a new product and wants to add more pro

Re: Inline Formset

2020-09-19 Thread coolguy
Please share some code so we can look into. On Friday, September 18, 2020 at 12:50:49 AM UTC-4 lada...@gmail.com wrote: > Good day friends, Please i have a small challenge, I have an inline > formset in my admin where users can add more products to a store. The user > can also add a p

Inline Formset

2020-09-17 Thread Emmanuel Oppong Ntiamoah
Good day friends, Please i have a small challenge, I have an inline formset in my admin where users can add more products to a store. The user can also add a product if It doesn’t already exist. The problem is when the user adds a new product and wants to add more product fields to the Store

m2m field widget to add or update data as inline formset

2020-01-28 Thread Suraj
Hello everyone, This may be quite simple, but I am unable to find a widget which will function same as m2m widget of django, but will also create new model instance if it doesn't exists. E.g. If I had models as: class Outcome(models.Model): outcome = models.CharField(max_length=255) out

Inline formset for many to many relation

2020-01-24 Thread Suraj
Hello Everyone, I want to inline formset for m2m relationship. Related code looks as follows: models.py ``` class Outcome(models.Model): # some fields # Foreign key is created to make outcomes inline in course form course_outcome = models.ForeignKey("course.Course",

Unable to save m2m field in Inline Formset with many to many relation in django CreateView

2020-01-24 Thread Suraj
course.Course", on_delete=models.SET_NULL, blank=True, null=True) class Course(models.Model):# some fields course_outcome = models.ManyToManyField( Outcome, verbose_name=COURSE_SINGULAR + " outcome", blank=True) And inline formset is created as: OutcomeFormSet = inline

Problem with UpdateView and inline formset

2016-08-17 Thread flaudizio
Hi evebody, I'm using formset with inline and I can create the object in CreateView, but in UpdateView I get this error: Erro: ValidationError at /cadastros/pacientes/atualizar/7/ ["'' value must be integer."] django/db/models/fields/__init__.py in to_python: Variable | value self va

Django inline formset(UI) delete/remove

2015-05-11 Thread Ajay Kumar
I'm trying to do a inline formset with UI not with dajngo built in inlineformset_factory form.Here i'm done with add_view and edit_view.Here in the edit view i can update the existing record for the both parent and child model,and can add new record to the child model.But i cant

inlineformset_factory displays only inline formset, doesn't show parent model

2015-04-19 Thread Nkansah Rexford
I have this: # consider all importations done right. def add_noodle(request):NoodleFormSet = inlineformset_factory(Noodle, tutImages, form=NoodleForm, fields=('title', 'image'))if request.method == 'POST':formset = NoodleFormSet(request.POST, request.FILES) if formset.is

Re: Django Inline formset with jquery

2015-02-17 Thread aRkadeFR
e auto populate. Auto populate works for first inline formset and able to save it but when I add another inline formset auto populate is not working plus I'm unable to delete it or save it. -- You received this message because you are subscribed to the Google Groups "Django users" gr

Django Inline formset with jquery

2015-02-16 Thread Ajay Kumar
Hello all, I'm trying to build this following link feature in django, http://demo.smarttutorials.net/jquery-autocomplete/ Here by choosing serial_no and the rest of the fields name and author should be auto populate. Auto populate works for first inline formset and able to save it but

Re: CBV with inline formset

2014-12-15 Thread Brad Rice
gt;> name = models.CharField(max_length=100) >> author = models.ForeignKey(Author) >> >> So I have a page where you can insert and author. The author page takes >> you to a page to insert books for that author using an inline formset of 3 >> books. >>

Re: CBV with inline formset

2014-12-15 Thread Dan Gentry
I created a couple of mixins for a project that might help you. See this gist: https://gist.github.com/dashdrum/03858d79ddfd9bba44d6 Pretty easy to use. Here's an example Create view: class RegistrationView(FormsetCreateMixin,CreateView): template_name = 'registration/registration_form.htm

Re: CBV with inline formset

2014-12-15 Thread Vijay Khemlani
Try changing the name of the parameter in the url from author_id to pk On Mon, Dec 15, 2014 at 5:39 PM, Brad Rice wrote: > > I've pretty much butchered the code for 3 days now and cannot figure out > how to insert an inline formset. Can anybody help me? > > I've tried t

CBV with inline formset

2014-12-15 Thread Brad Rice
I've pretty much butchered the code for 3 days now and cannot figure out how to insert an inline formset. Can anybody help me? I've tried to pare everything down to use two simple Models just to try to get an insert. I'm using django Author - Book relationship to keep it simple

Re: How to edit a model with an inline formset

2014-01-10 Thread Brad Rice
I'm following that blog entry, too, and getting an error when I try to save: [u'ManagementForm data is missing or has been tampered with'] On Thursday, January 9, 2014 11:57:37 AM UTC-5, Cody Scott wrote: > > I am trying to create a model with an inline formset. I follo

Re: Inline formset with different default values for each "extra" row

2012-12-04 Thread Chris Cogdon
Because Lee Hinde's thread is broken, I'm going to take a punt at what the question is :) in a formset (inline, model, or just a plain one), the "initial" parameter to the instantiation of the form takes an list of dictionaries. Each element in the list is the initial data for _that_ row... so

Inline formset with different default values for each "extra" row

2012-12-04 Thread Lee Hinde
For a product up to three different vendors have been identified and I want to present a row per vendor (which is a fk) so that the user could select order quantities from each vendor. If a vendor doesn't have an order quantity, I'd want to ignore it at form.save() time, rather than reject it. Po

Inline formset for django project

2012-05-15 Thread William Ibarra Rodriguez
H! i need a way to use a inlineformset in my app, anyone knows how to use the inline tabular o stack formset of the admin site in an app?? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegr

inline formset error, help!!!

2012-05-07 Thread William Ibarra Rodriguez
i have a project in which i try to use the inline formset factory so when i try to fill the form it throw the following error: UnboundLocalError at /catalogo/adicionar/articulo/ local variable 'imagen_formset' referenced before assignment in my view i had: if request.POST:

Validation error by working with inline formset

2012-05-03 Thread William Ibarra Rodriguez
In my django project I've working with inline formset factory to join two forms, so when i try to edit the main form this error happens ValidationError at /catalogo/editar/articulo/3/ [u'ManagementForm data is missing or has been tampered with'] my models.py is: class Articu

Re: Problem with a clean in inline formset

2012-05-01 Thread Ernesto Guevara
return >for i in range(0, self.total_form_count()): >form = self.forms[i] >cleaned_data = form.clean() >display = cleaned_data.get('display', None) >if display.max_windows() >= display.windows: >

Problem with a clean in inline formset

2012-04-30 Thread Guevara
.ValidationError("The display have all windows occupied.") This "if" can not stop me remove a row in inline formset. How can I fix this? Regards. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Verifying number of forms in inline formset

2012-03-05 Thread Michael Stevens
Hi. I've got a django app using an inline formset. It was all working nicely, but I want to add some validation such that the inline formset must contain at least one valid record. This seems to be surprisingly hard to do. I've tried overriding clean() on the formset and looking

Re: Inline formset factory ignores 'exclude=' for foreign key field

2012-03-01 Thread gulrtosk
Right, I don't know whether this is a bug or done on purpose ... It looks like it was done on purpose so I'd be happy to hear the experts on this. I'm using Django 1.3. I hope I got this right. On line 752 of django.forms.models (development trunk), in the add_fields() method of BaseInlineFormS

Inline formset factory ignores 'exclude=' for foreign key field

2012-03-01 Thread gulrtosk
Hello list, through trial and error I discovered that it isn't required to pass the foreign key form field post data to the constructor of an inline form set. Django will fill it in automatically by looking at the primary key of the 'instance=' given. So I figured I might as well exclude the hi

Form for inline formset

2011-08-27 Thread Marcos Moyano
Can someone please tell me how can I specify a form to be used by every form inside an inline formset (if possible)? Thanks in advance! Marcos -- Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. Jamie Zawinsk

Re: How do I override default behaviour for foreign keys in an inline formset?

2011-05-29 Thread King
Though I originally asked for a "detailed solution", even some suggestions as to what I should be googling would be helpful at this point. I know I'm not the only one to have tried to do this, so I can't imagine someone doesn't have an answer somewhere. On May 26, 12:43 am, King wrote: > I want

How do I override default behaviour for foreign keys in an inline formset?

2011-05-25 Thread King
I want to do something like this... http://groups.google.com/group/django-users/browse_thread/thread/db03fa90a14ecc6a ...but unfortunately there was no reply to this particular posting. I've found other posts on the web of people looking for the same sort of solution, and have not been able to find

admin inline formset using incorrect form

2011-04-12 Thread shanyu
Hi, please take a look at the following code. def create_foo_form(baz): class FooForm(forms.ModelForm): def __init__(self, *args, **kwargs): print "Initializing a FooForm object" # Init stuff here return FooForm class FooInline(admin.TabularInline): model

Re: inline formset validation error

2011-02-13 Thread Shawn Milochik
You can iterate through the forms in your formset and call is_valid() (and optionally save()) on them based on your needs. Since your definition of "left blank" and "invalid" could vary based on what you're doing, it's better that you make those decisions explicit. If Django tried to decide for yo

inline formset validation error

2011-02-13 Thread Sarang
I have an inline formset that has max_num=3 and extra=3. The form is displayed correctly, however, is_valid() on the formset returns a False with error: [{}, {'tag': [u'This field is required.']}, {'tag': [u'This field is required.']}] The first form has

Re: Django inline formset gotcha

2010-11-07 Thread h3
decided to write a blog > listing them to save you all some time: > > http://haineault.com/blog/141/ > > TL;DR: inline formset + post_save signal = cannot access inlines' > updated data. > > Think of an invoice system were the inlines are the invoice's lines > whi

Django inline formset gotcha

2010-11-06 Thread h3
I've been banging my head on this problem for many hours and nobody came up with a working solution .. I've tried so many things to work around this problem that I've decided to write a blog listing them to save you all some time: http://haineault.com/blog/141/ TL;DR: inline form

Re: Custom Inline Formset Validation

2010-08-12 Thread kkerbel
To clarify, by "checked" I mean there is a booleanfield and I only want to let the user select 5 of those at a time across the inline formset. On Aug 12, 1:14 pm, kkerbel wrote: > I'm trying to do some custom validation for an inlineformset.  I would > like to only allow 5

Custom Inline Formset Validation

2010-08-12 Thread kkerbel
I'm trying to do some custom validation for an inlineformset. I would like to only allow 5 items checked across the forms in the inline formset. What's the best way to do this? I have tried defining a method (like a clean method for forms and formsets) but it doesn't appear to w

Re: Inline formset when pk doesn't exist

2010-07-26 Thread cerberos
I've managed to solve my problem. view item_form = ItemForm() ImageFormSet = formset_factory(ImageForm) image_formset = ImageFormSet() template (I'm using uni_form in the template but it's no different) {{ image_formset.management_form }} {{ item_form|as

Inline formset when pk doesn't exist

2010-07-26 Thread cerberos
ctually many images but that's irrelevant at this stage). I want to use an inline formset but the Item instance doesn't exist so there's no primary key, I have tried but get an error relating the the lack of primary key (...django/forms/models.py in _get_foreign_key, line 796). I'm p

Inline formset customization

2010-04-09 Thread pinco
Hi Guys, I'm try to figure out how add some customized functionalities to an inline formset. What I would implement are the two following features: - ability to delete a record by pressing a submit button assigned to each row (instead of checking the delete box and submitting the overall

custom validation for an inline formset, howto?

2010-02-24 Thread dan levine
I am trying to perform custom validation on an inline formset. The docs indicate that custom formset validation should go through a custom clean method: http://docs.djangoproject.com/en/1.1/topics/forms/formsets/#custom-formset-validation but the clean method doesn't get called for my ins

Re: Save as inline formset

2010-02-10 Thread Karen Tracey
On Wed, Feb 10, 2010 at 7:45 AM, oiad wrote: > Hi. If I have a couple of models like these: > > class Poll(models.Model): >question = models.CharField(max_length=200, unique = True) >pub_date = models.DateTimeField('date published') > > class Choice(models.Model): >poll = models.Forei

Save as inline formset

2010-02-10 Thread oiad
Hi. If I have a couple of models like these: class Poll(models.Model): question = models.CharField(max_length=200, unique = True) pub_date = models.DateTimeField('date published') class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200)

inline formset

2010-01-14 Thread Frédéric Burlet
Hi, I'm a bit stuck with inline formset. I missed something. I'm using django 1.1.1. I have a model: class Address(models.Model): street = ... number = ... ... class Person(models.Model): first_name = ... last_name = address = models.ForeignKey(Address)

Re: 'QuerySet' object has no attribute 'ordered' Error When Using Inline Formset

2009-12-08 Thread Karen Tracey
On Tue, Dec 8, 2009 at 11:13 PM, saved...@gmail.com wrote: > Every time I try to access a formset via inlineformset_factory I get > the following error messages: > > Traceback: > [snip] > File "/home/luckybs/webapps/django1/lib/python2.5/django/forms/ > models.py" in get_queryset > 495.

'QuerySet' object has no attribute 'ordered' Error When Using Inline Formset

2009-12-08 Thread saved...@gmail.com
Every time I try to access a formset via inlineformset_factory I get the following error messages: Traceback: File "/home/luckybs/webapps/django1/lib/python2.5/django/core/handlers/ base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File

filter foreign key field in inline formset

2009-12-07 Thread cerberos
One of the fields in an inline formset has a foreign key to another model, how can I filter it? I'm building a library system, the models are loans, loan items and book instances. I don't want books that are currently out on loan to be available on the loan items dropdown list. -- Yo

Inline formset question

2009-10-20 Thread Aizen
I have the following models and I'd like to use them to generate a contact form...now I know I'm suppossed to use inline formsets, but I've never been able to make heads or tails of how to make this work...I want to have the first name, last name, email, phone number, best time to contact, and the

Re: form and related inline formset on same page

2009-10-01 Thread Daniel Roseman
On Oct 1, 3:09 pm, kurak wrote: > Hello, > How can I render new form for object X and inline formset for model Y > (with foreign key to X) on the same- the same way it's done in django- > admin. > > I've been struggling with it for a while, I tried to render form and

form and related inline formset on same page

2009-10-01 Thread kurak
Hello, How can I render new form for object X and inline formset for model Y (with foreign key to X) on the same- the same way it's done in django- admin. I've been struggling with it for a while, I tried to render form and formset separately but it won't work this way. How sh

Inline Formset Validation

2009-07-02 Thread KRH
A question on forms; I had asked something similar on StackOverflow but found the solution didn't really work for me. Let's say I have an Article class and a Photo class, and I want to be able to attach Photos to Articles. I create an ArticlePhotoSet class, and make it an InlineForm in the Article

Custom validation for inline formset in Admin

2009-03-11 Thread ljholish
ustom validation on a single ModelForm, but I'm having trouble abstracting that to an inline formset. I started with trying to define my own formset in the UserProfileInline class, but I'm not clear on what method to override in order to do the v

Inline Formset Question

2009-03-10 Thread Ardesco
Hi everyone. I still consider myself to be fairly new to Django, and I was wondering if the following was possible with inline formsets in the admin: I want to create a little questionnaire app in the admin that is pre- populated with 25 questions in a specific order such that all the user has to

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-28 Thread Rodrigo C.
> Just a suggestion -- if the admin site does the sort of thing you want, then > taking a look at the admin code would probably be helpful in figuring out > how to do it. Sorry I don't know offhand without doing more digging than I > have time for what it does, exactly, but if it is showing a work

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-28 Thread Karen Tracey
On Tue, Jan 27, 2009 at 5:48 PM, Rodrigo C. wrote: > > > This isn't a Django issue. It's a standard property of browsers: you > > can't set an initial value for file input fields. This is a security > > measure, to stop malicious pages uploading files from your hard drive > > without your explici

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-28 Thread Rodrigo C.
Hi Malcolm, thanks for your reply. > So, perhaps you could give a small, reduced to the minimum, example of > how you're setting all this up. Maybe it's a problem in inline formsets, > or maybe it's an oversight in your code. At the moment, hard to tell. > I included the View and Model in my ori

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-27 Thread Malcolm Tredinnick
On Tue, 2009-01-27 at 14:48 -0800, Rodrigo C. wrote: > > This isn't a Django issue. It's a standard property of browsers: you > > can't set an initial value for file input fields. This is a security > > measure, to stop malicious pages uploading files from your hard drive > > without your explicit

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-27 Thread Rodrigo C.
> This isn't a Django issue. It's a standard property of browsers: you > can't set an initial value for file input fields. This is a security > measure, to stop malicious pages uploading files from your hard drive > without your explicit instruction. I see. If there's no way to set the initial va

Re: Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-27 Thread Daniel Roseman
On Jan 27, 9:11 pm, "Rodrigo C." wrote: > I have model that represents a file, and has a FileField, that I am > rendering via an Inline Formset. When a user fills in the form it gets > saved with no problems. > However, I want the users to be able to continue editing the

Bound Inline Formset doesn't render FileField's current value, needs to be reentered.

2009-01-27 Thread Rodrigo C.
I have model that represents a file, and has a FileField, that I am rendering via an Inline Formset. When a user fills in the form it gets saved with no problems. However, I want the users to be able to continue editing the file, but when I re-display the newly created object, the data for the

Re: disable delete checkbox in Inline formset

2008-09-08 Thread Kurczak
On 8 Wrz, 22:02, David Zhou <[EMAIL PROTECTED]> wrote: > On Sep 8, 2008, at 2:55 PM, Kurczak wrote: > > On 8 Wrz, 20:37, David Zhou <[EMAIL PROTECTED]> wrote: > >> On Sep 8, 2008, at 2:30 PM, Kurczak wrote: > > >>> Is there any way to disable/remove the delete checkbox for inline > >>> formsets

Re: disable delete checkbox in Inline formset

2008-09-08 Thread David Zhou
On Sep 8, 2008, at 2:55 PM, Kurczak wrote: > On 8 Wrz, 20:37, David Zhou <[EMAIL PROTECTED]> wrote: >> On Sep 8, 2008, at 2:30 PM, Kurczak wrote: >> >>> Is there any way to disable/remove the delete checkbox for inline >>> formsets ( in admin) ? >>> I found nothing about it in docs, and I believe

Re: disable delete checkbox in Inline formset

2008-09-08 Thread Daniel Roseman
On Sep 8, 7:55 pm, Kurczak <[EMAIL PROTECTED]> wrote: > On 8 Wrz, 20:37, David Zhou <[EMAIL PROTECTED]> wrote:> On Sep 8, 2008, at > 2:30 PM, Kurczak wrote: > > > > Is there any way to disable/remove the delete checkbox for inline > > > formsets ( in admin) ? > > > I found nothing about it in doc

Re: disable delete checkbox in Inline formset

2008-09-08 Thread Kurczak
On 8 Wrz, 20:37, David Zhou <[EMAIL PROTECTED]> wrote: > On Sep 8, 2008, at 2:30 PM, Kurczak wrote: > > > Is there any way to disable/remove the delete checkbox for inline > > formsets ( in admin) ? > > I found nothing about it in docs, and I believe there's no way to pass > > the 'can_delete' p

Re: disable delete checkbox in Inline formset

2008-09-08 Thread David Zhou
On Sep 8, 2008, at 2:30 PM, Kurczak wrote: > Is there any way to disable/remove the delete checkbox for inline > formsets ( in admin) ? > I found nothing about it in docs, and I believe there's no way to pass > the 'can_delete' parameter to inlineformset_factory. Obviously I can > disable the "Ca

disable delete checkbox in Inline formset

2008-09-08 Thread Kurczak
Hi there, Is there any way to disable/remove the delete checkbox for inline formsets ( in admin) ? I found nothing about it in docs, and I believe there's no way to pass the 'can_delete' parameter to inlineformset_factory. Obviously I can disable the "Can delete" permission, but the ugly box is st