Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Updated main_app/models.py main_app/views.py to work with Django v2 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Treasuregram/Treasuregram/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
'django.contrib.staticfiles',
]


MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

MIDDLEWARE_CLASSES = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand Down Expand Up @@ -122,4 +133,4 @@

STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
MEDIA_URL = '/media/'
2 changes: 1 addition & 1 deletion Treasuregram/main_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def get_image_path(instance, filename):


class Treasure(models.Model):
user = models.ForeignKey(User)
user = models.ForeignKey(User, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
value = models.DecimalField(max_digits=10, decimal_places=2)
location = models.CharField(max_length=100)
Expand Down
2 changes: 1 addition & 1 deletion Treasuregram/main_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.forms import UserCreationForm
from django.core.urlresolvers import reverse
from django.urls import reverse

from .models import Treasure #, HashTag
from .forms import TreasureForm, LoginForm
Expand Down