Skip to main content

Django modules by Garpix.

Project description

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

Project details


Release history Release notifications

This version
History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-garpix-0.1.2.tar.gz (23.3 kB) Copy SHA256 hash SHA256 Source None Jun 19, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page