Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django muti user for 3 users

from django.contrib.auth.models import User

class Organization(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="organization")
    name = models.CharField(max_length=50, blank=True, null=True)

class Supervisor(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="supervisor")
    name = models.CharField(max_length=50, blank=True, null=True)
    organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name="supervisors")
    
class CustomUser(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="custom_user")
    name = models.CharField(max_length=50, blank=True, null=True)
    supervisor = models.ForeignKey(Supervisor, on_delete=models.CASCADE, related_name="custom_users", blank=True, null=True)
Comment

PREVIOUS NEXT
Code Example
Python :: how to unpack in python 
Python :: Boolean comparison w/out if statements 
Python :: linear plot 1D vector for x python 
Python :: mlpclassifier check weights 
Python :: sort python dictionary with values of list by index of first one 
Python :: three periods in python 
Python :: python using type and name advanced 
Python :: python list chunks using yield 
Python :: Illustrate Different Set Operations 
Python :: Using CGI with Python and HTML forms 
Python :: convert python code to dart online 
Python :: frequency domain parameter of speech 
Python :: Convert torch.nn.Embedding layer to numpy array 
Python :: is : and :: the same in python slice 
Python :: is dictreader scoped in python 
Python :: ArgumentParser(parent) 
Python :: python beacon 
Python :: matlab index last element 
Python :: dataframeclient influxdb example 
Python :: plt.plot(x, softmax(scores).T, linewidth=2) 
Python :: sqlalchemy create engine SQLite Absolute 
Python :: fight club is the best movie ever 
Python :: check it two words are anagram pyhton 
Python :: html to image pygame python 
Python :: model summary change size of columns 
Python :: how to change the title of the top bar in python 
Python :: Connection to Python debugger failed: Interrupted function call: accept failed 
Python :: rest api save file python 
Python :: flask how to initialze extension after start 
Python :: Customizing multiple plots in the same figure 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =