<commit_before>from django.db import models
from datetime import datetime
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from managers import QuestionManager
import enums

class FaqBase(models.Model):
    '''
    Base class for models.
    
    '''
    created_by = models.ForeignKey(User, null=True, editable=False, related_name="%(class)s_created_by" )    
    created_on = models.DateTimeField( _('created on'), default=datetime.now, editable=False,  )
    updated_on = models.DateTimeField( _('updated on'), editable=False )
    updated_by = models.ForeignKey(User, null=True, editable=False )  
    
    class Meta:
        abstract = True

class Question(FaqBase):
    """
    Represents a frequently asked question.

    """

    slug = models.SlugField( max_length=100, help_text="This is a unique identifier that allows your questions to display its detail view, ex 'how-can-i-contribute'", )
    text = models.TextField(_('question'), help_text='The actual question itself.')
    status = models.IntegerField( choices=enums.QUESTION_STATUS_CHOICES, default=enums.STATUS_INACTIVE, help_text="Only questions with their status set to 'Active' will be displayed. " )
    order = models.IntegerField(_('order'), help_text='The order you would like the question to be displayed')

    objects = QuestionManager()
    
    class Meta:
        ordering = ['order',]

    def __unicode__(self):
        return self.text

    def save(self):
        self.updated_on = datetime.now()
        super(Question, self).save()
        

class Answer(FaqBase):
    """
    Represents an answer to a frequently asked question.

    """
    question = models.ForeignKey(Question, unique=True, help_text='What question is this answer associated to?', )
    text = models.TextField( _('answer'), help_text='The answer text.' )

    def __unicode__(self):
        return self.text
        
    def save(self):
        self.updated_on = datetime.now()
        super(Answer, self).save()
<commit_msg>added an order field to the Question model<commit_after>from django.db import models
from datetime import datetime
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from managers import QuestionManager
import enums

class FaqBase(models.Model):
    '''
    Base class for models.
    
    '''
    created_by = models.ForeignKey(User, null=True, editable=False, related_name="%(class)s_created_by" )    
    created_on = models.DateTimeField( _('created on'), default=datetime.now, editable=False,  )
    updated_on = models.DateTimeField( _('updated on'), editable=False )
    updated_by = models.ForeignKey(User, null=True, editable=False )  
    
    class Meta:
        abstract = True

class Question(FaqBase):
    """
    Represents a frequently asked question.

    """

    slug = models.SlugField( max_length=100, help_text="This is a unique identifier that allows your questions to display its detail view, ex 'how-can-i-contribute'", )
    text = models.TextField(_('question'), help_text='The actual question itself.')
    status = models.IntegerField( choices=enums.QUESTION_STATUS_CHOICES, default=enums.STATUS_INACTIVE, help_text="Only questions with their status set to 'Active' will be displayed. " )
    order = models.IntegerField(_('order'), help_text='The order you would like the question to be displayed.')

    objects = QuestionManager()
    
    class Meta:
        ordering = ['order',]

    def __unicode__(self):
        return self.text

    def save(self):
        self.updated_on = datetime.now()
        super(Question, self).save()
        

class Answer(FaqBase):
    """
    Represents an answer to a frequently asked question.

    """
    question = models.ForeignKey(Question, unique=True, help_text='What question is this answer associated to?', )
    text = models.TextField( _('answer'), help_text='The answer text.' )

    def __unicode__(self):
        return self.text
        
    def save(self):
        self.updated_on = datetime.now()
        super(Answer, self).save()

{'fraction_non_alphanumeric': 0.10594252313687287, 'fraction_numerical': 0.0014612761811982464, 'mean_word_length': 3.5181518151815183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4757961', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1144, 'n_words': 335}