Added basic documentation to all backend objects

This commit is contained in:
Mike Young
2019-12-01 12:35:40 -05:00
parent c5ad0a2bb7
commit 9dc1acf6b9
13 changed files with 159 additions and 33 deletions

34
src/interface/models.py Executable file
View File

@@ -0,0 +1,34 @@
from django.db import models
# Create your models here.
class Books(models.Model):
"""
pyShelfs Book Database class
:param title: Book title
:param author: Author
:param categories: Categories <-- Not implemented
:param cover: Cover image BinaryField
:param pages: # of pages <-- Not implemented
:param progress: Reader percentage <-- Not implented
:param file_name: Path to book
"""
class Meta:
db_table = "books"
def __str__(self):
return self.title
title = models.CharField(max_length=255)
author = models.CharField(max_length=255, null=True)
categories = models.CharField(max_length=255, null=True)
cover = models.BinaryField(null=True, editable=True)
pages = models.IntegerField(null=True)
progress = models.IntegerField(null=True)
file_name = models.CharField(max_length=255, null=False)
def get_absolute_url(self):
"""Returns the url to access a particular instance of MyModelName."""
return reverse("model-detail-view", args=[str(self.id)])