Django. Python. How to get current user's activity log? -


i need pass current user's entire activity log html page, seems cannot find helpful solution regarding same.

is possible? if yes, please direct me in right way?

thanks in advance!

update:

i found solution making use of get() call django's logentry model, clueless shall appropriate parameters doing same.

yet update:

i looking way access activity log of particular user django's log entries without saving database

take below listed.....hope help::

    lets example::     create 2 field  in models:       last_activity_ip = models.ipaddressfield()     last_activity_date = models.datetimefield(default = datetime(1960, 1, 1))     user = models.onetoonefield(user, primary_key=true) 

since user , useractivity models related one-to-one can type:

run query this:

a = user.objects.get(username__exact='mpcabd') print a.useractivity.last_activity_ip  b = useractivity.objects.get(user=a) print b.user.username  ** track activity use **      activity = none     try:         activity = request.user.useractivity     except:         activity = useractivity()         activity.user = request.user         activity.last_activity_date = datetime.now()         activity.last_activity_ip = request.meta['remote_addr']         activity.save()         return     activity.last_activity_date = datetime.now()     activity.last_activity_ip = request.meta['remote_addr']     activity.save() 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -