SlideShare a Scribd company logo
1 of 2
Download to read offline
django-sitecats 0.4.0 : Python Package Index
Django reusable application for content categorization.
Django reusable application for content categorization.
Nay, - you say, - all that tags business lacks structuring.
This application is just about structuring your data: build categories hierarchy and link your site
entities to those categories.
# Somewhere in views.py
from django.shortcuts import render, get_object_or_404
# Suppose Article model has sitecats.models.ModelWithCategory class mixed in.
from .models import Article
def article_details(self, request, article_id):
"""See, there is nothing special in this view, yet it'll render a page with categories for the article."""
return self.render(request, 'article.html', 'article': get_object_or_404(Article, pk=article_id))
def article_edit(self, request, article_id):
"""Let's allow this view to render and handle categories editor."""
article = get_object_or_404(Article, pk=article_id)
# Now we enable category editor for an article, and allow users
# not only to link that article to subcategories of `language`, and `os` categories,
# but also to add those subcategories.
article.enable_category_lists_editor(request,
editor_init_kwargs='allow_new': True,
additional_parents_aliases=['language', 'os'])
form = ... # Your usual Article edit handling code will be here.
return render(request, 'article.html', 'article': article, 'form': form)
Template coding basically boils down to sitecats_categories template tags usage:
!-- The same html is just fine for demonstration purposes for both our views.
Do not forget to load `sitecats` template tags library. --
% extends "base.html" %
% load sitecats %
% block contents %
!-- Some additional functionality (e.g. categories cloud rendering,
editor enhancements) will require JS. --
script src=" STATIC_URL js/sitecats/sitecats.min.js"/script
h1 article.title /h1
div id="article_categories"
% sitecats_categories from article % !-- And that's it. --
/div
!-- Form code goes somewhere here. --
% endblock %
Read the docs, sitecats can do more.
https://pypi.python.org/pypi/django-sitecats

More Related Content

What's hot

idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubludicrousexcerp10
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubflagrantlawsuit53
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubclammyhysteria698
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubludicrousexcerp10
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsomberfan2012
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubsuccessfuloutdo12
 
Knockout mvvm-m2-slides
Knockout mvvm-m2-slidesKnockout mvvm-m2-slides
Knockout mvvm-m2-slidesMasterCode.vn
 
Hibernate 5 – merge() Example
Hibernate 5 – merge() ExampleHibernate 5 – merge() Example
Hibernate 5 – merge() ExampleDucat India
 
Building the data access layer with entity framework
Building the data access layer with entity frameworkBuilding the data access layer with entity framework
Building the data access layer with entity frameworkJoy Sarker
 
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIGetting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIScott Gardner
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsScott Gardner
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0Korhan Bircan
 
Javascript REST with Jester
Javascript REST with JesterJavascript REST with Jester
Javascript REST with JesterMike Bailey
 
ASP.NET 4.5 webforms
ASP.NET 4.5 webformsASP.NET 4.5 webforms
ASP.NET 4.5 webformsAbhishek Sur
 

What's hot (15)

idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
idlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHubidlesign/django-sitecats · GitHub
idlesign/django-sitecats · GitHub
 
Knockout mvvm-m2-slides
Knockout mvvm-m2-slidesKnockout mvvm-m2-slides
Knockout mvvm-m2-slides
 
Hibernate 5 – merge() Example
Hibernate 5 – merge() ExampleHibernate 5 – merge() Example
Hibernate 5 – merge() Example
 
Building the data access layer with entity framework
Building the data access layer with entity frameworkBuilding the data access layer with entity framework
Building the data access layer with entity framework
 
Getting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUIGetting Started with Combine And SwiftUI
Getting Started with Combine And SwiftUI
 
SwiftUI and Combine All the Things
SwiftUI and Combine All the ThingsSwiftUI and Combine All the Things
SwiftUI and Combine All the Things
 
Objective c design pattens-architetcure
Objective c design pattens-architetcureObjective c design pattens-architetcure
Objective c design pattens-architetcure
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0
 
Javascript REST with Jester
Javascript REST with JesterJavascript REST with Jester
Javascript REST with Jester
 
ASP.NET 4.5 webforms
ASP.NET 4.5 webformsASP.NET 4.5 webforms
ASP.NET 4.5 webforms
 

Viewers also liked

chuyên dịch vụ giúp việc uy tín tại hcm
chuyên dịch vụ giúp việc uy tín tại hcmchuyên dịch vụ giúp việc uy tín tại hcm
chuyên dịch vụ giúp việc uy tín tại hcmsetsuko345
 
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gòn
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gònchuyên dịch vụ giúp việc văn phòng bảo đảm sài gòn
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gòntiffiny621
 
Velcom.ca services
Velcom.ca servicesVelcom.ca services
Velcom.ca servicesVelcom Dsl
 
RESUME OF CHARLES B. CABALLERO
RESUME OF CHARLES B. CABALLERORESUME OF CHARLES B. CABALLERO
RESUME OF CHARLES B. CABALLEROcharles caballero
 
Play Group English (Colours Name)
Play Group English (Colours Name)Play Group English (Colours Name)
Play Group English (Colours Name)Cambriannews
 

Viewers also liked (7)

chuyên dịch vụ giúp việc uy tín tại hcm
chuyên dịch vụ giúp việc uy tín tại hcmchuyên dịch vụ giúp việc uy tín tại hcm
chuyên dịch vụ giúp việc uy tín tại hcm
 
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gòn
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gònchuyên dịch vụ giúp việc văn phòng bảo đảm sài gòn
chuyên dịch vụ giúp việc văn phòng bảo đảm sài gòn
 
Velcom.ca services
Velcom.ca servicesVelcom.ca services
Velcom.ca services
 
