diff --git a/.gitignore b/.gitignore index a788c93..5ca638d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__ migrations .coverage coverage_html_report/ +.vscode/* diff --git a/src/gwift/__init__.py b/gwift/__init__.py similarity index 100% rename from src/gwift/__init__.py rename to gwift/__init__.py diff --git a/src/gwift/settings/__init__.py b/gwift/settings/__init__.py similarity index 100% rename from src/gwift/settings/__init__.py rename to gwift/settings/__init__.py diff --git a/src/gwift/settings/base.py b/gwift/settings/base.py similarity index 98% rename from src/gwift/settings/base.py rename to gwift/settings/base.py index 739c213..9480fd0 100644 --- a/src/gwift/settings/base.py +++ b/gwift/settings/base.py @@ -31,10 +31,10 @@ INSTALLED_APPS = ( 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'wish', + 'gwift.wish', ) -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', diff --git a/src/gwift/settings/dev.py b/gwift/settings/dev.py similarity index 100% rename from src/gwift/settings/dev.py rename to gwift/settings/dev.py diff --git a/src/gwift/settings/production.py b/gwift/settings/production.py similarity index 100% rename from src/gwift/settings/production.py rename to gwift/settings/production.py diff --git a/src/gwift/urls.py b/gwift/urls.py similarity index 81% rename from src/gwift/urls.py rename to gwift/urls.py index 064450b..df6de58 100644 --- a/src/gwift/urls.py +++ b/gwift/urls.py @@ -15,12 +15,12 @@ Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ -from django.conf.urls import include, url +from django.conf.urls import include +from django.urls import path from django.contrib import admin -import wish urlpatterns = [ - url(r'^admin/', include(admin.site.urls)), - url(r'^', include('wish.urls', namespace='wish')), + path(r'^admin/', admin.site.urls), + path(r'^', include('gwift.wish.urls')) ] diff --git a/src/wish/__init__.py b/gwift/wish/__init__.py similarity index 100% rename from src/wish/__init__.py rename to gwift/wish/__init__.py diff --git a/src/wish/admin.py b/gwift/wish/admin.py similarity index 100% rename from src/wish/admin.py rename to gwift/wish/admin.py diff --git a/src/wish/models.py b/gwift/wish/models.py similarity index 80% rename from src/wish/models.py rename to gwift/wish/models.py index f75148a..6f141fc 100644 --- a/src/wish/models.py +++ b/gwift/wish/models.py @@ -1,8 +1,7 @@ +import uuid + from django.db import models from django.contrib.auth.models import User -from django.core.urlresolvers import reverse - -import uuid class AbstractModel(models.Model): @@ -28,7 +27,11 @@ class Wishlist(AbstractModel): class Wish(AbstractModel): - wishlist = models.ForeignKey(Wishlist, related_name='items') + wishlist = models.ForeignKey( + Wishlist, + related_name='items', + on_delete=models.DO_NOTHING + ) name = models.CharField(max_length=255) description = models.TextField() picture = models.ImageField(null=True) @@ -47,13 +50,13 @@ class Wish(AbstractModel): return percentage * 100 def get_absolute_url(self): - return reverse('wish:wish', kwargs={'pk': self.id}) + pass class WishPart(models.Model): - wish = models.ForeignKey(Wish) - user = models.ForeignKey(User, null=True) - unknown_user = models.ForeignKey('UnknownUser', null=True) + wish = models.ForeignKey(Wish, on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, null=True, on_delete=models.DO_NOTHING) + unknown_user = models.ForeignKey('UnknownUser', null=True, on_delete=models.DO_NOTHING) comment = models.TextField(null=True, blank=True) done_at = models.DateTimeField(auto_now_add=True) diff --git a/src/wish/templatetags/__init__.py b/gwift/wish/templatetags/__init__.py similarity index 100% rename from src/wish/templatetags/__init__.py rename to gwift/wish/templatetags/__init__.py diff --git a/src/wish/templatetags/tools.py b/gwift/wish/templatetags/tools.py similarity index 91% rename from src/wish/templatetags/tools.py rename to gwift/wish/templatetags/tools.py index f521e1a..619e3a5 100644 --- a/src/wish/templatetags/tools.py +++ b/gwift/wish/templatetags/tools.py @@ -4,7 +4,7 @@ import datetime from django import template -from wish.models import Wishlist +from gwift.wish.models import Wishlist register = template.Library() diff --git a/src/wish/tests.py b/gwift/wish/tests.py similarity index 100% rename from src/wish/tests.py rename to gwift/wish/tests.py diff --git a/src/wish/urls.py b/gwift/wish/urls.py similarity index 100% rename from src/wish/urls.py rename to gwift/wish/urls.py diff --git a/src/wish/views.py b/gwift/wish/views.py similarity index 100% rename from src/wish/views.py rename to gwift/wish/views.py diff --git a/src/gwift/wsgi.py b/gwift/wsgi.py similarity index 100% rename from src/gwift/wsgi.py rename to gwift/wsgi.py diff --git a/src/manage.py b/manage.py similarity index 100% rename from src/manage.py rename to manage.py diff --git a/src/static/css/style.css b/static/css/style.css similarity index 100% rename from src/static/css/style.css rename to static/css/style.css diff --git a/src/static/img/favicon.ico b/static/img/favicon.ico similarity index 100% rename from src/static/img/favicon.ico rename to static/img/favicon.ico diff --git a/src/static/img/gwift-20x20.png b/static/img/gwift-20x20.png similarity index 100% rename from src/static/img/gwift-20x20.png rename to static/img/gwift-20x20.png diff --git a/src/static/js/navbar.js b/static/js/navbar.js similarity index 100% rename from src/static/js/navbar.js rename to static/js/navbar.js diff --git a/src/templates/_footer.html b/templates/_footer.html similarity index 100% rename from src/templates/_footer.html rename to templates/_footer.html diff --git a/src/templates/_menu_items.html b/templates/_menu_items.html similarity index 100% rename from src/templates/_menu_items.html rename to templates/_menu_items.html diff --git a/src/templates/base.html b/templates/base.html similarity index 100% rename from src/templates/base.html rename to templates/base.html diff --git a/src/templates/wish/list.html b/templates/wish/list.html similarity index 100% rename from src/templates/wish/list.html rename to templates/wish/list.html diff --git a/src/templates/wish/list_detail.html b/templates/wish/list_detail.html similarity index 100% rename from src/templates/wish/list_detail.html rename to templates/wish/list_detail.html diff --git a/src/templates/wish/wish_detail.html b/templates/wish/wish_detail.html similarity index 100% rename from src/templates/wish/wish_detail.html rename to templates/wish/wish_detail.html diff --git a/src/templates/wish/wish_update.html b/templates/wish/wish_update.html similarity index 100% rename from src/templates/wish/wish_update.html rename to templates/wish/wish_update.html