<a href="{% url 'topic_posts' board.pk post.topic.pk %}">
By {{ post.created_by.username }} at {{ post.created_at }}
</a>
Exception Value:
Reverse for 'topic_posts' with arguments '(2, '')' not found. 1 pattern(s) tried: ['boards/(?P<pk>\\d+)/topics/(?P<topic_pk>\\d+)/$']
<a href="{% url 'board_topics' board.pk %}">{{ board.name }}</a>
<a href="{% url 'topic_posts' board.pk %}">
By {{ post.created_by.username }} at {{ post.created_at }}
</a>
<a class="navbar-brand" href="{% url 'board' %}">Django Boards</a>
import os
import sys
path = '/home/Ivan/MyBlog' # use your own username here
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'blog.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Error running WSGI application
ImportError: No module named blog.settings
File "/var/www/ivan_pythonanywhere_com_wsgi.py", line 11, in <module>
application = get_wsgi_application()
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'posts',
# implement pagedown
'pagedown',
]
from django import forms
from models import Post , Category
# Import pagedown
from pagedown.widgets import PagedownWidget
class PostForm(forms.ModelForm):
# initialize a variable to form with pagedown
content = forms.CharField(widget= PagedownWidget)
class Meta:
model = Post
fields = [
"title",
"content",
"image",
'category',
]
{% extends "base.html" %}
#Подключаем pagedown к форме
{% block extra %}
{{ form.media }}
{% endblock extra %}
{% block content %}
<div class="col-md-6 col-md-offset-3">
<form method='POST' action='' enctype="multipart/form-data">{% csrf_token %}
{{ form.as_p }}
<input type='submit' value="Create Post">
</form>
</div>
{% endblock %}