diff --git a/bookshelf_management/bookshelf_management/__pycache__/settings.cpython-38.pyc b/bookshelf_management/bookshelf_management/__pycache__/settings.cpython-38.pyc index 6e95ba3..7629e98 100644 Binary files a/bookshelf_management/bookshelf_management/__pycache__/settings.cpython-38.pyc and b/bookshelf_management/bookshelf_management/__pycache__/settings.cpython-38.pyc differ diff --git a/bookshelf_management/bookshelf_management/apps/bookshelf_management/__pycache__/models.cpython-38.pyc b/bookshelf_management/bookshelf_management/apps/bookshelf_management/__pycache__/models.cpython-38.pyc index 969d7d4..d3e83f7 100644 Binary files a/bookshelf_management/bookshelf_management/apps/bookshelf_management/__pycache__/models.cpython-38.pyc and b/bookshelf_management/bookshelf_management/apps/bookshelf_management/__pycache__/models.cpython-38.pyc differ diff --git a/bookshelf_management/bookshelf_management/apps/bookshelf_management/models.py b/bookshelf_management/bookshelf_management/apps/bookshelf_management/models.py index 7f34f56..c0a4095 100644 --- a/bookshelf_management/bookshelf_management/apps/bookshelf_management/models.py +++ b/bookshelf_management/bookshelf_management/apps/bookshelf_management/models.py @@ -3,32 +3,19 @@ from django.db import models from django.utils import timezone as tz import sys -''' -def smart_truncate(content, length=100, suffix='...'): - if len(content) <= length: - return content - else: - return ' '.join(content[:length+1].split(' ')[0:-1]) + suffix -''' -class Author(models.Model): - name = models.CharField(max_length=255, default="", null=True, blank=True) - role = models.CharField(max_length=255, default="", null=True, blank=True) - aliases = models.CharField(max_length=255, default="", null=True, blank=True) - birth_year = models.IntegerField(null=True) - death_year = models.IntegerField(null=True) - wikipedia_url = models.URLField(max_length=500) - num_downloads = models.IntegerField(default=0) - release_date = models.IntegerField(null=True) class Bookshelf(models.Model): bookshelf_id = models.IntegerField() bookshelf_name = models.CharField(max_length=255, null=False) - release_date = models.IntegerField(null=True) num_downloads = models.IntegerField(default=0) + release_date = models.IntegerField(null=True) + class Meta: + db_table = "bookshelves" +''' class Book(models.Model): book_id = models.IntegerField() repo_name = models.CharField(max_length=255, null=True, blank=True) @@ -45,8 +32,23 @@ class Book(models.Model): updated = models.DateTimeField(auto_now_add=True, null=True) yaml = models.TextField(null=True, default="") +class Author(models.Model): + name = models.CharField(max_length=255, default="", null=True, blank=True) + role = models.CharField(max_length=255, default="", null=True, blank=True) + aliases = models.CharField(max_length=255, default="", null=True, blank=True) + birth_year = models.IntegerField(null=True) + death_year = models.IntegerField(null=True) + wikipedia_url = models.URLField(max_length=500) + num_downloads = models.IntegerField(default=0) + release_date = models.IntegerField(null=True) + + +def smart_truncate(content, length=100, suffix='...'): + if len(content) <= length: + return content + else: + return ' '.join(content[:length+1].split(' ')[0:-1]) + suffix -''' class Cover(models.Model): book = models.ForeignKey(Book, on_delete=models.CASCADE, db_index=True) file = models.FileField(upload_to="bookcovers/", null=True, blank=True) diff --git a/bookshelf_management/bookshelf_management/settings.py b/bookshelf_management/bookshelf_management/settings.py index a5c653d..2fab2de 100644 --- a/bookshelf_management/bookshelf_management/settings.py +++ b/bookshelf_management/bookshelf_management/settings.py @@ -33,7 +33,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = 'zgwvzeb!oca99v&c(=lljl)y_&^33dwoqs@%)arujer_#x(#gn' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False ALLOWED_HOSTS = [ 'localhost' @@ -81,7 +81,6 @@ TEMPLATES = [ WSGI_APPLICATION = 'bookshelf_management.wsgi.application' - # Database # https://docs.djangoproject.com/en/3.1/ref/settings/#databases @@ -96,6 +95,8 @@ DATABASES = { } } +# sys.path.insert(100, '/mnt/c/users/damon/desktop/bookshelf-management/bookshelf_management/bookshelf_management/settings.py') + # Password validation # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators diff --git a/bookshelf_management/manage.py b/bookshelf_management/manage.py index 23eff52..f9ee20f 100755 --- a/bookshelf_management/manage.py +++ b/bookshelf_management/manage.py @@ -1,12 +1,20 @@ #!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" + import os import sys - +import bookshelf_management.settings.py def main(): - """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookshelf_management.settings') + from django.core.management import execute_from_command_line + execute_from_command_line(sys.argv) + +if __name__ == '__main__': + main() + + + + + ''' try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -15,8 +23,4 @@ def main(): "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == '__main__': - main() + ''' \ No newline at end of file diff --git a/my_env/bin/activate b/my_env/bin/activate index ba08f0e..c3d6d02 100644 --- a/my_env/bin/activate +++ b/my_env/bin/activate @@ -74,3 +74,4 @@ fi if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then hash -r fi +