jhonvidal / djangocms_publications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

===== djangocms_publications

Quick start

Install & settings

  1. Install the app

    pip install git+https://github.com/jhonvidal/djangocms_publications.git@master
    
  2. Add "blog" to your INSTALLED_APPS setting like this

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

    ...
    url(r'^publications/', include('publications.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'^$', PubPostListView.as_view(), name='post_list'),
        url(r'^(?P<slug>[-\w]+)/$', PubPostDetailView.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 %}

About

License:GNU General Public License v3.0


Languages

Language:Python 79.5%Language:HTML 20.5%