Compare commits

..

No commits in common. "c8b3cff5a6d065c410a889d492093cad47ccb653" and "0765f6606f0224b39236ebe31b82b4502e2697d1" have entirely different histories.

97 changed files with 68 additions and 65 deletions

2
.gitignore vendored
View File

@ -69,7 +69,7 @@ coverage.xml
# exclude migrations from repository. These should be created locally, matching local DB requirements. # exclude migrations from repository. These should be created locally, matching local DB requirements.
# lostplaces/manage.py makemigrations && lostplaces/manage.py migrate # lostplaces/manage.py makemigrations && lostplaces/manage.py migrate
django_lostplaces/lostplaces/migrations/ lostplaces/lostplaces_app/migrations/
# pyenv # pyenv
.python-version .python-version

View File

@ -1,5 +1,5 @@
include LICENSE include LICENSE
include Readme.rst include Readme.rst
include Pipfile include Pipfile
recursive-include lostplaces/static * recursive-include lostplaces_app/static *
recursive-include lostplaces/templates * recursive-include lostplaces_app/templates *

View File

@ -21,8 +21,5 @@ django-widget-tweaks = "*"
django-taggit = "*" django-taggit = "*"
[scripts] [scripts]
test = "django_lostplaces/manage.py test lostplaces" test = "lostplaces/manage.py test lostplaces_app"
server = "django_lostplaces/manage.py runserver --ipv6"
dbshell = "django_lostplaces/manage.py dbshell"
showmigrations "django_lostplaces/manage.py showmigrations"

View File

