=====
-
Install the app
pip install djangocms_miblog
-
Add "blog" to your INSTALLED_APPS setting like this
INSTALLED_APPS = [ ... 'blog', ]
-
Add in project URLS
... url(r'^blog/', include('blog.urls')),
-
Settings Add in settings.py
BLOG_PAGINATION = 5 BLOG_LIST_TRUNCWORDS_COUNT = 10
-
Migrate
./manage.py migrate
-
Run Test Server
./manage.py runserver
DjangoCMS http://www.django-cms.org/en/
django-filer & (dependencies) https://github.com/divio/django-filer
django-taggit https://github.com/alex/django-taggit
urlpatterns = patterns('',
url(r'^$', BlogPostListView.as_view(), name='post_list'),
url(r'^(?P<slug>[-\w]+)/$', BlogPostDetailView.as_view(), name='post_detail'),
url(r'^tag/(?P<tag>[-\w]+)/$', TaggedListView.as_view(), name='posts_tagged'),
url(r'^category/(?P<category>[-\w]+)/$', CategoryListView.as_view(), name='posts_category'),
)
Fields
- title [CharField]
- pub_date [DateTimeField]
- edit_date [DateTimeField]
- categories [ManyToMany]
- tags [TaggableManager()]
- picture [URLField]
- body [HTMLField]
Browse post list
{% for post in post_list %}
{{post.title}}
...
{% endfor %}
Get Next Or Previous
- For get Next Work (Navigation) `post.get_next_post` => return (URL)
- For get Previous Work (Navigation) `post.get_previous_post` => return (URL)
{{post.get_previous_post}}
{{post.get_next_post}}
- Title : {{post.title}}
- Publish at : {{post.pub_date}}
- Edit date : {{post.edit_date}}
- Categories : {% for category in post.categories.all %}{{category}}{% endfor %}
- Tags : {% for tag in post.tags.all %}{{tag}}{% endfor %}
- Picture : {{post.head_picture}}
- Body : {{post.body}}
For latest post 'X is number of post'
{% get_latest_post X %}
For get all categories
{% list_post_categories %}