# Path: translations/models.py
# class Translation(models.Model):
# 
#     msgstr = models.TextField(max_length=1000)
#     revisiondate = models.DateTimeField(blank=True, null=True)
#     translated = models.BooleanField()
#     standardized = models.NullBooleanField(default=False, blank=True, null=True)
# 
#     created = models.DateField(auto_now_add=True)
#     last_modified = models.DateField(auto_now=True)
# 
#     language = models.ForeignKey(Language, db_index=True)
#     package = models.ForeignKey(Package, db_index=True)
# 
#     def __unicode_(self):
#         return self.msgstr.encode("utf-8")


from django.core.urlresolvers import reverse
from django.db import models
from translations.models import Translation
        from datetime import timedelta
        return self.translation_set.all()

    @property
    def translations_by_language(self):
        return [(l, Translation.objects.filter(package=self,
                language=l).count()) for l in self.languages]

    def get_absolute_url(self):
        return reverse('package_detail', args=[self.name])


class Language(models.Model):

    long_name = models.CharField(max_length=255, blank=True, null=True)
    short_name = models.CharField(max_length=30)

    def __unicode__(self):
        return "%s (%s)" % (self.long_name, self.short_name) if self.long_name else self.short_name

class Sentence(models.Model):

    msgid = models.TextField(max_length=1000)
    translated = models.BooleanField()
    length = models.IntegerField(blank=True, null=True)
    flags = models.CharField(max_length=255, blank=True, null=True)


    def __unicode__(self):
        return self.msgid


# Path: translations/models.py
# class Translation(models.Model):
# 
#     msgstr = models.TextField(max_length=1000)
#     revisiondate = models.DateTimeField(blank=True, null=True)
#     translated = models.BooleanField()
#     standardized = models.NullBooleanField(default=False, blank=True, null=True)
# 
#     created = models.DateField(auto_now_add=True)
#     last_modified = models.DateField(auto_now=True)
# 
#     language = models.ForeignKey(Language, db_index=True)
#     package = models.ForeignKey(Package, db_index=True)
# 
#     def __unicode_(self):
#         return self.msgstr.encode("utf-8")


# Path: core/models.py
from django.core.urlresolvers import reverse
from django.db import models
from translations.models import Translation
        from datetime import timedelta

        return self.translation_set.all()

    @property
    def translations_by_language(self):
        return [(l, Translation.objects.filter(package=self,
                language=l).count()) for l in self.languages]

    def get_absolute_url(self):
        return reverse('package_detail', args=[self.name])


class Language(models.Model):

    long_name = models.CharField(max_length=255, blank=True, null=True)
    short_name = models.CharField(max_length=30)

    def __unicode__(self):
        return "%s (%s)" % (self.long_name, self.short_name) if self.long_name else self.short_name

class Sentence(models.Model):

    msgid = models.TextField(max_length=1000)
    translated = models.BooleanField()
    length = models.IntegerField(blank=True, null=True)
    flags = models.CharField(max_length=255, blank=True, null=True)


    def __unicode__(self):
        return self.msgid


class Translation(models.Model):