Skip to main content

categories management system for web applications in turbogears2

Project description

https://travis-ci.org/axant/tgapp-categories.svg?branch=master https://coveralls.io/repos/github/axant/tgapp-categories/badge.svg?branch=master

About tgapp-categories

This pluggable allow you to manage (create, read, update, delete) categories on a website. The categories cannot be nested. There are 2 images associated to every category This plugin works with both sqlalchemy and ming

Installing

tgapp-categories can be installed both from pypi or from github:

pip install tgappcategories

should just work for most of the users

Plugging tgapp-categories

In your application config/app_cfg.py import plug:

from tgext.pluggable import plug

Then at the end of the file call plug with tgappcategories:

plug(base_config, 'tgappcategories', 'categories')

You will be able to access the plugged application at http://localhost:8080/categories.

Permissions

This pluggable creates a Permission named ‘tgappcategories’, that has to be assigned to the categories management users group. You can assign it with a migration or evolution, using alembic or tgext.evolve

example of an evolution with tgext.evolve and ming:

class TgappCategories(Evolution):
"""Assigns the tgappcategories permission to Managers"""
evolution_id = 'tgapp-categories'

def evolve(self):
    log.info('TgappCategories migration running')

    g_managers = model.Group.query.find({'group_name': 'managers'}).one()

    p_tgappcategories = model.Permission.query.find(
        {'permission_name': 'tgappcategories'}).one()
    p_tgappcategories.groups = [g_managers]
    model.DBSession.flush_all()

Depot

This pluggable needs depot in order to work you can find depot at https://github.com/amol-/depot after you inserted depot into your project configure a storage called category_images example:

app_cfg['depot_backend_type'] = 'depot.io.memory.MemoryFileStorage'
app_cfg['depot.category_images.backend'] = 'depot.io.memory.MemoryFileStorage'
app_cfg['depot.category_images.prefix'] = 'category_images/'
storages = {
    'category_images': 'category_image',
}
for storage in storages:
    prefix = 'depot.%s.' % storage
    print('Configuring Storage %s*' % prefix)
    DepotManager.configure(storage, app_cfg, prefix)
    DepotManager.alias(storages[storage], storage)

Project details


Download files

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

Source Distribution

tgapp-categories-0.2.1.tar.gz (13.8 kB view details)

Uploaded Source

File details

Details for the file tgapp-categories-0.2.1.tar.gz.

File metadata

File hashes

Hashes for tgapp-categories-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a611c6bab6dcea749a2eacb8bcc75f99f3dcfa3c3755d7861a3ac0037b85ada3
MD5 1639cd162f4a7c5c794f8c312f58f0f0
BLAKE2b-256 9b8bd6e385612f8d7c41b46c44d12b2277312d6e0483bd1d1846c31e713ff87f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page