1

I am writing a method for my model which returns entries (translations) for a specific service.

I am having a problem with request in model, it does not return any data. Why? How to fix this?

class Services(models.Model):
    global_title = models.CharField(max_length=32, null=True, blank=True)
    service_color = models.CharField(max_length=32)
    service_order = models.PositiveIntegerField(default=0, null=True,blank=True)
    date_added = models.DateTimeField(auto_now_add=True)    
    date_edited = models.DateTimeField(auto_now=True)

    def get_language(self, request):
        return self.servicetranslation_set.filter(language=request.LANGUAGE_CODE)
4

0 回答 0