On 7/19/07, Stefan Matthias Aust <[EMAIL PROTECTED]> wrote:
> 1) It is important for me to recreate my environment from scratch
> (that is, from the VCS). I'd like to have a working application after
> calling "syncdb". For my own application, I've create an initial_data
> fixture. But I'd like to recreate users and permissions, too.

If you don't mind calling manage.py loaddata a few more times, yes.

The parameter there is the name of the fixture, *not* the name of an app.
http://www.djangoproject.com/documentation/django-admin/#loaddata-fixture-fixture
Fixtures in other dirs:
http://www.djangoproject.com/documentation/settings/#fixture-dirs

...
> it seems that
> "syncdb" always asks for an admin account on the console. Can I
> somehow suppress that question? Instead, I'd like to load some saved
> fixture.

--noinput
http://www.djangoproject.com/documentation/django-admin/#noinput

> What's the recommended way to access models from outside of views?
>

What you have is pretty good, but do this, too, in order to make sure
all models are loaded (so that descriptors for relationships are
contributed to reverse models:

from django.db.models import get_models
get_models()


> 3) I need to create an object with a unique random id -

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/163604

> "is enforced at the database level" but it unfortunately
> does not describe what happens if the constraint is violated. Will
> this always raise an IntegrityError?

Yes.  It just doesn't let you insert dupes; there is no id-generation
fallback (unless it's an autofield).

... Leaving #4 unanswered; your understanding seems correct.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to