Compare commits
2 Commits
1da5447a16
...
71eebf5898
Author | SHA1 | Date | |
---|---|---|---|
71eebf5898 | |||
470fa3038a |
|
@ -15,8 +15,8 @@ socket.events['new_post'] = function(data) {
|
||||||
post_str += '<br /><a href="javascript:void(0);" onclick="edit_post(\'' + data.post_id + '\')">Edit</a>';
|
post_str += '<br /><a href="javascript:void(0);" onclick="edit_post(\'' + data.post_id + '\')">Edit</a>';
|
||||||
post_str += '<a href="javascript:void(0);" id="savePost-' + data.post_id + '" onclick="save_post(\'' + data.post_id + '\')" style="display:none;">Save</a>';
|
post_str += '<a href="javascript:void(0);" id="savePost-' + data.post_id + '" onclick="save_post(\'' + data.post_id + '\')" style="display:none;">Save</a>';
|
||||||
} else if (data.post_type === 'dice' || data.post_type === 'poll') {
|
} else if (data.post_type === 'dice' || data.post_type === 'poll') {
|
||||||
post_str += '<br /><a href="javascript:void(0);" id="close_post_id-' + data.post_id + '" onclick="close_post(' + data.post_id + ')">Close</a>';
|
post_str += '<br /><a href="javascript:void(0);" id="closePost-' + data.post_id + '" onclick="close_post(' + data.post_id + ')">Close</a>';
|
||||||
post_str += '<a href="javascript:void(0);" id="open_post_id-' + data.post_id + '" onclick="open_post(' + data.post_id + ')" style="display:none;">Open</a>'
|
post_str += '<a href="javascript:void(0);" id="openPost-' + data.post_id + '" onclick="open_post(' + data.post_id + ')" style="display:none;">Open</a>'
|
||||||
}
|
}
|
||||||
/* end QM only */
|
/* end QM only */
|
||||||
post_str += '</div><div class="questPostData" id="questPostData-' + data.post_id + '">';
|
post_str += '</div><div class="questPostData" id="questPostData-' + data.post_id + '">';
|
||||||
|
|
|
@ -14,4 +14,5 @@ urlpatterns = [
|
||||||
path('signup/', include('signup.urls')),
|
path('signup/', include('signup.urls')),
|
||||||
path('login/', include('login.urls')),
|
path('login/', include('login.urls')),
|
||||||
path('logout/', include('logout.urls')),
|
path('logout/', include('logout.urls')),
|
||||||
|
path('user/', include('user.urls')),
|
||||||
]
|
]
|
||||||
|
|
1
todo
1
todo
|
@ -32,4 +32,3 @@ Adjust quote preview postioning
|
||||||
Port from old code:
|
Port from old code:
|
||||||
Edit post
|
Edit post
|
||||||
Images
|
Images
|
||||||
User page
|
|
||||||
|
|
7
user/jinja2/user/profile.html
Normal file
7
user/jinja2/user/profile.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{ user.username }}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ user.username }}'s profile</h1>
|
||||||
|
Signed up: {{ user.date_joined }}<br>
|
||||||
|
Num. quests ran: {{ quests.count() }}<br>
|
||||||
|
{% endblock %}
|
13
user/urls.py
Normal file
13
user/urls.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
User URL configuration.
|
||||||
|
"""
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
app_name = 'user'
|
||||||
|
urlpatterns = [
|
||||||
|
path('', views.index, name='index'),
|
||||||
|
path('<int:user_id>', views.profile, name='profile'),
|
||||||
|
]
|
|
@ -1,3 +1,29 @@
|
||||||
from django.shortcuts import render
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
/user app views.
|
||||||
|
"""
|
||||||
|
from django.http import HttpResponse
|
||||||
|
from django.shortcuts import redirect, render
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
# Create your views here.
|
from .models import User
|
||||||
|
from quest.models import Quest
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
"""
|
||||||
|
The user index page.
|
||||||
|
"""
|
||||||
|
return HttpResponse("Hello, world. You're at the user index.")
|
||||||
|
|
||||||
|
|
||||||
|
def profile(request, user_id):
|
||||||
|
"""
|
||||||
|
User profile.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
user = User.objects.get(id=user_id)
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
return HttpResponse(f"User_id {user_id} does not exist.")
|
||||||
|
quests = Quest.objects.filter(owner=user)
|
||||||
|
context = locals()
|
||||||
|
return render(request, 'user/profile.html', context)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user