Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: BaseOrganizationAdmin requires 'slug' and BaseOrganizationUserAdmin requires 'is_admin' method or attribute #222

Open
moojen opened this issue Sep 9, 2021 · 0 comments

Comments

@moojen
Copy link

moojen commented Sep 9, 2021

Dear all,

Your thoughts on the following is highly appreciated. I get the following error message (client = organization):

<class 'clients.admin.ClientAdmin'>: (admin.E027) The value of 'prepopulated_fields' refers to 'slug', which is not an attribute of 'clients.Client'.
<class 'clients.admin.ClientUserAdmin'>: (admin.E108) The value of 'list_display[2]' refers to 'is_admin', which is not a callable, an attribute of 'ClientUserAdmin', or an attribute or method on 'clients.ClientUser'. 

This, after adding the following code to admin.py:

@admin.register(Client)
class ClientAdmin(TenantAdminMixin, BaseOrganizationAdmin):
    list_display = ('name',)

@admin.register(ClientUser)
class ClientUserAdmin(BaseOrganizationUserAdmin):
    pass

I have the following models.py:

class Client(TenantMixin, OrganizationBase):
    created_on = models.DateField(auto_now_add=True)
    auto_create_schema = True

    def __str__(self):
        return self.name

class ClientOwner(OrganizationOwnerBase):
    pass

class ClientUser(OrganizationUserBase):
    pass

class ClientUserInvitation(OrganizationInvitationBase):
    pass

I'm a bit puzzled, since I've read the following on readthedocs (cookbook section):

The base models (provided in organizations.base) instead provide only the bare minimum fields required to implement and manage organizations: if you want a slug field or timestamps on your models, you’ll need to add those in. However you can do so however you want. And if you don’t want any of those fields, you don’t have to take them.

I can of course remove the code in admin.py, but I thought first I would call in your help ;-)
Any feedback is much appreciated!
Best, Erwin

Using Django 3.2.7 and Python 3.9.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant