Compare commits

..

No commits in common. "60292808083c3ef2ea2c5929d95f6477efb618a9" and "383ac64ee110297c2043f6121cd37cb584745f5a" have entirely different histories.

14 changed files with 10 additions and 48 deletions

View File

@ -1,2 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

View File

@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
ASGI config for lostplaces project.

View File

@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Django settings for lostplaces project.

View File

@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""lostplaces URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
@ -16,7 +13,6 @@ 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.conf import settings
from django.conf.urls.static import static

View File

@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
WSGI config for lostplaces project.

View File

@ -1,2 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

View File

@ -1,8 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Classes and modules for the administrative backend. '''
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin
@ -21,4 +16,4 @@ class ExplorerAdmin(UserAdmin):
admin.site.register(Explorer, ExplorerAdmin)
admin.site.register(Place)
admin.site.register(PlaceImage)
admin.site.register(PlaceImage)

View File

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

View File

@ -1,8 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' (web)forms that can be used elsewhere. '''
from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import Explorer, Place, PlaceImage

View File

@ -1,8 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' (Data)models which describe the structure of data to be saved into database. '''
import os
import uuid
@ -42,6 +37,7 @@ class Place (models.Model):
def __str__(self):
return self.name
def generate_image_upload_path(instance, filename):
"""
Callback for generating path for uploaded images
@ -82,6 +78,8 @@ class PlaceImage (models.Model):
"""
return ' '.join([self.place.name, str(self.pk)])
# These two auto-delete files from filesystem when they are unneeded:
@receiver(models.signals.post_delete, sender=PlaceImage)

View File

@ -1,8 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Tests for the lostplaces_app. '''
rom django.test import TestCase
from django.test import TestCase
# Create your tests here.

View File

@ -15,4 +15,4 @@ urlpatterns = [
path('place/create/', PlaceCreateView.as_view(), name='place_create'),
path('place/update/<int:pk>/', PlaceUpdateView.as_view(), name='place_edit'),
path('place/', place_list_view, name='place_list')
]
]

View File

@ -1,8 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Django views. '''
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView
@ -10,6 +5,7 @@ from django.views import View
from django.http import Http404
from django.views.generic.edit import UpdateView
from .forms import ExplorerCreationForm, PlaceForm, PlaceImageCreateForm
from .models import Place, PlaceImage

View File

@ -1,11 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lostplaces.settings')
try:
@ -18,5 +16,6 @@ def main():
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()