Created
October 23, 2017 04:28
-
-
Save clauda/ec7f5aa55d4c4b1fa0b157a6b7d67ea3 to your computer and use it in GitHub Desktop.
My Django Project Sample
This file contains hidden or 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
from django.db import models | |
from students.models impport Student | |
class Project(models.Model): | |
student = models.ForeignKey(Student) | |
name = models.CharField(max_length=200) | |
def __str__(self): | |
return self.name | |
class Notebook(models.Model): | |
project = models.ForeignKey(Project) | |
name = models.CharField(max_length=200) | |
description = models.TextField() | |
created_at = models.DateTimeField(auto_now=True) | |
def __str__(self): | |
return self.name | |
class Note(models.Model): | |
notebook = models.ForeignKey(Notebook) | |
annotation = models.TextField() | |
created_at = models.DateTimeField(auto_now=True) | |
updated_at = models.DateTimeField(null=True,blank=True) | |
def __str__(self): | |
return self.annotation | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment