mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-16 01:44:51 +03:00
Merge 8bf3418851
into e37192a081
This commit is contained in:
commit
c941f96e58
|
@ -55,7 +55,7 @@ Others
|
||||||
|
|
||||||
#. ``jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'.``: please upgrade your cookiecutter version to >= 1.4 (see `#528`_)
|
#. ``jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'now'.``: please upgrade your cookiecutter version to >= 1.4 (see `#528`_)
|
||||||
|
|
||||||
#. New apps not getting created in project root: This is the expected behavior, because cookiecutter-django does not change the way that django startapp works, you'll have to fix this manually (see `#1725`_)
|
#. To create a new app using the recommended directory structure, run `django-admin startapp --template=../startapp_template myappname` from inside the project root. This template can be customized to suit your needs. (see `startapp`_)
|
||||||
|
|
||||||
.. _#528: https://github.com/cookiecutter/cookiecutter-django/issues/528#issuecomment-212650373
|
.. _#528: https://github.com/cookiecutter/cookiecutter-django/issues/528#issuecomment-212650373
|
||||||
.. _#1725: https://github.com/cookiecutter/cookiecutter-django/issues/1725#issuecomment-407493176
|
.. _startapp: https://docs.djangoproject.com/en/dev/ref/django-admin/#startapp
|
||||||
|
|
|
@ -204,6 +204,7 @@ def remove_celery_files():
|
||||||
os.path.join(
|
os.path.join(
|
||||||
"{{ cookiecutter.project_slug }}", "users", "tests", "test_tasks.py"
|
"{{ cookiecutter.project_slug }}", "users", "tests", "test_tasks.py"
|
||||||
),
|
),
|
||||||
|
os.path.join("startapp_template", "tasks.py-tpl"),
|
||||||
]
|
]
|
||||||
for file_name in file_names:
|
for file_name in file_names:
|
||||||
os.remove(file_name)
|
os.remove(file_name)
|
||||||
|
@ -420,6 +421,9 @@ def remove_drf_starter_files():
|
||||||
"{{cookiecutter.project_slug}}", "users", "tests", "test_swagger.py"
|
"{{cookiecutter.project_slug}}", "users", "tests", "test_swagger.py"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
shutil.rmtree(os.path.join("startapp_template", "api"))
|
||||||
|
os.remove(os.path.join("startapp_template", "tests", "test_drf_urls.py-tpl"))
|
||||||
|
os.remove(os.path.join("startapp_template", "tests", "test_drf_views.py-tpl"))
|
||||||
|
|
||||||
|
|
||||||
def remove_storages_module():
|
def remove_storages_module():
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
"""Define and register {{ '{{' }} app_name {{ '}}' }} app admin models."""
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
|
@ -0,0 +1,2 @@
|
||||||
|
"""Define serializers for the {{ '{{' }} app_name {{ '}}' }} api."""
|
||||||
|
from rest_framework import serializers
|
|
@ -0,0 +1 @@
|
||||||
|
"""Define API views for {{ '{{' }} app_name {{ '}}' }} app."""
|
|
@ -0,0 +1,5 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class {{ '{{' }} camel_case_app_name {{ '}}' }}Config(AppConfig):
|
||||||
|
name = '{{ "{{" }} app_name {{ "}}" }}'
|
|
@ -0,0 +1,4 @@
|
||||||
|
"""Define {{ '{{' }} app_name {{ '}}' }} app forms."""
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
# Create your forms here.
|
|
@ -0,0 +1,4 @@
|
||||||
|
"""Define {{ '{{' }} app_name {{ '}}' }} app models."""
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
|
@ -0,0 +1,2 @@
|
||||||
|
"""Define {{ '{{' }} app_name {{ '}}' }} app Celery tasks."""
|
||||||
|
from config import celery_app
|
|
@ -0,0 +1,5 @@
|
||||||
|
"""Define factories to generate testing data."""
|
||||||
|
from typing import Any, Sequence
|
||||||
|
|
||||||
|
from factory import Faker, post_generation
|
||||||
|
from factory.django import DjangoModelFactory
|
|
@ -0,0 +1,4 @@
|
||||||
|
import pytest
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,4 @@
|
||||||
|
import pytest
|
||||||
|
from django.urls import resolve, reverse
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,4 @@
|
||||||
|
import pytest
|
||||||
|
from django.test import RequestFactory
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,7 @@
|
||||||
|
"""
|
||||||
|
Module for all {{ '{{' }} app_name {{ '}}' }} Form Tests.
|
||||||
|
"""
|
||||||
|
import pytest
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,3 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,4 @@
|
||||||
|
import pytest
|
||||||
|
from django.urls import resolve, reverse
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,11 @@
|
||||||
|
import pytest
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.auth.models import AnonymousUser
|
||||||
|
from django.contrib.messages.middleware import MessageMiddleware
|
||||||
|
from django.contrib.sessions.middleware import SessionMiddleware
|
||||||
|
from django.http import HttpRequest
|
||||||
|
from django.test import RequestFactory
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.django_db
|
|
@ -0,0 +1,4 @@
|
||||||
|
"""Define {{ '{{' }} app_name {{ '}}' }} app views."""
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
Loading…
Reference in New Issue
Block a user