/djangocms_miblog

Simple blog for djangoCMS

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

=====

Join the chat at https://gitter.im/Pyc0kw4k/djangocms_miblog djangocms_miblog

Quick start

Install & settings

  1. Install the app

    pip install djangocms_miblog
    
  2. Add "blog" to your INSTALLED_APPS setting like this

    INSTALLED_APPS = [
        ...
        'blog',
    ]
  3. Add in project URLS

    ...
    url(r'^blog/', include('blog.urls')),
  4. Settings Add in settings.py

    BLOG_PAGINATION = 5
    BLOG_LIST_TRUNCWORDS_COUNT = 10
  5. Migrate

  
 ./manage.py migrate
  1. Run Test Server

    ./manage.py runserver

Requirements

DjangoCMS http://www.django-cms.org/en/
django-filer & (dependencies) https://github.com/divio/django-filer
django-taggit https://github.com/alex/django-taggit

URLS

    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'),
    )

Example usage

Work Models

Fields

  • title [CharField]
  • pub_date [DateTimeField]
  • edit_date [DateTimeField]
  • categories [ManyToMany]
  • tags [TaggableManager()]
  • picture [URLField]
  • body [HTMLField]

Post List

Browse post list

    {% for post in post_list %}
        {{post.title}}
        ...
    {% endfor %}

Post Detail

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)

For Get previous post

{{post.get_previous_post}}

For Get next post

{{post.get_next_post}}

Render 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}}

Templatetags

For latest post 'X is number of post'

    {% get_latest_post X %}

For get all categories

    {% list_post_categories %}