Comments (4)
Hi, @hodunov. It makes me glad that you found this library useful.
So I can better address this issue, can you let me know the python and django versions your project is using ?
from django-rest-durin.
If you see the code inside durin/models.py
, we have a custom AuthTokenManager
where the create
method is overwritten. It seems as though that the get_or_create
in your example is calling the default create
and not the overwritten create
of AuthTokenManager
.
On digging more into this, I find that this was fixed in Django v1.8a1 as mentioned in this StackOverflow thread, quoted below,
Just want to clarify that this issue was addressed in Django v1.8a1. So now both get_or_create and update_or_create will call the managers create method as expected.
from django-rest-durin.
Hi, @hodunov. It makes me glad that you found this library useful.
So I can better address this issue, can you let me know the python and django versions your project is using ?
Yes, of course, no problem. Django==3.2
with python 3.8
Absolutely right, rushed and did not describe my thoughts on this matter. I agree that the reason is exactly in models.Manager
.
And yes, I saw that get_or_create
method should work with manager, but it doesn't, check it yourself.
from django-rest-durin.
I have an interesting situation too -- AuthToken.objects.get_or_create works in most cases, but when I'm performing Django unit tests, AuthToken.objects.get_or_create within the API views I'm testing doesn't work (but they do work in the unit tests themselves, before I call the API views!).
from django-rest-durin.
Related Issues (19)
- Replace `django-memoize` with `django-cache-memoize`
- [feature] `ClientSettings` model in example_project
- add test cases for `permissions.py` by creating views
- Optimize user fetching in `TokenAuthentication` HOT 1
- Session management
- Increase code coverage
- Setup/usage with Social Auth HOT 1
- Enable ci/tests for python 3.10
- Django 4.0 ugettext_lazy removed HOT 2
- 'NoneType' object has no attribute 'renew_token' HOT 1
- AuthTokenAdmin list_filter is causing performance problems (mostly timeouts) HOT 1
- Logout view, doesn't check if user is authenticated or not HOT 1
- LogoutView needs a warning or return from previous code
- Create ClientSerializer and ClientViewSet HOT 1
- django-admin command to create a client
- Ability to store metadata/settings as part of Client <-> User relationship HOT 1
- [discussion] `TOKEN_TTL` infinite/ no expiry HOT 3
- [feature] `UserClientRateThrottle` class
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-rest-durin.