mardi 9 avril 2019

check date_join of user with specific datetime

im new in python and django. i want check user.date_join with specific datetime but i dont know what is correct syntax.

for more information : i have a SignIn function in view.py and i want check if user.date_join < yyyy/mm/dd i do something .

view.py:

from datetime import datetime
from django.contrib.auth.models import User

if request.method == "POST":
    if request.user.is_authenticated:
        if user.date_joined < (yyyy/mm/dd):  # <==== here i have problem
                       #do smt
        else:
           #do smt
    else:
      #blah blah
else:
   #blah blah

Aucun commentaire:

Enregistrer un commentaire