Renamed app and Django template

This commit is contained in:
Jim Martens 2020-02-19 10:55:46 +01:00
parent 85d5f0b123
commit 06cd1e4291
31 changed files with 46 additions and 45 deletions

View File

@ -1,9 +1,9 @@
# Django template # Food planner
Template repository for Django applications Template repository for Django applications
## ToDos ## ToDos
- change ``app``into something more appropriate wherever you find it - change ``app``into something more appropriate wherever you find it
- change ``Django template`` and ``DjangoTemplate`` into something more appropriate wherever you find it - change ``Food planner`` and ``DjangoTemplate`` into something more appropriate wherever you find it

View File

@ -1,2 +0,0 @@
# coding=utf-8
default_app_config = 'chaos_dating.apps.ChaosDatingConfig'

View File

@ -1,7 +0,0 @@
# coding=utf-8
from django.apps import AppConfig
class DjangoTemplateConfig(AppConfig):
name = 'app'
verbose_name = 'Django template app'

2
food_planner/__init__.py Normal file
View File

@ -0,0 +1,2 @@
# coding=utf-8
default_app_config = 'food_planner.apps.FoodPlannerConfig'

View File

@ -2,11 +2,11 @@
from django.contrib.auth import views as auth_views from django.contrib.auth import views as auth_views
from django.urls import path from django.urls import path
from chaos_dating import views as chaos_views from food_planner import views as chaos_views
extra_context = { extra_context = {
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
}, },
} }

View File

@ -1,8 +1,9 @@
# coding=utf-8 # coding=utf-8
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin from django.contrib.auth.admin import UserAdmin
from app.models import Profile from django.contrib.auth.models import User
from food_planner.models import Profile
# Register your models here. # Register your models here.
admin.site.unregister(User) admin.site.unregister(User)

7
food_planner/apps.py Normal file
View File

@ -0,0 +1,7 @@
# coding=utf-8
from django.apps import AppConfig
class FoodPlannerConfig(AppConfig):
name = 'food_planner'
verbose_name = 'Food planner app'

View File

@ -7,7 +7,7 @@ from django.contrib.auth.forms import UsernameField
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.urls import reverse from django.urls import reverse
from app.models import Profile from food_planner.models import Profile
class UserForm(forms.ModelForm): class UserForm(forms.ModelForm):

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ site.title }} - {% trans "Home" %}{% endblock %} {% block title %}{{ site.title }} - {% trans "Home" %}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ site.title }}{% endblock %} {% block title %}{{ site.title }}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ site.title }} - {% trans "Legal Notice" %}{% endblock %} {% block title %}{{ site.title }} - {% trans "Legal Notice" %}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% block title %}{{ site.title }} - {% trans "Privacy Policy" %}{% endblock %} {% block title %}{{ site.title }} - {% trans "Privacy Policy" %}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "app/base.html" %} {% extends "food_planner/base.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}

View File

@ -12,20 +12,20 @@ from django.shortcuts import redirect
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse from django.urls import reverse
from app.forms import ProfileForm from food_planner.forms import ProfileForm
from app.forms import UserForm from food_planner.forms import UserForm
def index(request) -> HttpResponse: def index(request) -> HttpResponse:
context = { context = {
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
} }
} }
if request.user.is_authenticated: if request.user.is_authenticated:
return render(request, template_name='app/home.html', context=context) return render(request, template_name='food_planner/home.html', context=context)
else: else:
return render(request, template_name='app/landing.html', context=context) return render(request, template_name='food_planner/landing.html', context=context)
@transaction.atomic @transaction.atomic
@ -37,7 +37,7 @@ def register(request) -> HttpResponse:
profile_form = ProfileForm(data=request.POST or None, files=request.FILES or None) profile_form = ProfileForm(data=request.POST or None, files=request.FILES or None)
context = { context = {
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
}, },
'user_form': user_form, 'user_form': user_form,
'profile_form': profile_form 'profile_form': profile_form
@ -64,7 +64,7 @@ def user_login(request) -> HttpResponse:
'active': 'login', 'active': 'login',
'title': _('Login'), 'title': _('Login'),
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
}, },
} }
return login_view.dispatch(request) return login_view.dispatch(request)
@ -81,7 +81,7 @@ def edit_profile(request) -> HttpResponse:
'active': 'edit_profile', 'active': 'edit_profile',
'title': _('Edit User Profile'), 'title': _('Edit User Profile'),
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
}, },
'user_form': user_form, 'user_form': user_form,
'profile_form': profile_form 'profile_form': profile_form
@ -107,16 +107,16 @@ def password_change_done(request) -> HttpResponse:
def legal(request) -> HttpResponse: def legal(request) -> HttpResponse:
context = { context = {
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
} }
} }
return render(request, template_name='app/legal.html', context=context) return render(request, template_name='food_planner/legal.html', context=context)
def privacy(request) -> HttpResponse: def privacy(request) -> HttpResponse:
context = { context = {
'site': { 'site': {
'title': 'Django template' 'title': 'Food planner'
} }
} }
return render(request, template_name='app/privacy.html', context=context) return render(request, template_name='food_planner/privacy.html', context=context)

View File

@ -1,7 +1,7 @@
{ {
"name": "django-template", "name": "django-template",
"version": "1.0.0", "version": "1.0.0",
"description": "Django template", "description": "Food planner",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"bootstrap": "^4.4.1", "bootstrap": "^4.4.1",

View File

@ -35,7 +35,7 @@ ALLOWED_HOSTS = ['localhost', '127.0.0.1', '[::1]']
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'app.apps.DjangoTemplateConfig', # TODO: change to your app config class 'food_planner.apps.FoodPlannerConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',

View File

@ -17,11 +17,11 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import include from django.urls import include
from django.urls import path from django.urls import path
from app import views from food_planner import views
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('app/', include('app.urls')), path('app/', include('food_planner.urls')),
path('accounts/', include('app.account_urls')), path('accounts/', include('food_planner.account_urls')),
path('', views.index) path('', views.index)
] ]