Fixtures for default user (admin)

15 views
Skip to first unread message

abisson

unread,
Apr 9, 2012, 1:34:21 AM4/9/12
to django...@googlegroups.com
Hi,

So I have the following directories:

myproject
    myproject
    accounts
        fixtures
            initial_data.yaml

Now, inside accounts, I have a class called UserProfile. In the fixtures directory, I added initial_data.yaml, but it is not working. Basically, I want to create a default admin user everything time I do syncdb, and attach a userprofile to it. I need that because one of my field can't be empty, and whenever I do the first syncdb, it always crashes (since I added the automatic profile creation to the user).

- model: auth_user
    pk: 1
    fields:
        username: admin
        first_name: App
        last_name: Administrator
        email: ad...@myapp.com
        password: passWordlol
        is_staff: 1
        is_active: 1
        is_superuser: 1
        
- model: accounts.UserProfile
    pk: 1
    fields:
        user_id: 1
        employer_number: 0


What is wrong with that?!

Thanks!
Reply all
Reply to author
Forward
0 new messages