<commit_before># -*- encoding: utf-8 -*-
############################################################################################
#
#    Zoook e-sale for OpenERP, Open Source Management Solution	
#    Copyright (C) 2011 Zikzakmedia S.L. (<http://www.zikzakmedia.com>). All Rights Reserved
#    $Id$
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
############################################################################################

from django.db import models

from django.utils.translation import ugettext_lazy as _
from django.utils.translation import get_language
from transmeta import TransMeta

from transurl import catalog_url, product_url

'''OpenERP Models'''
class ProductCategory(models.Model):
    """ProductCategory OpenERP"""
    __metaclass__ = TransMeta

    name = models.CharField(_('Name'), max_length=128)
    description = models.TextField(_('Description'), null=True, blank=True)
    slug = models.SlugField(_('slug'), max_length=128, help_text=_("This is a unique identifier that allows your contents to display its detail view, ex 'how-can-i-contribute'"), unique=True)
    fslug = models.CharField(_('Full Slug'), max_length=256, null=True, blank=True)
    metatitle = models.CharField(_('Title'), max_length=128, null=True, blank=True)
    metakeyword = models.TextField(_('Keyword'), null=True, blank=True)
    metadescription = models.TextField(_('Description'), null=True, blank=True)
    AVAILABLE_SORT_BY_CHOICES = (
        ('default', 'Use Config Settings'),
        ('position', 'Best Value'),
        ('name', 'Name'),
        ('price', 'Price')
    )
    available_sort_by = models.CharField(_('Available Product Listing (Sort By)'), choices=AVAILABLE_SORT_BY_CHOICES, default='default', max_length=40)
    DEFAULT_SORT_BY_CHOICES = (
        ('default', 'Use Config Settings'),
        ('position', 'Best Value'),
        ('name', 'Name'),
        ('price', 'Price')
    )
    default_sort_by = models.CharField(_('Default Product Listing Sort (Sort By)'), choices=DEFAULT_SORT_BY_CHOICES,  default='default', max_length=40)
    status = models.BooleanField(_('Status'), default=False)
    parent = models.ForeignKey('ProductCategory', null=True, blank=True)
    sequence = models.IntegerField(_('Sequence'), null=True, blank=True)

    class Meta:
        db_table = 'product_category'
        verbose_name = _('category')
        verbose_name_plural = _('categories')
        translate = (
            'name',
            'description',
            'slug',
            'fslug',
            'metatitle',
            'metakeyword',
            'metadescription',
            )

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        return '/%s/%s/%s/' % (get_language(), catalog_url[get_language()], self.fslug)
<commit_msg>[FIX] Catalog get_absolute_url: without / end slug<commit_after># -*- encoding: utf-8 -*-
############################################################################################
#
#    Zoook e-sale for OpenERP, Open Source Management Solution	
#    Copyright (C) 2011 Zikzakmedia S.L. (<http://www.zikzakmedia.com>). All Rights Reserved
#    $Id$
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
############################################################################################

from django.db import models

from django.utils.translation import ugettext_lazy as _
from django.utils.translation import get_language
from transmeta import TransMeta

from transurl import catalog_url, product_url

'''OpenERP Models'''
class ProductCategory(models.Model):
    """ProductCategory OpenERP"""
    __metaclass__ = TransMeta

    name = models.CharField(_('Name'), max_length=128)
    description = models.TextField(_('Description'), null=True, blank=True)
    slug = models.SlugField(_('slug'), max_length=128, help_text=_("This is a unique identifier that allows your contents to display its detail view, ex 'how-can-i-contribute'"), unique=True)
    fslug = models.CharField(_('Full Slug'), max_length=256, null=True, blank=True)
    metatitle = models.CharField(_('Title'), max_length=128, null=True, blank=True)
    metakeyword = models.TextField(_('Keyword'), null=True, blank=True)
    metadescription = models.TextField(_('Description'), null=True, blank=True)
    AVAILABLE_SORT_BY_CHOICES = (
        ('default', 'Use Config Settings'),
        ('position', 'Best Value'),
        ('name', 'Name'),
        ('price', 'Price')
    )
    available_sort_by = models.CharField(_('Available Product Listing (Sort By)'), choices=AVAILABLE_SORT_BY_CHOICES, default='default', max_length=40)
    DEFAULT_SORT_BY_CHOICES = (
        ('default', 'Use Config Settings'),
        ('position', 'Best Value'),
        ('name', 'Name'),
        ('price', 'Price')
    )
    default_sort_by = models.CharField(_('Default Product Listing Sort (Sort By)'), choices=DEFAULT_SORT_BY_CHOICES,  default='default', max_length=40)
    status = models.BooleanField(_('Status'), default=False)
    parent = models.ForeignKey('ProductCategory', null=True, blank=True)
    sequence = models.IntegerField(_('Sequence'), null=True, blank=True)

    class Meta:
        db_table = 'product_category'
        verbose_name = _('category')
        verbose_name_plural = _('categories')
        translate = (
            'name',
            'description',
            'slug',
            'fslug',
            'metatitle',
            'metakeyword',
            'metadescription',
            )

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        return '/%s/%s/%s' % (get_language(), catalog_url[get_language()], self.fslug)

{'fraction_non_alphanumeric': 0.16792234135033324, 'fraction_numerical': 0.006374963778614894, 'mean_word_length': 3.7639751552795033, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2833543', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1904, 'n_words': 559}