Django timing

75 views
Skip to first unread message

Pelumi Michael

unread,
Sep 9, 2022, 9:41:00 AM9/9/22
to Django developers (Contributions to Django itself)
Hello. I was developing an instagram clone website but got a problem when I wanted to add timing to the post, timing like "2 minutes ago", "just now" etc. I searched through the internet I couldn't get the right solution (I don't know if there is solution for it yet). Then I decided to go on a journey of solving the problem myself, which I did and I will like to share the codes with the community for review and improvements (if any). I have no idea where to do that, I will love to get a reply soon because I cannot wait to contribute to django. I am also ready to give full detail of the code and how to use. 

Bhuvnesh Sharma

unread,
Sep 9, 2022, 9:50:18 AM9/9/22
to Django developers (Contributions to Django itself)
Hi, 
if you are using templates then you can simply write: 

<span class="thread__date">{{message.created|timesince}} ago</span>

where created is a field of message storing the date and time when the message was created.

created =  models.DateTimeField(auto_now_add=True)


Adam Johnson

unread,
Sep 9, 2022, 10:02:21 AM9/9/22
to Django developers (Contributions to Django itself)
Hi!

I think you've found the wrong mailing list for this post. This mailing list is for discussing the development of Django itself, not for support using Django. This means the discussions of bugs and features in Django itself, rather than in your code using it. People on this list are unlikely to answer your support query with their limited time and energy.

For support, please follow the "Getting Help" page: https://docs.djangoproject.com/en/stable/faq/help/ . This will help you find people who are willing to support you, and to ask your question in a way that makes it easy for them to answer.

Thanks for your understanding and all the best,

Adam

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/664a2283-be6d-49db-9316-7940b013297fn%40googlegroups.com.

David Sanders

unread,
Sep 9, 2022, 10:08:05 AM9/9/22
to django-d...@googlegroups.com
Hi Pelumi,

It's kind of you to offer code, however there is a similar functionality in contrib.humanize: https://docs.djangoproject.com/en/4.1/ref/contrib/humanize/#naturaltime

Perhaps this does what you require?

--
David

--

Abbos Hakimov

unread,
Sep 9, 2022, 3:20:23 PM9/9/22
to django-d...@googlegroups.com
Hi Bro can you help me  i need big django projects as used generic views how i can find the source I need samples compare to my projects

Abbos Hakimov

unread,
Sep 9, 2022, 3:21:21 PM9/9/22
to django-d...@googlegroups.com
if you are creating an instagram clone I will gladly help you if you want

On Fri, 9 Sept 2022, 6:40 pm Pelumi Michael, <pmicha...@gmail.com> wrote:
Hello. I was developing an instagram clone website but got a problem when I wanted to add timing to the post, timing like "2 minutes ago", "just now" etc. I searched through the internet I couldn't get the right solution (I don't know if there is solution for it yet). Then I decided to go on a journey of solving the problem myself, which I did and I will like to share the codes with the community for review and improvements (if any). I have no idea where to do that, I will love to get a reply soon because I cannot wait to contribute to django. I am also ready to give full detail of the code and how to use. 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.

Pelumi Michael

unread,
Sep 9, 2022, 3:43:30 PM9/9/22
to django-d...@googlegroups.com
Hello thank you for the replies. The solution you mentioned is for someone using the template, the solution I am offering is just a function, I don't know if I can copy the code here for you to see and review. 

Pelumi Michael

unread,
Sep 9, 2022, 3:43:30 PM9/9/22
to django-d...@googlegroups.com
I can connect with you on GitHub for use or work on it together 

On Fri, Sep 9, 2022, 3:08 PM David Sanders <shang.xia...@gmail.com> wrote:

Abbos Hakimov

unread,
Sep 10, 2022, 12:20:38 PM9/10/22
to django-d...@googlegroups.com
This is my github name KhakimovSoftware 

Reply all
Reply to author
Forward
0 new messages