Django-rest-framework: Django Admin and authtoken.Token model

Created on 16 Sep 2016  路  6Comments  路  Source: encode/django-rest-framework

I'm running into the issue that you are not able to change the Django Admin behavior for the Token model without being a bit hacky. I'm wondering about removing rest_framework/authtoken/admin.py file and letting the developer to enable it in Django Admin if required.

Just for the record, I tried opening the edit form for a Token object, and it is really slow due the large amount of users we have on production, adding the user field to raw_id_fields solves the problem. That took me to open this issue and making it more flexible and easy to integrate.

Thanks @tomchristie for the hard work! IMO this is the best REST Library for Django at this time.

Needs design decision

Most helpful comment

I'm +1 on always using raw_id_fields. Always seems to be best option when you're not building toy apps.

All 6 comments

Hi, the general idea behind the default token app is that it's a very basic one. It'll likely remain simple enough.
I'm leaving this opened as I don't have an opinion about adding user to raw_id_fields.

@xordoquy, I think that we could make it simpler by removing the admin.py code.

About raw_id_fields, a request currently takes about 6 seconds:

Cheers,

I'm +1 on always using raw_id_fields. Always seems to be best option when you're not building toy apps.

Another feature that would be nice to add is the search by key or usernames.

Still waiting here.

@andres-torres-marroquin You could probably help move things forward more quickly by issuing a pull request for consideration.

Was this page helpful?
0 / 5 - 0 ratings