In my application, I have models that have the Users model as a Foreign key, eg:
class Doctor(models.Model):
username=models.ForeignKey(User, unique=True)
...
In the admin site, when adding a new Doctor, I have the option of adding a new User next to the username field. This is exactly what I want, but in the dialog that opens, it asks for a username and password for the new user; I would also like to be able to assign a group to this new user. What would be the best way of doing this ?
Thanks,
lokharkey
In your application, create an ‘admin.py’, where you actually register your own model to admin, add following code.
Now you just need to override the template that render this overridden form.
Create a directory structure as,
and copy the content as,
And you are good to go. Its working snippet.