SlideShare a Scribd company logo
1 of 2
Download to read offline
idlesign/django-sitecats · GitHub
README.rst
https://github.com/idlesign/django-sitecats
Description
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.
Documentation
http://django-sitecats.readthedocs.org/
https://github.com/idlesign/django-sitecats

More Related Content

What's hot

Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJSBrajesh Yadav
 
Data Binding - Android by Harin Trivedi
Data Binding - Android by Harin TrivediData Binding - Android by Harin Trivedi
Data Binding - Android by Harin Trivediharintrivedi
 
Thinking in Components - Comparing AngularJS With React
Thinking in Components - Comparing AngularJS With ReactThinking in Components - Comparing AngularJS With React
Thinking in Components - Comparing AngularJS With Reacta_sharif
 
Javascript REST with Jester
Javascript REST with JesterJavascript REST with Jester
Javascript REST with JesterMike Bailey
 
Single page application 03
Single page application   03Single page application   03
Single page application 03Ismaeel Enjreny
 
Implement custom iprincipal in mvc
Implement custom iprincipal in mvcImplement custom iprincipal in mvc
Implement custom iprincipal in mvcLearningTech
 

What's hot (8)

Filters in AngularJS
Filters in AngularJSFilters in AngularJS
Filters in AngularJS
 
Data Binding - Android by Harin Trivedi
Data Binding - Android by Harin TrivediData Binding - Android by Harin Trivedi
Data Binding - Android by Harin Trivedi
 
Thinking in Components - Comparing AngularJS With React
Thinking in Components - Comparing AngularJS With ReactThinking in Components - Comparing AngularJS With React
Thinking in Components - Comparing AngularJS With React
 
Javascript REST with Jester
Javascript REST with JesterJavascript REST with Jester
Javascript REST with Jester
 
Avatar
AvatarAvatar
Avatar
 
Single page application 03
Single page application   03Single page application   03
Single page application 03
 
Implement custom iprincipal in mvc
Implement custom iprincipal in mvcImplement custom iprincipal in mvc
Implement custom iprincipal in mvc
 
Angular js
Angular jsAngular js
Angular js
 

Viewers also liked

Ligações Ilimitadas Fixo e Celular Sem Acesso à Internet
Ligações Ilimitadas Fixo e Celular Sem Acesso à InternetLigações Ilimitadas Fixo e Celular Sem Acesso à Internet
Ligações Ilimitadas Fixo e Celular Sem Acesso à InternetSerafim Antônio
 
Natural forces reflection
Natural forces reflectionNatural forces reflection
Natural forces reflectiongrade4biss
 
Como ganar dinero con blog
Como ganar dinero con blogComo ganar dinero con blog
Como ganar dinero con blogRicardo3654
 
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...Nannette Naught
 
Organização 2
Organização 2Organização 2
Organização 2AMPGamito
 
2014-2015 TME Scores
2014-2015 TME Scores2014-2015 TME Scores
2014-2015 TME ScoresJody Murphy
 
PLE Y SYMBALOO
PLE Y SYMBALOOPLE Y SYMBALOO
PLE Y SYMBALOOAkistha
 
Robot para niños con síndrome de asperger ciencia - eltiempo
Robot para niños con síndrome de asperger   ciencia - eltiempoRobot para niños con síndrome de asperger   ciencia - eltiempo
Robot para niños con síndrome de asperger ciencia - eltiempojuranyadelia
 

Viewers also liked (17)

Olap ppt
Olap pptOlap ppt
Olap ppt
 
Noticia 2
Noticia 2Noticia 2
Noticia 2
 
BenjaminKloosResume
BenjaminKloosResumeBenjaminKloosResume
BenjaminKloosResume
 
Ligações Ilimitadas Fixo e Celular Sem Acesso à Internet
Ligações Ilimitadas Fixo e Celular Sem Acesso à InternetLigações Ilimitadas Fixo e Celular Sem Acesso à Internet
Ligações Ilimitadas Fixo e Celular Sem Acesso à Internet
 
Idioma
IdiomaIdioma
Idioma
 
IGIDR-IFPRI -Spatial Effects of Agricultural Policy Choices, A-Ganesh Kumar, ...
IGIDR-IFPRI -Spatial Effects of Agricultural Policy Choices, A-Ganesh Kumar, ...IGIDR-IFPRI -Spatial Effects of Agricultural Policy Choices, A-Ganesh Kumar, ...
IGIDR-IFPRI -Spatial Effects of Agricultural Policy Choices, A-Ganesh Kumar, ...
 
