Filter models with created date less than today's date
up vote
-1
down vote
favorite
So i have a model, And i want to filter all models with created date less than today's date .
For example
Class Post(models.Model):
created=model.DateField()
view.py
get_objects_with_date_lessthan_today_date=Post.objects.filter(created=)
In my view i need to filter all objects with created date less than today's date .Please i need help . In going about this logic
python django
add a comment |
up vote
-1
down vote
favorite
So i have a model, And i want to filter all models with created date less than today's date .
For example
Class Post(models.Model):
created=model.DateField()
view.py
get_objects_with_date_lessthan_today_date=Post.objects.filter(created=)
In my view i need to filter all objects with created date less than today's date .Please i need help . In going about this logic
python django
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
So i have a model, And i want to filter all models with created date less than today's date .
For example
Class Post(models.Model):
created=model.DateField()
view.py
get_objects_with_date_lessthan_today_date=Post.objects.filter(created=)
In my view i need to filter all objects with created date less than today's date .Please i need help . In going about this logic
python django
So i have a model, And i want to filter all models with created date less than today's date .
For example
Class Post(models.Model):
created=model.DateField()
view.py
get_objects_with_date_lessthan_today_date=Post.objects.filter(created=)
In my view i need to filter all objects with created date less than today's date .Please i need help . In going about this logic
python django
python django
edited Nov 21 at 15:25
asked Nov 21 at 15:18
john
95
95
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Use the __lt (less than) filter lookup:
from datetime import datetime
Post.objects.filter(created__lt=datetime.today())
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Use the __lt (less than) filter lookup:
from datetime import datetime
Post.objects.filter(created__lt=datetime.today())
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
add a comment |
up vote
0
down vote
Use the __lt (less than) filter lookup:
from datetime import datetime
Post.objects.filter(created__lt=datetime.today())
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
add a comment |
up vote
0
down vote
up vote
0
down vote
Use the __lt (less than) filter lookup:
from datetime import datetime
Post.objects.filter(created__lt=datetime.today())
Use the __lt (less than) filter lookup:
from datetime import datetime
Post.objects.filter(created__lt=datetime.today())
answered Nov 21 at 15:25
schwobaseggl
35k31937
35k31937
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
add a comment |
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
What is the greater than filter function . are all these found in django documentations ? Thanks
– john
Nov 21 at 15:34
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
See the documentation for field lookups
– dirkgroten
Nov 21 at 15:39
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53415179%2ffilter-models-with-created-date-less-than-todays-date%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown