jrief / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
32 stars 12 forks source link

Unregistering the user model #45

Closed rfleschenberg closed 8 years ago

rfleschenberg commented 8 years ago

/shop/admin/customer.py:

try:
    admin.site.unregister(get_user_model())
except admin.sites.NotRegistered:
    pass

Is this a good idea? I was wondering why my admin registration for the user model was not working :)

I think that people will often want to manage users (not only shop customers, but also admins and content editors) from the django admin.

To avoid this problem, one can include the custom app/project after django-shop in INSTALLED_APPS. Maybe we should explicitly document this?

On the other hand, I am not sure if this unregistering is really necessary. The user can still unregister the model if they want to.

jrief commented 8 years ago

This shouldn't be an issue, because shop.admin.customer is not included by the framework, but must be included by the project.

Wait – Something changed!

shop/cascade/segmentation.py imports that file. I must have a look how to fix that to be configurable.

rfleschenberg commented 8 years ago

I think Django imports shop.admin.customer somewhere. In my project, that code is run without me importing it explicitly anywhere. I will investigate further.

jrief commented 8 years ago

yes, segmentation.py does this

rfleschenberg commented 8 years ago

Ah, ok :)

jrief commented 8 years ago

This is missing documentation, lets explain briefly:

you presumably have

CMSPLUGIN_CASCADE = {
   ...
    'segmentation_mixins': (
        ('shop.cascade.segmentation.EmulateCustomerModelMixin', 'shop.cascade.segmentation.EmulateCustomerAdminMixin'),
    ),
   ...
)

this means, that User Emulation for segmentation uses our Customer. If you are using another User models, than just remove this line or adopt those two mixin classes to your own need.

rfleschenberg commented 8 years ago

This issue was moved to awesto/django-shop#317