i have a small application i am implementing with django and i'm having a slight challenge. I'm trying to limit the queryset for my relationships within my application by a particular property. Now the catch is, the exact value of the property isn't known until the user logs into the application. an example is limiting a set of comments by a user's particular company, and the company is only determined when the user logs in. I don't know how to find my current session outside a django view. Any help is appreciated. Thanks
Here is a sample of a model from my application
class Tax(commons.models.EntityBase):
name = models.CharField(blank=False, max_length=150)
percentage_value = models.DecimalField(max_digits=4, decimal_places=2)
notes = models.TextField(blank=True, null=True)
auto_apply = models.NullBooleanField()
aggregated_tax = models.NullBooleanField()
def __unicode__(self):
return self.name
Every entity inherits from the abstract class EntityBase
, which holds the property company
. I want to filter every query from the query manager such that they only return entities who's company are equal to the company in the session.