# Path: cms_content/models.py
# class CMSCategory(models.Model):
#     """Models for CMS's Categories:
# 
#     Category is the second level of cms_content structure. Before publish any
#     articles, you should create a category.
#     """
# 
#     name = models.CharField(
#         _(u"Category Name"),
#         max_length=255,
#         blank=False,
#         help_text=_(u"Category's Name"),
#     )
#     slug = models.SlugField(
#         _(u"Slug"),
#         max_length=255,
#         blank=False,
#         unique=True,
#         help_text=_(u"Category's Slug"),
#     )
#     section = models.ForeignKey(
#         CMSSection,
#         verbose_name=_(u"Section"),
#         related_name="category_of_section",
#         blank=False,
#         help_text=_(u"Pick a Section Used as the Category's Parent Level"),
#     )
#     description = models.TextField(
#         _(u"Category Description"),
#         blank=False,
#         help_text=_(u"Your Category Description")
#     )
#     image = models.ImageField(
#         _(u"Image"),
#         upload_to=UPLOAD_TO,
#         blank=True,
#         help_text=_(u"Category Image Display in Pages"),
#     )
#     created_date = models.DateTimeField(
#         _(u"Create Time"),
#         auto_now_add=True,
#     )
#     menu = models.OneToOneField(CMSMenuID)
# 
#     def __unicode__(self):
#         return self.name
# 
#     class Meta:
#         ordering = ['-created_date']
#         verbose_name = _(u'Category')
#         verbose_name_plural = _(u'Category')
# 
#     @property
#     def url(self):
#         return "%s%s/%s/" % (ROOT_URL, 'category', self.slug)
#     
#     @models.permalink
#     def get_absolute_url(self):
#         return ("cms_content_category_detail", (self.slug,))


from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from cms.models import CMSPlugin
from cms_content.models import CMSCategory
# -*- coding: utf-8 -*-




TEMPLATES = [
    ('cms_content/plugins/latest_article.html', 'latest articles'),
    ('cms_content/plugins/tophit_article.html', 'tophit articles'),
]

class LatestArticle(CMSPlugin):
    """
    This model will save latest articles' id for plugin
    """


# Path: cms_content/models.py
# class CMSCategory(models.Model):
#     """Models for CMS's Categories:
# 
#     Category is the second level of cms_content structure. Before publish any
#     articles, you should create a category.
#     """
# 
#     name = models.CharField(
#         _(u"Category Name"),
#         max_length=255,
#         blank=False,
#         help_text=_(u"Category's Name"),
#     )
#     slug = models.SlugField(
#         _(u"Slug"),
#         max_length=255,
#         blank=False,
#         unique=True,
#         help_text=_(u"Category's Slug"),
#     )
#     section = models.ForeignKey(
#         CMSSection,
#         verbose_name=_(u"Section"),
#         related_name="category_of_section",
#         blank=False,
#         help_text=_(u"Pick a Section Used as the Category's Parent Level"),
#     )
#     description = models.TextField(
#         _(u"Category Description"),
#         blank=False,
#         help_text=_(u"Your Category Description")
#     )
#     image = models.ImageField(
#         _(u"Image"),
#         upload_to=UPLOAD_TO,
#         blank=True,
#         help_text=_(u"Category Image Display in Pages"),
#     )
#     created_date = models.DateTimeField(
#         _(u"Create Time"),
#         auto_now_add=True,
#     )
#     menu = models.OneToOneField(CMSMenuID)
# 
#     def __unicode__(self):
#         return self.name
# 
#     class Meta:
#         ordering = ['-created_date']
#         verbose_name = _(u'Category')
#         verbose_name_plural = _(u'Category')
# 
#     @property
#     def url(self):
#         return "%s%s/%s/" % (ROOT_URL, 'category', self.slug)
#     
#     @models.permalink
#     def get_absolute_url(self):
#         return ("cms_content_category_detail", (self.slug,))


# Path: cms_content_patch/plugins/models.py
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from cms.models import CMSPlugin
from cms_content.models import CMSCategory

# -*- coding: utf-8 -*-




TEMPLATES = [
    ('cms_content/plugins/latest_article.html', 'latest articles'),
    ('cms_content/plugins/tophit_article.html', 'tophit articles'),
]

class LatestArticle(CMSPlugin):
    """
    This model will save latest articles' id for plugin
    """


    category = models.ManyToManyField(CMSCategory, verbose_name=_('category'), blank=True)