[Fixed]-Django-views Custom filter

1👍

Not sure what you mean by only django views, I assume you want to use querysets. Your question is poorly written – read this.

class Book(models.Model):
    title = models.CharField(max_length=200)
    date = models.DateTimeField()
    author = models.ForeignKey(Author)


class Author(models.Model):
    name = models.CharField(max_length=200)

And Queryset would be something like this.

books = Book.objects.filter(author__name=authors_name, 
                            date__range=["2011-01-01", "2011-01-31"])

Leave a comment