Last active
September 14, 2017 10:42
-
-
Save unpluggedcoder/5fc399988cfd27ae949fc506854e68e3 to your computer and use it in GitHub Desktop.
Use corresponding serializer class for different request method in Django Rest Framework - Part 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py | |
import uuid | |
from django.db import models | |
class Organization(models.Model): | |
org_uuid = models.UUIDField( | |
primary_key=True, default=uuid.uuid4, editable=False) | |
name = models.CharField(max_length=40) | |
class User(AbstractBaseUser): | |
user_uuid = models.UUIDField( | |
primary_key=True, default=uuid.uuid4, editable=False) | |
# Omit username and all the rest of fields for simplicity. | |
org = models.ForeignKey('Organization', on_delete=models.CASCADE,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment