skip to navigation
skip to content

django-garpix 0.1.2

Django modules by Garpix.

TODO: Move this to readthedocs.

Install

$ pip install django-garpix

Submodules

  • helpers
  • blog
  • menu
  • seo
  • slider

and etc

Submodule “helpers”

Usage

ActiveManager

Get only active objects.

In your model:

from garpix.helpers import ActiveModel

class MyModel(ActiveModel):
    ...

Querieng:

MyModel.active_objects.filter(...)

or

MyModel.objects.filter(is_active=True)

Abstract Models

  • ActiveModel
  • CreatedUpdatedModel
  • ImageModel
  • ImageRequiredModel
  • TitleModel
  • TitleRequiredModel

See sources for explanation.

get_file_path

Slugified file names:

/uploads/YEAR/MONTH/SLUGIFIED_FILENAME.EXTENSION

In your model:

from garpix.helpers import get_file_path

class MyModel(models.Model):
    ...
    image = models.ImageField(upload_to=get_file_path)

Submodule “blog”

Usage

Add ‘garpix.blog’ to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    ...
    'garpix.blog',
    ...
)

Make migrate:

$ python manage.py migrate

Enjoy!

As widget

Add to your template:

{% load garpix_blog %}

{% garpix_blog %}

As another pages

Add to your urls.py:

from django.conf.urls import url, include

urlpatterns = [
    ...
    url(r'^blog/', include('garpix.blog.urls')),
    ...
]

Submodule “menu”

Usage

Add ‘garpix.menu’ to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    ...
    'garpix.menu',
    ...
)

Make migrate:

$ python manage.py migrate

Enjoy!

As widget

  1. Add to your base template:

    {% load garpix_menu %}

    {% garpix_menu_css %} {% garpix_menu_js %}

  2. Add some Menu and MenuItem in admin panel. Set some code (for example - ‘demo’) for your Menu.

  3. Include slider on your page in your template:

    {% garpix_menu ‘demo’ %}

Submodule “seo”

Usage

Add ‘garpix.seo’ to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    ...
    'garpix.seo',
    ...
)

Make migrate:

$ python manage.py migrate

Enjoy!

As widget

Add to your base template:

{% load garpix_seo %}

If you extends some model (from garpix.seo.models import SeoModel):

{% garpix_seo element=element %}

If you want default values:

{% garpix_seo %}

Submodule “slider”

Usage

Add ‘garpix.slider’ to INSTALLED_APPS in settings.py:

INSTALLED_APPS = (
    ...
    'garpix.slider',
    ...
)

Make migrate:

$ python manage.py migrate

Enjoy!

As widget

  1. Add to your base template:

    {% load garpix_slider %}

    {% garpix_slider_css %} {% garpix_slider_js %}

  2. Add some Slider and SliderItem in admin panel. Set some code (for example - ‘my_slider’) for your Slider.

  3. Include slider on your page in your template:

    {% garpix_slider ‘my_slider’ images_count=6 images_in_row=3 show_arrows=True %}

License

MIT

 
File Type Py Version Uploaded on Size
django-garpix-0.1.2.tar.gz (md5) Source 2017-06-19 22KB