1
0
mirror of https://github.com/Damillora/Altessimo synced 2024-11-21 05:27:32 +00:00

Initial commit

This commit is contained in:
Damillora 2020-12-16 04:32:20 +07:00
parent 410838e845
commit d5293b379f
47 changed files with 580 additions and 0 deletions

0
altessimo/__init__.py Normal file
View File

16
altessimo/asgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
ASGI config for altessimo project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'altessimo.settings')
application = get_asgi_application()

128
altessimo/settings.py Normal file
View File

@ -0,0 +1,128 @@
"""
Django settings for altessimo project.
Generated by 'django-admin startproject' using Django 3.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '87jexgw!_@w#19b-!_!j_6&0r@v(=c+n783&pt-(un*n4n+@=4'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'categories',
'artists',
'songs',
'home',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'altessimo.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ BASE_DIR / "templates"],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'altessimo.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]

25
altessimo/urls.py Normal file
View File

@ -0,0 +1,25 @@
"""altessimo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('', include('home.urls')),
path('categories/', include('categories.urls')),
path('artists/', include('artists.urls')),
path('songs/', include('songs.urls')),
path('admin/', admin.site.urls),
]

16
altessimo/wsgi.py Normal file
View File

@ -0,0 +1,16 @@
"""
WSGI config for altessimo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'altessimo.settings')
application = get_wsgi_application()

0
artists/__init__.py Normal file
View File

5
artists/admin.py Normal file
View File

@ -0,0 +1,5 @@
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Artist)

5
artists/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ArtistsConfig(AppConfig):
name = 'artists'

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1.4 on 2020-12-15 20:42
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Artist',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('romanized_name', models.CharField(max_length=255)),
('aliases', models.ManyToManyField(blank=True, related_name='_artist_aliases_+', to='artists.Artist')),
],
),
]

View File

@ -0,0 +1,19 @@
# Generated by Django 3.1.4 on 2020-12-15 20:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('categories', '0002_auto_20201215_2054'),
('artists', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='artist',
name='category',
field=models.ManyToManyField(blank=True, to='categories.Category'),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1.4 on 2020-12-15 21:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('artists', '0002_artist_category'),
]
operations = [
migrations.AddField(
model_name='artist',
name='about_composer',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='artist',
name='about_music',
field=models.TextField(blank=True),
),
]

View File

15
artists/models.py Normal file
View File

@ -0,0 +1,15 @@
from django.db import models
from django.apps import apps
# Create your models here.
class Artist(models.Model):
name = models.CharField(max_length=255)
romanized_name = models.CharField(max_length=255)
aliases = models.ManyToManyField("self",blank=True)
category = models.ManyToManyField("categories.Category",blank=True)
about_composer = models.TextField(blank=True)
about_music = models.TextField(blank=True)
def __str__(self):
return self.romanized_name

3
artists/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
artists/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from . import views
urlpatterns = [
]

3
artists/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

0
categories/__init__.py Normal file
View File

6
categories/admin.py Normal file
View File

@ -0,0 +1,6 @@
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Category)

5
categories/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class CategoriesConfig(AppConfig):
name = 'categories'

View File

@ -0,0 +1,22 @@
# Generated by Django 3.1.4 on 2020-12-15 20:49
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.CharField(max_length=255)),
],
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.4 on 2020-12-15 20:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('categories', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='category',
name='description',
field=models.TextField(),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.4 on 2020-12-15 21:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('categories', '0002_auto_20201215_2054'),
]
operations = [
migrations.AlterField(
model_name='category',
name='description',
field=models.TextField(blank=True),
),
]

View File

14
categories/models.py Normal file
View File

@ -0,0 +1,14 @@
from django.db import models
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
class Meta:
verbose_name_plural = "Categories"
def __str__(self):
return self.name

3
categories/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
categories/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from . import views
urlpatterns = [
]

6
categories/views.py Normal file
View File

@ -0,0 +1,6 @@
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse("Yuika!")

0
home/__init__.py Normal file
View File

3
home/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
home/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class HomeConfig(AppConfig):
name = 'home'

View File

3
home/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View File

@ -0,0 +1,5 @@
{% extends 'layouts/base.html' %}
{% block content %}
<h1>Work in progress!</h1>
{% endblock %}

3
home/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

8
home/urls.py Normal file
View File

@ -0,0 +1,8 @@
from django.urls import path
from . import views
urlpatterns = [
path('',views.index),
path('home',views.index),
]

5
home/views.py Normal file
View File

@ -0,0 +1,5 @@
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request,"index.html")

22
manage.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'altessimo.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"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()

0
songs/__init__.py Normal file
View File

5
songs/admin.py Normal file
View File

@ -0,0 +1,5 @@
from django.contrib import admin
from . import models
# Register your models here.
admin.site.register(models.Song)

5
songs/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class SongsConfig(AppConfig):
name = 'songs'

View File

@ -0,0 +1,39 @@
# Generated by Django 3.1.4 on 2020-12-15 21:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('artists', '0003_auto_20201215_2107'),
]
operations = [
migrations.CreateModel(
name='Song',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('romanized_title', models.CharField(max_length=255)),
('impression', models.TextField(blank=True)),
('arranger', models.ManyToManyField(blank=True, related_name='arranged_songs', to='artists.Artist')),
('composer', models.ManyToManyField(blank=True, related_name='composed_songs', to='artists.Artist')),
('lyricist', models.ManyToManyField(blank=True, related_name='written_songs', to='artists.Artist')),
],
),
migrations.CreateModel(
name='OutsideSong',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('romanized_title', models.CharField(max_length=255)),
('origin', models.CharField(max_length=255)),
('url', models.URLField(max_length=255)),
('composer', models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='artists.artist')),
],
),
]

View File

17
songs/models.py Normal file
View File

@ -0,0 +1,17 @@
from django.db import models
# Create your models here.
class Song(models.Model):
title = models.CharField(max_length=255)
romanized_title = models.CharField(max_length=255)
lyricist = models.ManyToManyField("artists.Artist", blank=True, related_name="written_songs")
composer = models.ManyToManyField("artists.Artist", blank=True, related_name="composed_songs")
arranger = models.ManyToManyField("artists.Artist", blank=True, related_name="arranged_songs")
impression = models.TextField(blank=True)
class OutsideSong(models.Model):
title = models.CharField(max_length=255)
romanized_title = models.CharField(max_length=255)
origin = models.CharField(max_length=255)
url = models.URLField(max_length=255)
composer = models.ForeignKey("artists.Artist", blank=True, on_delete=models.CASCADE)

3
songs/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
songs/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from . import views
urlpatterns = [
]

3
songs/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Altessimo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">Altessimo</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<!-- <li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li> -->
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-secondary my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<main role="main" class="container my-4">
{% block content %}
{% endblock %}
</main>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>
</html>