On Saturday 28 January 2017 18:21:34 Mike08 wrote: > now my question is in the admin when the user attempts to create a new > modelStudent for the field "user" all available users are shown in > the drop down. My question is if there is a way for me to > limit/restrict that drop down to a certain value or (set that drop > down value to something and then have the drop down disabled) ? I > only want people creating > modelStudentAdmin under their respective user field.
Set a custom form[1], exclude the User field and in the clean method of that form, set the user to request.user. -- Melvyn Sopacua -------- [1] https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#adding-custom-validation-to-the-admin -- 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/2496811.oorRhEe7TU%40devstation. For more options, visit https://groups.google.com/d/optout.