Add state attribute to Model (#347) (#348)

Add from_db method to Model

Co-authored-by: Stevan Milic <stevan.milic@tradecore.com>
This commit is contained in:
Stevan MilicandStevan Milic authored and GitHub committed 2020-03-30 10:35:40 +03:00
1 parent 54d0d018c6
commit 1b9176f994
2 files changed
+24 -7

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
- case: state_attribute_has_a_type_of_model_state
main: |
from myapp.models import MyUser
user = MyUser(pk=1)
reveal_type(user._state) # N: Revealed type is 'django.db.models.base.ModelState'
installed_apps:
- myapp
files:
- path: myapp/__init__.py
- path: myapp/models.py
content: |
from django.db import models
class MyUser(models.Model):
pass