Unidad viii
Unidad viiiUnidad viii
Unidad viii
 
Ken Armer
Ken ArmerKen Armer
Ken Armer
 
RESUME OF CHARLES B. CABALLERO
RESUME OF CHARLES B. CABALLERORESUME OF CHARLES B. CABALLERO
RESUME OF CHARLES B. CABALLERO
 
Play Group English (Colours Name)
Play Group English (Colours Name)Play Group English (Colours Name)
Play Group English (Colours Name)
 

Similar to django-sitecats 0.4.0 : Python Package Index

Django workshop : let's make a blog
Django workshop : let's make a blogDjango workshop : let's make a blog
Django workshop : let's make a blogPierre Sudron
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting startedMoniaJ
 
tangowithdjango - Ch15
tangowithdjango - Ch15tangowithdjango - Ch15
tangowithdjango - Ch15Asika Kuo
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With DjangoEric Satterwhite
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics PresentationShrinath Shenoy
 
Tips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentTips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentNaomi Royall
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheetLam Hoang
 
Django Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsDjango Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsAshishMishra308598
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Katy Slemon
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Udit Gangwani
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJoaquim Rocha
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App DevelopmentKetan Raval
 

Similar to django-sitecats 0.4.0 : Python Package Index (20)

Django workshop : let's make a blog
Django workshop : let's make a blogDjango workshop : let's make a blog
Django workshop : let's make a blog
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting started
 
tangowithdjango - Ch15
tangowithdjango - Ch15tangowithdjango - Ch15
tangowithdjango - Ch15
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With Django
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
 
Actionview
ActionviewActionview
Actionview
 
Tips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale DevelopmentTips and Tricks for LiveWhale Development
Tips and Tricks for LiveWhale Development
 
Django cheat sheet
Django cheat sheetDjango cheat sheet
Django cheat sheet
 
Django Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsDjango Frequently Asked Interview Questions
Django Frequently Asked Interview Questions
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...Markdown tutorial how to add markdown to rails app using redcarpet and codera...
Markdown tutorial how to add markdown to rails app using redcarpet and codera...
 
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
Django apps and ORM Beyond the basics [Meetup hosted by Prodeers.com]
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Discovering Django - zekeLabs
Discovering Django - zekeLabsDiscovering Django - zekeLabs
Discovering Django - zekeLabs
 
Session 2 django material for training at baabtra models
Session 2 django material for training at baabtra modelsSession 2 django material for training at baabtra models
Session 2 django material for training at baabtra models
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
React django
React djangoReact django
React django
 
Story Driven Web Development
Story Driven Web DevelopmentStory Driven Web Development
Story Driven Web Development
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 

More from flagrantlawsuit53

More from flagrantlawsuit53 (9)

American Kennel Club - The Dog’s Champion
American Kennel Club - The Dog’s ChampionAmerican Kennel Club - The Dog’s Champion
American Kennel Club - The Dog’s Champion
 
| Cats at Site Today
| Cats at Site Today| Cats at Site Today
| Cats at Site Today
 
django-sitecats documentation — django-sitecats 0.4.0 documentation
django-sitecats documentation — django-sitecats 0.4.0 documentationdjango-sitecats documentation — django-sitecats 0.4.0 documentation
django-sitecats documentation — django-sitecats 0.4.0 documentation
 
| Cats at Site Today
| Cats at Site Today| Cats at Site Today
| Cats at Site Today
 
| Cats at Site Today
| Cats at Site Today| Cats at Site Today
| Cats at Site Today
 
| Dogs at Site Today
| Dogs at Site Today| Dogs at Site Today
| Dogs at Site Today
 
| Dogs at Site Today
| Dogs at Site Today| Dogs at Site Today
| Dogs at Site Today
 
| Dogs at Site Today
| Dogs at Site Today| Dogs at Site Today
| Dogs at Site Today
 
Test
TestTest
Test
 

django-sitecats 0.4.0 : Python Package Index

  • 1. django-sitecats 0.4.0 : Python Package Index Django reusable application for content categorization. Django reusable application for content categorization. Nay, - you say, - all that tags business lacks structuring. This application is just about structuring your data: build categories hierarchy and link your site entities to those categories. # Somewhere in views.py from django.shortcuts import render, get_object_or_404 # Suppose Article model has sitecats.models.ModelWithCategory class mixed in. from .models import Article def article_details(self, request, article_id): """See, there is nothing special in this view, yet it'll render a page with categories for the article.""" return self.render(request, 'article.html', 'article': get_object_or_404(Article, pk=article_id)) def article_edit(self, request, article_id): """Let's allow this view to render and handle categories editor.""" article = get_object_or_404(Article, pk=article_id) # Now we enable category editor for an article, and allow users # not only to link that article to subcategories of `language`, and `os` categories, # but also to add those subcategories. article.enable_category_lists_editor(request, editor_init_kwargs='allow_new': True, additional_parents_aliases=['language', 'os']) form = ... # Your usual Article edit handling code will be here. return render(request, 'article.html', 'article': article, 'form': form) Template coding basically boils down to sitecats_categories template tags usage:
  • 2. !-- The same html is just fine for demonstration purposes for both our views. Do not forget to load `sitecats` template tags library. -- % extends "base.html" % % load sitecats % % block contents % !-- Some additional functionality (e.g. categories cloud rendering, editor enhancements) will require JS. -- script src=" STATIC_URL js/sitecats/sitecats.min.js"/script h1 article.title /h1 div id="article_categories" % sitecats_categories from article % !-- And that's it. -- /div !-- Form code goes somewhere here. -- % endblock % Read the docs, sitecats can do more. https://pypi.python.org/pypi/django-sitecats