├── catalog ├── __init__.py ├── tests │ ├── __init__.py │ ├── test_forms.py │ ├── test_models.py │ └── test_views.py ├── migrations │ ├── __init__.py │ ├── 0009_remove_bookinstance_summary.py │ ├── 0021_auto_20171229_1056.py │ ├── 0014_remove_bookinstance_date_acquired.py │ ├── 0020_auto_20161012_1044.py │ ├── 0024_auto_20210302_0630.py │ ├── 0004_auto_20160921_1422.py │ ├── 0013_auto_20160926_1901.py │ ├── 0018_book_language.py │ ├── 0002_auto_20160921_1401.py │ ├── 0012_bookinstance_date_acquired.py │ ├── 0010_auto_20160921_1527.py │ ├── 0022_auto_20181028_1731.py │ ├── 0023_auto_20201201_0238.py │ ├── 0017_language.py │ ├── 0006_auto_20160921_1439.py │ ├── 0019_bookinstance_borrower.py │ ├── 0007_auto_20160921_1444.py │ ├── 0015_auto_20160927_1808.py │ ├── 0003_auto_20160921_1420.py │ ├── 0027_genre_genre_name_case_insensitive_unique_and_more.py │ ├── 0026_alter_book_author_alter_genre_name_and_more.py │ ├── 0025_auto_20220222_0623.py │ ├── 0011_auto_20160922_1029.py │ ├── 0016_auto_20160927_1947.py │ ├── 0005_auto_20160921_1433.py │ ├── 0008_auto_20160921_1511.py │ └── 0001_initial.py ├── static │ ├── images │ │ └── local_library_model_uml.png │ └── css │ │ └── styles.css ├── apps.py ├── templates │ ├── catalog │ │ ├── author_form.html │ │ ├── book_form.html │ │ ├── genre_form.html │ │ ├── language_form.html │ │ ├── bookinstance_form.html │ │ ├── genre_confirm_delete.html │ │ ├── language_confirm_delete.html │ │ ├── bookinstance_confirm_delete.html │ │ ├── language_list.html │ │ ├── genre_list.html │ │ ├── book_list.html │ │ ├── book_renew_librarian.html │ │ ├── author_list.html │ │ ├── bookinstance_list_borrowed_user.html │ │ ├── book_confirm_delete.html │ │ ├── author_confirm_delete.html │ │ ├── bookinstance_list_borrowed_all.html │ │ ├── bookinstance_list.html │ │ ├── genre_detail.html │ │ ├── language_detail.html │ │ ├── author_detail.html │ │ ├── bookinstance_detail.html │ │ └── book_detail.html │ ├── index.html │ └── base_generic.html ├── forms.py ├── admin.py ├── urls.py ├── models.py └── views.py ├── locallibrary ├── __init__.py ├── wsgi.py ├── asgi.py ├── urls.py └── settings.py ├── runtime.txt ├── Procfile ├── requirements.txt ├── .github ├── dependabot.yml ├── workflows │ └── auto-merge.yml ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE └── ISSUE_TEMPLATE │ ├── config.yml │ └── bug.yml ├── templates └── registration │ ├── logged_out.html │ ├── password_reset_email.html │ ├── password_reset_complete.html │ ├── password_reset_done.html │ ├── password_reset_form.html │ ├── login.html │ └── password_reset_confirm.html ├── .editorconfig ├── CODE_OF_CONDUCT.md ├── REVIEWING.md ├── manage.py ├── SECURITY.md ├── .gitignore ├── README.md ├── CONTRIBUTING.md └── LICENSE /catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /catalog/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /locallibrary/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /runtime.txt: -------------------------------------------------------------------------------- 1 | python-3.10.2 2 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: python manage.py migrate && python manage.py collectstatic --no-input && gunicorn locallibrary.wsgi 2 | -------------------------------------------------------------------------------- /catalog/static/images/local_library_model_uml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mdn/django-locallibrary-tutorial/main/catalog/static/images/local_library_model_uml.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==5.1.15 2 | dj-database-url==2.1.0 3 | gunicorn==22.0.0 4 | psycopg2-binary==2.9.9 5 | wheel==0.38.1 6 | whitenoise==6.6.0 7 | python-dotenv==1.0.1 8 | -------------------------------------------------------------------------------- /catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: / 5 | schedule: 6 | interval: weekly 7 | commit-message: 8 | prefix: "ci(deps): " 9 | -------------------------------------------------------------------------------- /templates/registration/logged_out.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |
Logged out!
5 | 6 | Click here to login again. 7 | {% endblock %} -------------------------------------------------------------------------------- /templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | Someone asked for password reset for email {{ email }}. Follow the link below: 2 | {{ protocol}}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 3 | -------------------------------------------------------------------------------- /templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |We've emailed you instructions for setting your password. If they haven't arrived in a few minutes, check your spam folder.
6 | 7 | {% endblock %} -------------------------------------------------------------------------------- /catalog/templates/catalog/author_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /catalog/templates/catalog/book_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /catalog/templates/catalog/genre_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /catalog/templates/catalog/language_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /catalog/templates/catalog/bookinstance_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /catalog/templates/catalog/genre_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |Are you sure you want to delete the genre?
8 | 9 | 13 | 14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /templates/registration/password_reset_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | 10 | 11 | {% endblock %} -------------------------------------------------------------------------------- /catalog/templates/catalog/language_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |Are you sure you want to delete the language?
8 | 9 | 13 | 14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /catalog/templates/catalog/bookinstance_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |Are you sure you want to delete this copy of the book?
8 | 9 | 13 | 14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /catalog/templates/catalog/language_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |There are no genres available.
21 | {% endif %} 22 | 23 | 24 | {% endblock %} 25 | 26 | -------------------------------------------------------------------------------- /locallibrary/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for locallibrary project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'locallibrary.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of conduct 2 | 3 | This repository is governed by Mozilla's code of conduct and etiquette guidelines. 4 | For more details, read [Mozilla's Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). 5 | 6 | ## Reporting violations 7 | 8 | For more information on how to report violations of the Community Participation Guidelines, read the [How to report](https://www.mozilla.org/about/governance/policies/participation/reporting/) page. 9 | -------------------------------------------------------------------------------- /locallibrary/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for locallibrary project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'locallibrary.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /catalog/templates/catalog/book_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |There are no books in the library.
19 | {% endif %} 20 | {% endblock %} 21 | 22 | -------------------------------------------------------------------------------- /catalog/migrations/0009_remove_bookinstance_summary.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 05:14 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0008_auto_20160921_1511'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='bookinstance', 17 | name='summary', 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /catalog/migrations/0021_auto_20171229_1056.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0 on 2017-12-29 10:56 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('catalog', '0020_auto_20161012_1044'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='author', 15 | name='date_of_death', 16 | field=models.DateField(blank=True, null=True, verbose_name='died'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /catalog/migrations/0014_remove_bookinstance_date_acquired.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-26 09:07 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0013_auto_20160926_1901'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='bookinstance', 17 | name='date_acquired', 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /catalog/templates/catalog/book_renew_librarian.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |Borrower: {{book_instance.borrower}}
6 |Due date: {{book_instance.due_back}}
7 | 8 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /catalog/migrations/0020_auto_20161012_1044.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-10-11 23:44 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0019_bookinstance_borrower'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterModelOptions( 16 | name='bookinstance', 17 | options={'ordering': ['due_back'], 'permissions': (('can_mark_returned', 'Set book as returned'),)}, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /catalog/migrations/0024_auto_20210302_0630.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.2 on 2021-03-02 06:30 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('catalog', '0023_auto_20201201_0238'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='bookinstance', 16 | name='book', 17 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.RESTRICT, to='catalog.book'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------------------- 2 | # CODEOWNERS 3 | # ---------------------------------------------------------------------------- 4 | # Order is important. The last matching pattern takes precedence. 5 | # See: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 6 | # ---------------------------------------------------------------------------- 7 | 8 | /.github/workflows/ @mdn/engineering 9 | /.github/CODEOWNERS @mdn/engineering 10 | /SECURITY.md @mdn/engineering 11 | -------------------------------------------------------------------------------- /catalog/templates/catalog/author_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |There are no authors available.
21 | {% endif %} 22 | 23 | 24 | 25 | {% endblock %} 26 | 27 | -------------------------------------------------------------------------------- /catalog/migrations/0004_auto_20160921_1422.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 04:22 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0003_auto_20160921_1420'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='book', 17 | name='summary', 18 | field=models.TextField(help_text='Enter a brief description of the book', max_length=1000), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /catalog/migrations/0013_auto_20160926_1901.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-26 09:01 3 | from __future__ import unicode_literals 4 | 5 | import datetime 6 | from django.db import migrations, models 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('catalog', '0012_bookinstance_date_acquired'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='bookinstance', 18 | name='date_acquired', 19 | field=models.DateField(default=datetime.date.today), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /catalog/templates/catalog/bookinstance_list_borrowed_user.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |There are no books borrowed.
18 | {% endif %} 19 | {% endblock %} 20 | 21 | -------------------------------------------------------------------------------- /REVIEWING.md: -------------------------------------------------------------------------------- 1 | # Reviewing guide 2 | 3 | All reviewers must abide by the [code of conduct](CODE_OF_CONDUCT.md); they are also protected by the code of conduct. 4 | A reviewer should not tolerate poor behavior and is encouraged to [report any behavior](CODE_OF_CONDUCT.md#Reporting_violations) that violates the code of conduct. 5 | 6 | ## Review process 7 | 8 | The MDN Web Docs team has a well-defined review process that must be followed by reviewers in all repositories under the GitHub MDN organization. 9 | This process is described in detail on the [Pull request guidelines](https://developer.mozilla.org/en-US/docs/MDN/Community/Pull_requests) page. 10 | -------------------------------------------------------------------------------- /catalog/migrations/0018_book_language.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-10-05 10:23 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('catalog', '0017_language'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='book', 18 | name='language', 19 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='catalog.Language'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /catalog/migrations/0002_auto_20160921_1401.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 04:01 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('catalog', '0001_initial'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='book', 18 | name='author', 19 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='catalog.Author'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /catalog/migrations/0012_bookinstance_date_acquired.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-26 08:27 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.utils.timezone 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('catalog', '0011_auto_20160922_1029'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AddField( 17 | model_name='bookinstance', 18 | name='date_acquired', 19 | field=models.DateField(auto_now_add=True, default=django.utils.timezone.now), 20 | preserve_default=False, 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /catalog/templates/catalog/book_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |You can't delete this book until all copies have been deleted:
9 | 10 |Are you sure you want to delete the book: {{ book }}?
18 | 19 | 23 | {% endif %} 24 | 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /catalog/migrations/0010_auto_20160921_1527.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 05:27 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('catalog', '0009_remove_bookinstance_summary'), 13 | ] 14 | 15 | operations = [ 16 | migrations.AlterField( 17 | model_name='bookinstance', 18 | name='book', 19 | field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='Fishcakes instance+', to='catalog.Book'), 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /catalog/templates/catalog/author_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |You can't delete this author until all their books have been deleted:
10 |Are you sure you want to delete the author?
18 | 19 | 23 | {% endif %} 24 | 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /catalog/migrations/0022_auto_20181028_1731.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.2 on 2018-10-28 06:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('catalog', '0021_auto_20171229_1056'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='author', 15 | options={'ordering': ['last_name', 'first_name']}, 16 | ), 17 | migrations.AlterField( 18 | model_name='language', 19 | name='name', 20 | field=models.CharField(help_text="Enter the book's natural language (e.g. English, French, Japanese etc.)", max_length=200), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Description 4 | 5 | 6 | 7 | ### Motivation 8 | 9 | 10 | 11 | ### Additional details 12 | 13 | 14 | 15 | ### Related issues and pull requests 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'locallibrary.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /catalog/migrations/0023_auto_20201201_0238.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.2 on 2020-12-01 02:38 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('catalog', '0022_auto_20181028_1731'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='book', 15 | options={'ordering': ['title', 'author']}, 16 | ), 17 | migrations.AlterField( 18 | model_name='book', 19 | name='isbn', 20 | field=models.CharField(help_text='13 Character ISBN number', max_length=13, unique=True, verbose_name='ISBN'), 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /catalog/migrations/0017_language.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-10-05 10:12 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0016_auto_20160927_1947'), 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Language', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('name', models.CharField(help_text="Enter a the book's natural language (e.g. English, French, Japanese etc.)", max_length=200)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /catalog/migrations/0006_auto_20160921_1439.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 04:39 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0005_auto_20160921_1433'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='author', 17 | name='date_of_birth', 18 | field=models.DateField(null=True, verbose_name='D.O.B'), 19 | ), 20 | migrations.AddField( 21 | model_name='author', 22 | name='date_of_death', 23 | field=models.DateField(null=True, verbose_name='Died'), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /catalog/migrations/0019_bookinstance_borrower.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-10-11 09:40 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('catalog', '0018_book_language'), 15 | ] 16 | 17 | operations = [ 18 | migrations.AddField( 19 | model_name='bookinstance', 20 | name='borrower', 21 | field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /catalog/templates/catalog/bookinstance_list_borrowed_all.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |There are no books borrowed.
18 | {% endif %} 19 | {% endblock %} 20 | -------------------------------------------------------------------------------- /catalog/migrations/0007_auto_20160921_1444.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 04:44 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0006_auto_20160921_1439'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='author', 17 | name='date_of_birth', 18 | field=models.DateField(blank=True, null=True, verbose_name='D.O.B'), 19 | ), 20 | migrations.AlterField( 21 | model_name='author', 22 | name='date_of_death', 23 | field=models.DateField(blank=True, null=True, verbose_name='Died'), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /catalog/migrations/0015_auto_20160927_1808.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-27 08:08 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0014_remove_bookinstance_date_acquired'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RemoveField( 16 | model_name='subject', 17 | name='subject_name', 18 | ), 19 | migrations.AddField( 20 | model_name='subject', 21 | name='name', 22 | field=models.CharField(default='Fantasy', help_text='Enter a book category - e.g. Science Fiction, French Poetry etc.', max_length=200), 23 | preserve_default=False, 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /catalog/migrations/0003_auto_20160921_1420.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10 on 2016-09-21 04:20 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('catalog', '0002_auto_20160921_1401'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='book', 17 | name='summary', 18 | field=models.TextField(help_text='Enter a brief description of the book', max_length=200), 19 | ), 20 | migrations.AlterField( 21 | model_name='subject', 22 | name='subject_name', 23 | field=models.CharField(help_text='Enter a book category - e.g. Science Fiction, Non Fiction etc.', max_length=200), 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Content or feature request 4 | url: https://github.com/mdn/mdn/issues/new/choose 5 | about: Propose new content for MDN Web Docs or submit a feature request using this link. 6 | - name: MDN GitHub Discussions 7 | url: https://github.com/orgs/mdn/discussions 8 | about: Does the issue involve a lot of changes, or is it hard to split it into actionable tasks? Start a discussion before opening an issue. 9 | - name: MDN Web Docs on Discourse 10 | url: https://discourse.mozilla.org/c/mdn/learn/250 11 | about: Need help with assessments on MDN Web Docs? We have a support community for this purpose on Discourse. 12 | - name: Help with code 13 | url: https://stackoverflow.com/ 14 | about: If you are stuck and need help with code, StackOverflow is a great resource. 15 | -------------------------------------------------------------------------------- /catalog/templates/catalog/bookinstance_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 |Your username and password didn't match. Please try again.
7 | {% endif %} 8 | 9 | {% if next %} 10 | {% if user.is_authenticated %} 11 |Your account doesn't have access to this page. To proceed, 12 | please login with an account that has access.
13 | {% else %} 14 |Please login to see this page.
15 | {% endif %} 16 | {% endif %} 17 | 18 | 34 | 35 | {# Assumes you setup the password_reset view in your URLconf #} 36 | 37 | 38 | {% endblock %} -------------------------------------------------------------------------------- /catalog/templates/catalog/language_detail.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 |{{author.date_of_birth}} - {% if author.date_of_death %}{{author.date_of_death}}{% endif %}
7 | 8 |This author has no books.
17 | {% endfor %} 18 |Author: {{ bookinstance.book.author }}
8 | 9 |Imprint: {{ bookinstance.imprint }}
10 |Status: {{ bookinstance.get_status_display }} {% if bookinstance.status != 'a' %} (Due: {{bookinstance.due_back}}){% endif %}
11 | 12 |Welcome to LocalLibrary, a very basic Django website developed as a tutorial example on the Mozilla Developer Network.
7 |The tutorial demonstrates how to create a Django skeleton website and application, define URL mappings, views (including Generic List and Detail Views), models and templates.
8 | 9 | 10 |An UML diagram of the site's Django model structure is shown below.
12 | 13 |
16 | The library has the following record counts:
22 |You have visited this page {{ num_visits }} time{{ num_visits|pluralize }}.
31 | 32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /templates/registration/password_reset_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "base_generic.html" %} 2 | 3 | {% block content %} 4 | 5 | {% if validlink %} 6 |Please enter (and confirm) your new password.
7 | 28 | {% else %} 29 |The password reset link was invalid, possibly because it has already been used. Please request a new password reset.
31 | {% endif %} 32 | 33 | {% endblock %} -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Overview 4 | 5 | This policy applies to MDN's website (`developer.mozilla.org`), backend services, and GitHub repositories in the [`mdn`](https://github.com/mdn) organization. Issues affecting other Mozilla products or services should be reported through the [Mozilla Security Bug Bounty Program](https://www.mozilla.org/en-US/security/bug-bounty/). 6 | 7 | For non-security issues, please file a [content bug](https://github.com/mdn/content/issues/new/choose), a [website bug](https://github.com/mdn/fred/issues/new/choose) or a [content/feature suggestion](https://github.com/mdn/mdn/issues/new/choose). 8 | 9 | ## Reporting a Vulnerability 10 | 11 | If you discover a potential security issue, please report it privately viaAuthor: {{ book.author }}
8 |Summary: {{ book.summary }}
9 |ISBN: {{ book.isbn }}
10 |Language: {{ book.language }}
11 |Genre: {{ book.genre.all|join:", " }}
12 | 13 |{{ copy.get_status_display }}
19 | {% if copy.status != 'a' %}Due to be returned: {{copy.due_back}}
{% endif %} 20 |Imprint: {{copy.imprint}}
21 |Id: {{copy.id}}
22 | {% empty %} 23 |The library has no copies of this book.
24 | {% endfor %} 25 |