<commit_before>from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

from foirequest.models import FoiRequest


class FeaturedRequestManager(CurrentSiteManager):
    def getFeatured(self):
        try:
            return self.get_query_set().order_by("-timestamp").select_related('request', 'request__publicbody')[0]
        except IndexError:
            return None


class FeaturedRequest(models.Model):
    request = models.ForeignKey(FoiRequest,
            verbose_name=_("Featured Request"))
    timestamp = models.DateTimeField()
    title = models.CharField(max_length=255)
    text = models.TextField()
    url = models.CharField(max_length=255, blank=True)
    user = models.ForeignKey(User, null=True,
            on_delete=models.SET_NULL,
            verbose_name=_("User"))
    site = models.ForeignKey(Site, null=True,
            on_delete=models.SET_NULL, verbose_name=_("Site"))

    objects = FeaturedRequestManager()<commit_msg>Add meta class to FeaturedRequest model<commit_after>from django.db import models
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.contrib.sites.managers import CurrentSiteManager

from foirequest.models import FoiRequest


class FeaturedRequestManager(CurrentSiteManager):
    def getFeatured(self):
        try:
            return self.get_query_set().order_by("-timestamp").select_related('request', 'request__publicbody')[0]
        except IndexError:
            return None


class FeaturedRequest(models.Model):
    request = models.ForeignKey(FoiRequest,
            verbose_name=_("Featured Request"))
    timestamp = models.DateTimeField()
    title = models.CharField(max_length=255)
    text = models.TextField()
    url = models.CharField(max_length=255, blank=True)
    user = models.ForeignKey(User, null=True,
            on_delete=models.SET_NULL,
            verbose_name=_("User"))
    site = models.ForeignKey(Site, null=True,
            on_delete=models.SET_NULL, verbose_name=_("Site"))

    objects = FeaturedRequestManager()

    class Meta:
        ordering = ('-timestamp',)
        get_latest_by = 'timestamp'
        verbose_name = _('Featured Request')
        verbose_name_plural = _('Featured Requests')
{'fraction_non_alphanumeric': 0.09780844155844155, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 3.758687258687259, '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': '1651989', 'n_tokens_mistral': 702, 'n_tokens_neox': 682, 'n_words': 144}