change directories layout to <project>/<applications>

This commit is contained in:
Fred Pauchet 2020-03-04 20:50:21 +01:00
parent 23214c70fa
commit ad41c0c025
28 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ __pycache__
migrations
.coverage
coverage_html_report/
.vscode/*

View File

@ -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',

View File

@ -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'))
]

View File

@ -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)

View File

@ -4,7 +4,7 @@ import datetime
from django import template
from wish.models import Wishlist
from gwift.wish.models import Wishlist
register = template.Library()

View File

Before

Width:  |  Height:  |  Size: 657 B

After

Width:  |  Height:  |  Size: 657 B

View File

Before

Width:  |  Height:  |  Size: 570 B

After

Width:  |  Height:  |  Size: 570 B