@ -34,10 +34,10 @@ After having obtained the repository contents (either via .zip download or git c
$ cd lostplaces-backend $ cd lostplaces-backend
$ pipenv install $ pipenv install
$ pipenv shell $ pipenv shell
(lostplaces-backend) $ django_lostplaces/manage.py makemigrations (lostplaces-backend) $ lostplaces/manage.py makemigrations
(lostplaces-backend) $ django_lostplaces/manage.py migrate (lostplaces-backend) $ lostplaces/manage.py migrate
(lostplaces-backend) $ django_lostplaces/manage.py createsuperuser (lostplaces-backend) $ lostplaces/manage.py createsuperuser
(lostplaces-backend) $ django_lostplaces/manage.py runserver --ipv6 (lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
``` ```
## Returning to the venv ## Returning to the venv
@ -45,9 +45,9 @@ $ pipenv shell
$ cd lostplaces-backend $ cd lostplaces-backend
$ pipenv shell $ pipenv shell
(lostplaces-backend) $ pipenv update # If dependencies changed, or updates available (lostplaces-backend) $ pipenv update # If dependencies changed, or updates available
(lostplaces-backend) $ django_lostplaces/manage.py makemigrations # If datamodels changed (lostplaces-backend) $ lostplaces/manage.py makemigrations # If datamodels changed
(lostplaces-backend) $ django_lostplaces/manage.py migrate # If datamodels changed (lostplaces-backend) $ lostplaces/manage.py migrate # If datamodels changed
(lostplaces-backend) $ django_lostplaces/manage.py runserver --ipv6 (lostplaces-backend) $ lostplaces/manage.py runserver --ipv6
``` ```
Visit: [admin](http://localhost:8000/admin) for administrative backend or Visit: [admin](http://localhost:8000/admin) for administrative backend or
@ -72,12 +72,12 @@ Before making the django instance public, you should tweak the config `settings.
2. Turn off debug mode by setting `DEBUG = False`. 2. Turn off debug mode by setting `DEBUG = False`.
3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/). 3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/).
Run `django_lostplaces/managy.py collectstatic` and you should be ready to go. Run `lostplaces/managy.py collectstatic` and you should be ready to go.
## Installing lostplaces to an existing django instance ## Installing the lostplaces_app to an existing django instance
### Installing django and the django_lostplaces app ### Installing django and the lostplaces app
If you haven't already setup a django instance, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/install/). If you haven't already setup a django instance, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/install/).
@ -93,7 +93,7 @@ Now configure your `settings.py` as follows:
```python ```python
INSTALLED_APPS = [ INSTALLED_APPS = [
... ...
'django_lostplaces', 'lostplaces_app',
'easy_thumbnails', 'easy_thumbnails',
'widget_tweaks', 'widget_tweaks',
'django_taggit' 'django_taggit'
@ -110,12 +110,18 @@ MEDIA_URL = '/uploads/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
``` ```
3. Set the URL's for login, for example: 3. Set the user model (this will be changed in the next release):
```python
AUTH_USER_MODEL = 'lostplaces_app.Explorer'
```
4. Set the URL's for login, for example:
```python ```python
LOGIN_URL = reverse_lazy('login') LOGIN_URL = reverse_lazy('login')
LOGIN_REDIRECT_URL = reverse_lazy('django_lostplaces_home') LOGIN_REDIRECT_URL = reverse_lazy('lostplaces_home')
LOGOUT_REDIRECT_URL = reverse_lazy('django_lostplaces_home') LOGOUT_REDIRECT_URL = reverse_lazy('lostplaces_home')
``` ```
### Configuring the URL's ### Configuring the URL's
@ -125,7 +131,7 @@ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('signup/', SignUpView.as_view(), name='signup'), # If you want to use lostplaces' sign up view. path('signup/', SignUpView.as_view(), name='signup'), # If you want to use lostplaces' sign up view.
path('explorers/', include('django.contrib.auth.urls')), # You can change the 'explorers/' to whatever you desire. path('explorers/', include('django.contrib.auth.urls')), # You can change the 'explorers/' to whatever you desire.
path('', include('django_lostplaces.urls')), # In this configuration django_lostplaces will be at the top level of you website, change '' to 'django_lostplaces/', if you don't want this. path('', include('lostplaces_app.urls')), # In this configuration lostplaces will be at the top level of you website, change '' to 'lostplaces/', if you don't want this.
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # So django can deliver user uploaded files. ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # So django can deliver user uploaded files.
``` ```
@ -134,4 +140,4 @@ Before making the django instance public, you should tweak the config `settings.
2. Turn off debug mode by setting `DEBUG = False`. 2. Turn off debug mode by setting `DEBUG = False`.
3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/). 3. Tune the localization settings, see [django's documentation](https://docs.djangoproject.com/en/3.1/topics/i18n/).
Run `django_lostplaces/managy.py collectstatic` you should be ready to go. Run `lostplaces/managy.py collectstatic` you should be ready to go.

View File

@ -1,3 +0,0 @@
from lostplaces.views.base_views import *
from lostplaces.views.views import *
from lostplaces.views.place_views import *

View File

@ -14,6 +14,6 @@ import os
from django.core.asgi import get_asgi_application from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_lostplaces.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lostplaces.settings')
application = get_asgi_application() application = get_asgi_application()

View File

@ -38,7 +38,7 @@ ALLOWED_HOSTS = ['localhost']
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'lostplaces', 'lostplaces_app',
'easy_thumbnails', 'easy_thumbnails',
'widget_tweaks', 'widget_tweaks',
'taggit', 'taggit',
@ -60,7 +60,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
] ]
ROOT_URLCONF = 'django_lostplaces.urls' ROOT_URLCONF = 'lostplaces.urls'
TEMPLATES = [ TEMPLATES = [
{ {
@ -78,7 +78,7 @@ TEMPLATES = [
}, },
] ]
WSGI_APPLICATION = 'django_lostplaces.wsgi.application' WSGI_APPLICATION = 'lostplaces.wsgi.application'
# Database # Database

View File

@ -23,11 +23,11 @@ from django.conf.urls.static import static
from django.urls import path, include from django.urls import path, include
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from lostplaces.views import SignUpView from lostplaces_app.views import SignUpView
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('signup/', SignUpView.as_view(), name='signup'), path('signup/', SignUpView.as_view(), name='signup'),
path('explorers/', include('django.contrib.auth.urls')), path('explorers/', include('django.contrib.auth.urls')),
path('', include('lostplaces.urls')), path('', include('lostplaces_app.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -14,6 +14,6 @@ import os
from django.core.wsgi import get_wsgi_application from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_lostplaces.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lostplaces.settings')
application = get_wsgi_application() application = get_wsgi_application()

View File

@ -6,9 +6,9 @@
from django.contrib import admin from django.contrib import admin
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin from django.contrib.auth.admin import UserAdmin
from lostplaces.models import * from lostplaces_app.models import *
from lostplaces.forms import ExplorerCreationForm, ExplorerChangeForm from lostplaces_app.forms import ExplorerCreationForm, ExplorerChangeForm
# Register your models here. # Register your models here.

View File

@ -1,4 +1,4 @@
from django.apps import AppConfig from django.apps import AppConfig
class LostplacesAppConfig(AppConfig): class LostplacesAppConfig(AppConfig):
name = 'lostplaces' name = 'lostplaces_app'

View File

@ -6,7 +6,7 @@
from django import forms from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import Place, PlaceImage, Voucher from lostplaces_app.models import Place, PlaceImage, Voucher
class ExplorerCreationForm(UserCreationForm): class ExplorerCreationForm(UserCreationForm):
class Meta: class Meta:

View File

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 264 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

View File

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

View File

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 914 B

View File

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 488 B

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 209 B

View File

@ -6,7 +6,7 @@ from django.conf import settings
from django.template import Library, TemplateSyntaxError from django.template import Library, TemplateSyntaxError
#icons_json_path = getattr(settings, 'SVG_ICONS_SOURCE_FILE') #icons_json_path = getattr(settings, 'SVG_ICONS_SOURCE_FILE')
icons_json_path = os.path.join(settings.BASE_DIR, 'lostplaces', 'static', 'icons', 'icons.icomoon.json') icons_json_path = os.path.join(settings.BASE_DIR, 'lostplaces_app', 'static', 'icons', 'icons.icomoon.json')
icons_json = json.load(open(icons_json_path)) icons_json = json.load(open(icons_json_path))
register = Library() register = Library()

View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -4,12 +4,12 @@ from django.test import TestCase
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import ( from lostplaces_app.models import (
Taggable, Taggable,
Mapable, Mapable,
Submittable Submittable
) )
from lostplaces.tests.models import ModelTestCase from lostplaces_app.tests.models import ModelTestCase
from taggit.managers import TaggableManager from taggit.managers import TaggableManager

View File

@ -2,7 +2,7 @@ from django.test import TestCase
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import Explorer from lostplaces_app.models import Explorer
class ExplorerTestCase(TestCase): class ExplorerTestCase(TestCase):

View File

@ -9,8 +9,8 @@ from django.core.files import File
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import PlaceImage, Place from lostplaces_app.models import PlaceImage, Place
from lostplaces.tests.models import ModelTestCase from lostplaces_app.tests.models import ModelTestCase
from easy_thumbnails.fields import ThumbnailerImageField from easy_thumbnails.fields import ThumbnailerImageField

View File

@ -5,8 +5,8 @@ from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import Place from lostplaces_app.models import Place
from lostplaces.tests.models import ModelTestCase from lostplaces_app.tests.models import ModelTestCase
class PlaceTestCase(ModelTestCase): class PlaceTestCase(ModelTestCase):
model = Place model = Place

View File

@ -4,8 +4,8 @@ from django.test import TestCase
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from lostplaces.models import Voucher from lostplaces_app.models import Voucher
from lostplaces.tests.models import ModelTestCase from lostplaces_app.tests.models import ModelTestCase
class VoucheTestCase(ModelTestCase): class VoucheTestCase(ModelTestCase):

View File

@ -1,6 +1,6 @@
from django.test import TestCase from django.test import TestCase
from lostplaces.models import Taggable, Mapable from lostplaces_app.models import Taggable, Mapable
from taggit.models import Tag from taggit.models import Tag

View File

@ -5,9 +5,9 @@ from django.urls import reverse_lazy
from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.models import User, AnonymousUser
from django.contrib.messages.storage.fallback import FallbackStorage from django.contrib.messages.storage.fallback import FallbackStorage
from lostplaces.models import Place from lostplaces_app.models import Place
from lostplaces.views import IsAuthenticatedMixin from lostplaces_app.views import IsAuthenticatedMixin
from lostplaces.tests.views import ViewTestCase from lostplaces_app.tests.views import ViewTestCase
class TestIsAuthenticated(ViewTestCase): class TestIsAuthenticated(ViewTestCase):
view = IsAuthenticatedMixin view = IsAuthenticatedMixin

View File

@ -4,14 +4,14 @@ from django.test import TestCase, Client
from django.urls import reverse from django.urls import reverse
from django.contrib.auth.models import User from django.contrib.auth.models import User
from lostplaces.models import Place from lostplaces_app.models import Place
from lostplaces.views import ( from lostplaces_app.views import (
PlaceCreateView, PlaceCreateView,
PlaceListView, PlaceListView,
PlaceDetailView PlaceDetailView
) )
from lostplaces.forms import PlaceImageCreateForm, PlaceForm from lostplaces_app.forms import PlaceImageCreateForm, PlaceForm
from lostplaces.tests.views import ( from lostplaces_app.tests.views import (
ViewTestCase, ViewTestCase,
TaggableViewTestCaseMixin, TaggableViewTestCaseMixin,
MapableViewTestCaseMixin MapableViewTestCaseMixin

View File

@ -1,5 +1,5 @@
from django.urls import path from django.urls import path
from lostplaces.views import ( from lostplaces_app.views import (
HomeView, HomeView,
PlaceDetailView, PlaceDetailView,
PlaceListView, PlaceListView,

View File

@ -0,0 +1,3 @@
from lostplaces_app.views.base_views import *
from lostplaces_app.views.views import *
from lostplaces_app.views.place_views import *

View File

@ -9,7 +9,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse_lazy from django.urls import reverse_lazy
from lostplaces.models import Place from lostplaces_app.models import Place
class IsAuthenticatedMixin(LoginRequiredMixin, View): class IsAuthenticatedMixin(LoginRequiredMixin, View):
''' '''

View File

@ -9,9 +9,9 @@ from django.contrib.messages.views import SuccessMessageMixin
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.urls import reverse_lazy from django.urls import reverse_lazy
from lostplaces.models import Place, PlaceImage from lostplaces_app.models import Place, PlaceImage
from lostplaces.views import IsAuthenticatedMixin, IsPlaceSubmitterMixin from lostplaces_app.views import IsAuthenticatedMixin, IsPlaceSubmitterMixin
from lostplaces.forms import PlaceForm, PlaceImageCreateForm, TagSubmitForm from lostplaces_app.forms import PlaceForm, PlaceImageCreateForm, TagSubmitForm
from taggit.models import Tag from taggit.models import Tag

View File

@ -7,11 +7,11 @@ from django.urls import reverse_lazy
from django.shortcuts import render, redirect, get_object_or_404 from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from lostplaces.forms import ExplorerCreationForm, TagSubmitForm from lostplaces_app.forms import ExplorerCreationForm, TagSubmitForm
from lostplaces.models import Place, PhotoAlbum from lostplaces_app.models import Place, PhotoAlbum
from lostplaces.views.base_views import IsAuthenticatedMixin from lostplaces_app.views.base_views import IsAuthenticatedMixin
from lostplaces.views.base_views import ( from lostplaces_app.views.base_views import (
PlaceAssetCreateView, PlaceAssetCreateView,
PlaceAssetDeleteView, PlaceAssetDeleteView,
) )

View File

@ -7,7 +7,7 @@ import os
import sys import sys
def main(): def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_lostplaces.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lostplaces.settings')
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc: