jrief/django-shop

Unregistering the user model

Closed this issue · 6 comments

/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

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.

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

yes, segmentation.py does this

Ah, ok :)

jrief commented

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.

This issue was moved to awesto#317