Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django create groups on init, extending superuser profile

I create a site in Django and here is my Question How to make something like this:

On init (for example, when someone run "syncdb"?) I need to create a group with permissions and extend superuser profile from User to UserProfile(when user register it's not a problem but first admin/superuser is autocreated when app is created)

because, after installation you need to manually perform these operations in the admin panel.

sorry for my English, it's hard to explain to me the problem. I hope you understand.

like image 589
Kubas Avatar asked Jan 20 '23 11:01

Kubas


1 Answers

2 steps:

  1. Take a dump from an existing database containing all the required data using the command dumpdata
  2. After syncdb, load the fixture using the command loaddata
like image 109
shanyu Avatar answered Feb 01 '23 15:02

shanyu