diff --git a/one_hit_wonder/account/models.py b/one_hit_wonder/account/models.py
index 7c953a5..01dcbec 100644
--- a/one_hit_wonder/account/models.py
+++ b/one_hit_wonder/account/models.py
@@ -9,6 +9,7 @@ class Musician(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
location = models.ForeignKey('Location', on_delete=models.PROTECT)
instruments = models.ManyToManyField('Instrument')
+ image = models.ImageField(default='default.jpg', upload_to='profile_pics')
def __str__(self):
return f"{self.user.first_name} {self.user.last_name}"
diff --git a/one_hit_wonder/account/templates/account/base.html b/one_hit_wonder/account/templates/account/base.html
index cbffe3f..0a7d826 100644
--- a/one_hit_wonder/account/templates/account/base.html
+++ b/one_hit_wonder/account/templates/account/base.html
@@ -1,59 +1,62 @@
{% load static %}
+
-
-
+
+
-
-
+
+
- {% if title %}
- One Hit Wonder - {{ title }}
- {% else %}
- One Hit Wonder
- {% endif %}
+ {% if title %}
+ One Hit Wonder - {{ title }}
+ {% else %}
+ One Hit Wonder
+ {% endif %}
-
- One Hit Wonder
-
+
+
+ One Hit Wonder
+
-
-
-
+
+
-
-
- {% if messages %}
+
+
+
+ {% if messages %}
{% for message in messages %}
-
- {{ message }}
-
+
+ {{ message }}
+
{% endfor %}
- {% endif %}
- {% block content %}{% endblock %}
-
-
-
-
+ {% endif %}
+ {% block content %}{% endblock %}
+
+
+
+
\ No newline at end of file
diff --git a/one_hit_wonder/account/templates/account/create_ad.html b/one_hit_wonder/account/templates/account/create_ad.html
index c1bec00..19eb970 100644
--- a/one_hit_wonder/account/templates/account/create_ad.html
+++ b/one_hit_wonder/account/templates/account/create_ad.html
@@ -2,4 +2,4 @@
{% block content %}
Create Ad
-{% endblock content %}
+{% endblock content %}
\ No newline at end of file
diff --git a/one_hit_wonder/account/templates/account/home.html b/one_hit_wonder/account/templates/account/home.html
index 6c239ba..9bed28b 100644
--- a/one_hit_wonder/account/templates/account/home.html
+++ b/one_hit_wonder/account/templates/account/home.html
@@ -1,11 +1,12 @@
{% extends "account/base.html" %}
+Welcome Back!
+
{% block content %}
+ Welcome Back!
{% for post in posts %}
- {{ post.title }}
+ {{ post.title }}
By {{ post.musician }} on {{ post.date_posted }}
{{ post.content }}
{% endfor %}
- {{ musician.user.username }}
{% endblock content %}
-
diff --git a/one_hit_wonder/account/templates/account/landing.html b/one_hit_wonder/account/templates/account/landing.html
new file mode 100644
index 0000000..4f9efb0
--- /dev/null
+++ b/one_hit_wonder/account/templates/account/landing.html
@@ -0,0 +1,5 @@
+{% extends "account/base.html" %}
+
+{% block content %}
+ One Hit Wonder
+{% endblock content %}
\ No newline at end of file
diff --git a/one_hit_wonder/account/templates/account/matches.html b/one_hit_wonder/account/templates/account/matches.html
index c0191da..e38bd97 100644
--- a/one_hit_wonder/account/templates/account/matches.html
+++ b/one_hit_wonder/account/templates/account/matches.html
@@ -2,4 +2,4 @@
{% block content %}
Matches
-{% endblock content %}
+{% endblock content %}
\ No newline at end of file
diff --git a/one_hit_wonder/account/templates/account/messages.html b/one_hit_wonder/account/templates/account/messages.html
index 9f0fae1..ec24769 100644
--- a/one_hit_wonder/account/templates/account/messages.html
+++ b/one_hit_wonder/account/templates/account/messages.html
@@ -2,4 +2,4 @@
{% block content %}
Messages
-{% endblock content %}
+{% endblock content %}
\ No newline at end of file
diff --git a/one_hit_wonder/account/templates/account/profile.html b/one_hit_wonder/account/templates/account/profile.html
index 406181f..920a3e7 100644
--- a/one_hit_wonder/account/templates/account/profile.html
+++ b/one_hit_wonder/account/templates/account/profile.html
@@ -1,8 +1,14 @@
{% extends "account/base.html" %}
-
+{% load crispy_forms_tags %}
{% block content %}
- Profile
- {{ user.username }}
- {{ user.first_name }}
- {{ musician.location }}
+
{% endblock content %}
\ No newline at end of file
diff --git a/one_hit_wonder/account/urls.py b/one_hit_wonder/account/urls.py
index 1fa1578..3893263 100644
--- a/one_hit_wonder/account/urls.py
+++ b/one_hit_wonder/account/urls.py
@@ -1,8 +1,11 @@
from django.urls import path
-from . import views
from django.contrib.auth import views as auth_views
+from django.conf import settings
+from django.conf.urls.static import static
+from . import views
urlpatterns = [
+ path('', views.home, name='account-landing'),
path('', views.home, name='account-home'),
path('profile/', views.profile, name='account-profile'),
path('messages/', views.messages, name='account-messages'),
@@ -13,3 +16,6 @@
path('logout/', auth_views.LogoutView.as_view(template_name="account/logout.html"), name="logout"),
]
+# For use during debugging. Change settings for live deployment
+if settings.DEBUG:
+ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
diff --git a/one_hit_wonder/account/views.py b/one_hit_wonder/account/views.py
index 669f29a..e4489cc 100644
--- a/one_hit_wonder/account/views.py
+++ b/one_hit_wonder/account/views.py
@@ -14,6 +14,13 @@
]
+def landing(request):
+ print(request)
+ return render(request, 'account/landing.html')
+
+
+# Decorator to check if user is logged in before displaying profile
+@login_required
def home(request):
context = {
'posts': posts
@@ -24,11 +31,8 @@ def home(request):
# Decorator to check if user is logged in before displaying profile
@login_required
def profile(request):
- user_id = request.user.id
- musician = Musician.objects.get(id=user_id)
context = {
'title': 'Profile',
- 'musician': musician
}
return render(request, 'account/profile.html', context)
diff --git a/one_hit_wonder/mariadb.cnf b/one_hit_wonder/mariadb.cnf
new file mode 100644
index 0000000..7f5145c
--- /dev/null
+++ b/one_hit_wonder/mariadb.cnf
@@ -0,0 +1,7 @@
+[client]
+host = one-hit-wonder.cqtwgm1vyu0i.us-east-1.rds.amazonaws.com
+database = one_hit_wonder
+user = admin
+password = D0nt8reakM3!
+default-character-set = utf8
+init_command = SET default_storage_engine=INNODB
\ No newline at end of file
diff --git a/one_hit_wonder/one_hit_wonder/settings.py b/one_hit_wonder/one_hit_wonder/settings.py
index d69f5d9..d60c5cb 100644
--- a/one_hit_wonder/one_hit_wonder/settings.py
+++ b/one_hit_wonder/one_hit_wonder/settings.py
@@ -124,6 +124,10 @@
# Tells crispy forms to use bootstrap 4
CRISPY_TEMPLATE_PACK = 'bootstrap4'
+# Creates directories for different types of media
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
+MEDIA_URL = '/media/'
+
# Sets default url to account-home page after successful login
LOGIN_REDIRECT_URL = 'account-home'