# Path: aldryn_blog/models.py
# AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
# class CategoryManager(TranslationManager):
# class Category(TranslatableModel):
#     class Meta:
# class RelatedManager(models.Manager):
# class PublishedManager(RelatedManager):
# class Post(models.Model):
#     class Meta:
# class LatestEntriesPlugin(CMSPlugin):
# class AuthorsPlugin(CMSPlugin):
#     def get_with_usage_count(self, language=None, **kwargs):
#     def __unicode__(self):
#     def get_absolute_url(self, language=None):
#     def get_query_set(self):
#     def filter_by_language(self, language):
#     def filter_by_current_language(self):
#     def get_tags(self, entries=None, language=None):
#     def get_categories(self, language=None):
#     def get_months(self, language):
#     def get_query_set(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def save(self, **kwargs):
#     def get_author_slug(self):
#     def __unicode__(self):
#     def copy_relations(self, oldinstance):
#     def get_posts(self):
#     def get_authors(self):
# def force_language(sender, instance, **kwargs):
# 
# Path: aldryn_blog/forms.py
# class LatestEntriesForm(forms.ModelForm):
# 
#     class Meta:
# 
#         widgets = {
#             'tags': django_select2.Select2MultipleWidget
#         }


from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from aldryn_blog import models
from aldryn_blog.forms import LatestEntriesForm
class BlogTagsPlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/tags.html'
    name = _('Tags')
    model = CMSPlugin

    def render(self, context, instance, placeholder):
        context['tags'] = models.Post.published.get_tags(language=instance.language)
        return context


class BlogCategoriesPlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/categories.html'
    name = _('Categories')
    model = CMSPlugin

    def render(self, context, instance, placeholder):
        context['categories'] = models.Post.published.get_categories(
            language=instance.language)
        return context


class BlogArchivePlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/archive.html'
    name = _('Archive')
    model = CMSPlugin

    def render(self, context, instance, placeholder):

# Path: aldryn_blog/models.py
# AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
# class CategoryManager(TranslationManager):
# class Category(TranslatableModel):
#     class Meta:
# class RelatedManager(models.Manager):
# class PublishedManager(RelatedManager):
# class Post(models.Model):
#     class Meta:
# class LatestEntriesPlugin(CMSPlugin):
# class AuthorsPlugin(CMSPlugin):
#     def get_with_usage_count(self, language=None, **kwargs):
#     def __unicode__(self):
#     def get_absolute_url(self, language=None):
#     def get_query_set(self):
#     def filter_by_language(self, language):
#     def filter_by_current_language(self):
#     def get_tags(self, entries=None, language=None):
#     def get_categories(self, language=None):
#     def get_months(self, language):
#     def get_query_set(self):
#     def __unicode__(self):
#     def get_absolute_url(self):
#     def save(self, **kwargs):
#     def get_author_slug(self):
#     def __unicode__(self):
#     def copy_relations(self, oldinstance):
#     def get_posts(self):
#     def get_authors(self):
# def force_language(sender, instance, **kwargs):
# 
# Path: aldryn_blog/forms.py
# class LatestEntriesForm(forms.ModelForm):
# 
#     class Meta:
# 
#         widgets = {
#             'tags': django_select2.Select2MultipleWidget
#         }


# Path: aldryn_blog/cms_plugins.py
from django.utils.translation import ugettext_lazy as _
from cms.models.pluginmodel import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from aldryn_blog import models
from aldryn_blog.forms import LatestEntriesForm

class BlogTagsPlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/tags.html'
    name = _('Tags')
    model = CMSPlugin

    def render(self, context, instance, placeholder):
        context['tags'] = models.Post.published.get_tags(language=instance.language)
        return context


class BlogCategoriesPlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/categories.html'
    name = _('Categories')
    model = CMSPlugin

    def render(self, context, instance, placeholder):
        context['categories'] = models.Post.published.get_categories(
            language=instance.language)
        return context


class BlogArchivePlugin(BlogPlugin):

    render_template = 'aldryn_blog/plugins/archive.html'
    name = _('Archive')
    model = CMSPlugin

    def render(self, context, instance, placeholder):

        context['dates'] = models.Post.published.get_months(language=instance.language)