This is my first post and contribution. I hope I do it correctly.

I dont know if it is a bug or a needed feature but here is the problem.

I use autocomplete_fields on a field in an admin.TabularInline, the field 
concerned is mandatory.

When you choose a value with the autocomplete you cannot put back a blank 
value. 
This behavior is normal in standard admin view because the field is 
mandatory (null=False and blank=False). 
But in the case of validating a new row in a Inline admin form you are 
stuck. (see attached image)


They are two workaroud:

First refresh the page but you loose all the other modifications.

The second put blank=True on the ForeignKey, this allow to put the field 
blank by showingup a cross next to the field. But now you can put blank on 
existing value and in standard admin view, then you will potentialy get 
the RelatedObjectDoesNotExist exception. 

I see three solutions
Copy the behavior of the standard select: even if blank=False, you can put 
a blank value on inline fields.
Allow blank value only for new row when blank=False
Or (dirty) showing up the delete checkbox for new row. If a new form in a 
formset as the Delete value true, just ignore it.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5d6a3808-70ba-445d-9216-b264737eced3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to