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 Milic
2020-03-30 09:35:40 +02:00
committed by GitHub
parent 54d0d018c6
commit 1b9176f994
2 changed files with 24 additions and 7 deletions

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