Hi Tomas,
> How do I create oscar-able users from elsewhere?
In general, you should be able to create a user using the basic Django
User model. I usually create a superuser using the management command
$ ./manage.py createsuperuser
The only thing to be aware of is that Oscar uses the email address to
rather than the username on the login page. But as long as you provide
an email address for the user and use it to log in it should work.
If you use Oscar's registration page to create a user, it will generate
a random username using the 'generate_username' function defined at [1].
So if you are creating users programmatically and want to comply with
the way Oscar creates users, I'd recommend using that function and
taking a look at the registration view and the corresponding form [2].
Back to your problem, though. Can you provide some more information on
your issue? Can you log into Django's admin panel using the username and
password for your superuser? Are you using
http://localhost:8000/accounts/login?
I had a similar issue running a project locally. I was unable to log in
using the accounts/login/ page but the admin interface worked. It turned
out to be an issue with my browser session(s). I am not sure what the
exact reason was but I assume switching between a lot of projects that
all run on localhost:8000 could potentially break a session. Clearing
the cache did the trick for me.
> Our site's more than just an oscar shop,and amongst all of the systems
> I've got integrated to it, we're using django-social-auth. I'd like to
> be able to create whatever extra data oscar needs to work from
> django-social-auth, because it seems that just creating a
> django.contrib.auth.models.User object isn't enough (at least I tried
> using a user created with createsuperuser and it didn't seem to work).
I am not too versed in using django-social-auth. Francis, one of my
colleagues here in the Australian office, is currently working on
integrating it with oscar for one of our projects. He'll probably be
able to provide more information on the integration.
In general, if you need to add additional data to the user model you'd
use a Profile model as suggested in the Django docs [3]. Oscar is
picking up the Profile if it is specified in the settings similar to this:
AUTH_PROFILE_MODULE = 'accounts.Profile'
and provide extended forms to update the user *and* profile data. Take a
look at [4] to see how this works.
I hope that helps for now and if you've got any questions related
specifically to the integration with django-social-auth, I am sure
Francis will be able to help you out.
Cheers,
Seb
[1]
https://github.com/elbaschid/django-oscar/blob/0d3b300ea68f85f91da9c6f2000967e8113bcf22/oscar/apps/customer/forms.py#L26
[2]
https://github.com/elbaschid/django-oscar/blob/0d3b300ea68f85f91da9c6f2000967e8113bcf22/oscar/apps/customer/forms.py#L130
[3]
https://docs.djangoproject.com/en/1.4/topics/auth/#storing-additional-information-about-users
[4]
https://github.com/elbaschid/django-oscar/blob/0d3b300ea68f85f91da9c6f2000967e8113bcf22/oscar/apps/customer/forms.py#L234
--
Sebastian Vetter
Backend Developer
Tangent Snowball Australia
Suite 109
175 Sturt Street
Melbourne, VIC 3006
t.
+61 (0) 3 9645 8796
e.
sebastia...@tangentsnowball.com.au