Django inline admin

2022-08-25 Thread Shivam Kishan



I have a model called "Files" registered with the admin it has two fields 
"file" and "filename" and in the same page we are showing another model 
fields in "JobsInline".This inline have "device ", "Lang"," AI_field" it is 
Multiple Select Field. I want to create multiple inline objects based on 
the choices selected in The multipleSelectField on saving objects of files, 
behind the scene.

Let's say user selected file and filename, and then device is selected. I 
want on selecting one device and if 5 choices are selected then 5 objects 
of inline model should be created.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb308914-7e8b-4f67-81c5-a748031c8e1an%40googlegroups.com.


Re: Django inline admin max_num, extra not working

2011-10-28 Thread Jose
Hi Tom,

Thanks for your reply.

Yes I want to have just one user profile.

And yes I have tried both OneToOne field and ForeignKey with
unique=True but it makes no difference in both cases I have this
problem

Regards,

José

On Oct 28, 11:41 am, Tom Evans  wrote:
> On Fri, Oct 28, 2011 at 9:47 AM, Jose  wrote:
> > I have extended the User model as explained here and in many other
> > sites.
>
> > However, when defining the User Profile Inline in admin.py, no matter
> > what values I use for max_num or extra, in the admin site it will
> > always show one inline for the user profile I have already created and
> > another blank one (User Profile #2).
>
> > The only way it does a difference is if I use extra=-1 in which case I
> > only get the blank form.
>
> > I have searched a lot in the Internet but found no solution. I am
> > using Django 1.2.3
>
> > I appreciate your help.
>
> What do you want to happen, just to have exactly the one user profile
> inline for each user?
>
> If you define the UserProfile as having a OneToOneField instead of a
> ForeignKey, then that would happen by default.
>
> Cheers
>
> Tom

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django inline admin max_num, extra not working

2011-10-28 Thread Tom Evans
On Fri, Oct 28, 2011 at 9:47 AM, Jose  wrote:
> I have extended the User model as explained here and in many other
> sites.
>
> However, when defining the User Profile Inline in admin.py, no matter
> what values I use for max_num or extra, in the admin site it will
> always show one inline for the user profile I have already created and
> another blank one (User Profile #2).
>
> The only way it does a difference is if I use extra=-1 in which case I
> only get the blank form.
>
> I have searched a lot in the Internet but found no solution. I am
> using Django 1.2.3
>
> I appreciate your help.
>

What do you want to happen, just to have exactly the one user profile
inline for each user?

If you define the UserProfile as having a OneToOneField instead of a
ForeignKey, then that would happen by default.

Cheers

Tom

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django inline admin max_num, extra not working

2011-10-28 Thread Jose
I have extended the User model as explained here and in many other
sites.

However, when defining the User Profile Inline in admin.py, no matter
what values I use for max_num or extra, in the admin site it will
always show one inline for the user profile I have already created and
another blank one (User Profile #2).

The only way it does a difference is if I use extra=-1 in which case I
only get the blank form.

I have searched a lot in the Internet but found no solution. I am
using Django 1.2.3

I appreciate your help.

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.