<commit_before>from django.conf import settings
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import get_callable
from django.core.exceptions import ImproperlyConfigured
from django.conf.urls.defaults import patterns, url#, include
from incuna.db.models import AutoSlugField
from incunafein.admin import editor

from feincms.models import Base

ModelAdmin = get_callable(getattr(settings, 'ARTICLE_MODELADMIN_CLASS', 'django.contrib.admin.ModelAdmin'))

class ArticleManager(models.Manager):

    # A list of filters which are used to determine whether a page is active or not.
    # Extended for example in the datepublisher extension (date-based publishing and
    # un-publishing of pages)
    active_filters = [
        Q(active=True),
        ]

    @classmethod
    def apply_active_filters(cls, queryset, user=None):
        for filt in cls.active_filters:
            if callable(filt):
                queryset = filt(queryset, user)
            else:
                queryset = queryset.filter(filt)

        return queryset

    def active(self, user=None):
        return self.apply_active_filters(self, user=user)


class Article(Base): 
    active = models.BooleanField(_('active'), default=True)

    title = models.CharField(max_length=255)
    slug = AutoSlugField(max_length=255,populate_from="title",help_text='This will be automatically generated from the name',unique=True,editable=True)
    summary = models.TextField(null=True, blank=True)

    class Meta:
        ordering = ['title', ]
        unique_together = []

    objects = ArticleManager()

    urlpatterns = patterns('articles.views',
                           url(r'^(?P<article>[a-z0-9_-]+).html$', 'article_detail', name="article_detail"),
                           url(r'^$', 'article_list', name='article_index'),
                          )
    @classmethod
    def remove_field(cls, f_name):
        # Removes the field form local fields list
        cls._meta.local_fields = [f for f in cls._meta.local_fields if f.name != f_name]

        # Removes the field setter if exists
        if hasattr(cls, f_name):
            delattr(cls, f_name)

    @classmethod
    def register_extension(cls, register_fn):
        register_fn(cls, ArticleAdmin)

    @classmethod<commit_msg>cleaned up formatting and whitespace<commit_after>from django.conf import settings
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import get_callable
from django.core.exceptions import ImproperlyConfigured
from django.conf.urls.defaults import patterns, url#, include
from incuna.db.models import AutoSlugField
from incunafein.admin import editor
from feincms.models import Base

ModelAdmin = get_callable(getattr(settings, 'ARTICLE_MODELADMIN_CLASS', 'django.contrib.admin.ModelAdmin'))

class ArticleManager(models.Manager):

    # A list of filters which are used to determine whether a page is active or not.
    # Extended for example in the datepublisher extension (date-based publishing and
    # un-publishing of pages)
    active_filters = [Q(active=True),]

    @classmethod
    def apply_active_filters(cls, queryset, user=None):
        for filt in cls.active_filters:
            if callable(filt):
                queryset = filt(queryset, user)
            else:
                queryset = queryset.filter(filt)

        return queryset

    def active(self, user=None):
        return self.apply_active_filters(self, user=user)


class Article(Base):
    active = models.BooleanField(_('active'), default=True)

    title = models.CharField(max_length=255)
    slug = AutoSlugField(max_length=255, populate_from="title", help_text='This will be automatically generated from the name', unique=True, editable=True)


    summary = models.TextField(null=True, blank=True)

    class Meta:
        ordering = ['title', ]
        unique_together = []

    objects = ArticleManager()

    urlpatterns = patterns('articles.views',
                           url(r'^(?P<article>[a-z0-9_-]+).html$', 'article_detail', name="article_detail"),
                           url(r'^$', 'article_list', name='article_index'),
                          )
    @classmethod
    def remove_field(cls, f_name):
        # Removes the field form local fields list
        cls._meta.local_fields = [f for f in cls._meta.local_fields if f.name != f_name]

        # Removes the field setter if exists
        if hasattr(cls, f_name):
            delattr(cls, f_name)

    @classmethod
    def register_extension(cls, register_fn):
        register_fn(cls, ArticleAdmin)

    @classmethod
{'fraction_non_alphanumeric': 0.09315068493150686, 'fraction_numerical': 0.0033719704952581667, 'mean_word_length': 3.137750653879686, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5729055', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1344, 'n_words': 361}