Natural forces reflection
Natural forces reflectionNatural forces reflection
Natural forces reflection
 
Animal Equality
Animal EqualityAnimal Equality
Animal Equality
 
Como ganar dinero con blog
Como ganar dinero con blogComo ganar dinero con blog
Como ganar dinero con blog
 
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...
Orienteering for Libraries: Grounding Our Adventure: Definitional Alignment a...
 
01-03-16
01-03-1601-03-16
01-03-16
 
Organização 2
Organização 2Organização 2
Organização 2
 
Resume-Prateek
Resume-PrateekResume-Prateek
Resume-Prateek
 
2014-2015 TME Scores
2014-2015 TME Scores2014-2015 TME Scores
2014-2015 TME Scores
 
PLE Y SYMBALOO
PLE Y SYMBALOOPLE Y SYMBALOO
PLE Y SYMBALOO
 
Intuitive Eating
Intuitive EatingIntuitive Eating
Intuitive Eating
 
Robot para niños con síndrome de asperger ciencia - eltiempo
Robot para niños con síndrome de asperger   ciencia - eltiempoRobot para niños con síndrome de asperger   ciencia - eltiempo
Robot para niños con síndrome de asperger ciencia - eltiempo
 

Similar to idlesign/django-sitecats · GitHub

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
 
tangowithdjango - Ch15
tangowithdjango - Ch15tangowithdjango - Ch15
tangowithdjango - Ch15Asika Kuo
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting startedMoniaJ
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With DjangoEric Satterwhite
 
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
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics PresentationShrinath Shenoy
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Django Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsDjango Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsAshishMishra308598
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJoaquim Rocha
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJSBoris Dinkevich
 
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ..."Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...DrupalCamp Kyiv
 

Similar to idlesign/django-sitecats · GitHub (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
 
tangowithdjango - Ch15
tangowithdjango - Ch15tangowithdjango - Ch15
tangowithdjango - Ch15
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
Django 1.10.3 Getting started
Django 1.10.3 Getting startedDjango 1.10.3 Getting started
Django 1.10.3 Getting started
 
Actionview
ActionviewActionview
Actionview
 
Powerful Generic Patterns With Django
Powerful Generic Patterns With DjangoPowerful Generic Patterns With Django
Powerful Generic Patterns With Django
 
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
 
Discovering Django - zekeLabs
Discovering Django - zekeLabsDiscovering Django - zekeLabs
Discovering Django - zekeLabs
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
React django
React djangoReact django
React django
 
Django Frequently Asked Interview Questions
Django Frequently Asked Interview QuestionsDjango Frequently Asked Interview Questions
Django Frequently Asked Interview Questions
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Django design-patterns
Django design-patternsDjango design-patterns
Django design-patterns
 
Using ReactJS in AngularJS
Using ReactJS in AngularJSUsing ReactJS in AngularJS
Using ReactJS in AngularJS
 
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ..."Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
"Paragraphs are more powerful than you can expect" from Vasily Jaremchuk for ...
 

More from successfuloutdo12

More from successfuloutdo12 (11)

| Dogs at Site Today
| Dogs at Site Today| Dogs at Site Today
| Dogs at Site Today
 
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
 
| Dogs at Site Today
| Dogs at Site Today| Dogs at Site Today
| Dogs 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
 
| Cats at Site Today
| Cats at Site Today| Cats at Site Today
| Cats at Site Today
 
Dogs | Dogster
Dogs | DogsterDogs | Dogster
Dogs | Dogster
 
Dogs | Dogster
Dogs | DogsterDogs | Dogster
Dogs | Dogster
 
The I Love Dogs Site
The I Love Dogs SiteThe I Love Dogs Site
The I Love Dogs Site
 
Dogs | Dogster
Dogs | DogsterDogs | Dogster
Dogs | Dogster
 

idlesign/django-sitecats · GitHub

  • 1. idlesign/django-sitecats · GitHub README.rst https://github.com/idlesign/django-sitecats Description 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'])
  • 2. 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. Documentation http://django-sitecats.readthedocs.org/ https://github.com/idlesign/django-sitecats