I’m working with content types in feincms. And I want to make a content type that can store filters in the database.
Roughly it would look like this:
from news.models import Entry
class NewsContent(models.Model):
filter = models.CharField()
exclude = models.CharField()
offset = models.IntegerField()
limit = models.IntegerField()
#template = models.CharField()
def get_entries(self):
return Entry.objects.filter(self.filter).exclude(self.exclude)[self.offset:self.limit_upper]
Is this possible?
Now this may or may not be a good idea speed wise, but that’s question #2
You should be able to do that using a dictionary for the filter and exclude fields.
Say you want to add this filter:
then you would store
as a string in your filter field of your NewsContentModel.
then you could do this
I think that should work…