Hi,
in VIEWS
def example=(request):
       fm=ExampleModel.object.created_at
     ExMd=ExampleModel.objects.filter(created_at__lt={'fm'})... ordering 
conditions.....

On Friday, January 21, 2022 at 10:25:13 AM UTC+5:30 aadil1...@gmail.com 
wrote:

> class ExampleModel(models.Model):
> is_active = models.BooleanField(default=True)
> created_at = models.DateTimeField(auto_now_add=True)
> updated_at = models.DateTimeField(auto_now=True)
>
>
>
> I want to query on UserModel such that the Query set which I get should be 
> orderable in terms of time difference of updated_at - created_at,
> I tried
> ExampleModel.objects.all().order_by('updated_at' - 'created_at')
> but this is not working
> it throws, *TypeError*: unsupported operand type(s) for -: 'str' and 'str'
>
>
> Django Family Please Help...................
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a75a387e-bb74-4e8a-9e40-c4645f7dd88bn%40googlegroups.com.

Reply via email to