Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for working with python 3.7.1 and django 2.1.3 #12

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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea
.gitignore
.idea/
__pycache__/
Binary file modified db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file added media/Britney_Spears_-_Womanizerpromusic.me.mp3
Binary file not shown.
Binary file added media/bomt11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion music/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class Album(models.Model):
user = models.ForeignKey(User, default=1)
user = models.ForeignKey(User, default=1,on_delete=models.CASCADE)
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre = models.CharField(max_length=100)
Expand Down
8 changes: 4 additions & 4 deletions music/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def create_album(request):
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return render(request, 'music/login.html')
else:
form = AlbumForm(request.POST or None, request.FILES or None)
Expand Down Expand Up @@ -86,7 +86,7 @@ def delete_song(request, album_id, song_id):


def detail(request, album_id):
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return render(request, 'music/login.html')
else:
user = request.user
Expand Down Expand Up @@ -123,7 +123,7 @@ def favorite_album(request, album_id):


def index(request):
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return render(request, 'music/login.html')
else:
albums = Album.objects.filter(user=request.user)
Expand Down Expand Up @@ -192,7 +192,7 @@ def register(request):


def songs(request, filter_by):
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return render(request, 'music/login.html')
else:
try:
Expand Down
6 changes: 4 additions & 2 deletions website/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
'django.contrib.staticfiles',
]

MIDDLEWARE_CLASSES = [


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.auth.middleware.SessionAuthenticationMiddleware',
#'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
Expand Down