How to track and manage pages a user visits in Django (History App).

  Рет қаралды 17,745

Emmanuel Okiche

Emmanuel Okiche

Күн бұрын

Пікірлер: 40
@shobabestan6453
@shobabestan6453 Жыл бұрын
How did you make history app?
@nabeelalawadhi6283
@nabeelalawadhi6283 4 жыл бұрын
Thank you so much. Very clear tutorial
@fleepgeek
@fleepgeek 4 жыл бұрын
I'm glad you liked it
@thebestandweirdthings1660
@thebestandweirdthings1660 4 жыл бұрын
Nice job!
@fleepgeek
@fleepgeek 4 жыл бұрын
Thanks! I'm glad you liked it
@cmj3153
@cmj3153 4 жыл бұрын
hi i am getting error in blog detail page when user not logged in TypeError at /blog/What is Lorem Ipsum 'AnonymousUser' object is not iterable how to avoid this?
@fleepgeek
@fleepgeek 4 жыл бұрын
At 16:16 i added a check in the mixin for authenticated users so you shouldn't get that error. Try cross check your code.
@michaelarthurholloway9539
@michaelarthurholloway9539 2 жыл бұрын
Genuine question: why use Signals and custom Mixins for this example? Instead of importing the custom mixin across apps, you could just import the History model itself, and create instances of it as needed inside the get_object() method of your class-based views. This way, you don't need to use Signals (which are arguably problematic, anyway) and you also don't need to create a custom Mixin... Seems easier / cleaner to me, unless I'm missing something? The only 'required' thing here is ContentTypes + Generic ForeignKey; the rest seems more complex than actually necessary, unless you are specifically avoiding importing the History model into your other apps for some reason (it wouldn't be a circular import, since the History model doesn't import any other models, the whole point being that its relations will be 'generic'....)
@fleepgeek
@fleepgeek 2 жыл бұрын
Thanks for the question. My tutorial showed you one way of the doing it. Your comment shows another way of doing it. I prefer my method and i have no issues with signals. Also, we think differently and this is what i came up with. Thanks for the comment. I'm glad the video made you think of other ways you could achieve this. All the best :]
@moslihtaha-yassine4211
@moslihtaha-yassine4211 3 жыл бұрын
how could I track ListView using mixins like what you do in this tuto and it is a great tuto. and there is a way tou get same result using views based on functions?
@fleepgeek
@fleepgeek 3 жыл бұрын
Maybe decorators could do it but i haven't tried it out.
@johnandrew721
@johnandrew721 6 жыл бұрын
@Emmanuel Okiche, does this mean I have to build a History App first and only then will I be able to make use of recommendations and suggestions using Machine Learning?
@fleepgeek
@fleepgeek 6 жыл бұрын
No. You must not build a history app first. There are different ways to achieve this but most importantly, you have to feed your recommendation system some data for it to give recommendations. This data could be stored could be product ids stored somewhere maybe in a session, localstorage or in the db just like the history app.
@saedetohidi1847
@saedetohidi1847 4 жыл бұрын
how i can use it with function base view?
@fleepgeek
@fleepgeek 4 жыл бұрын
You could use decoratiors instead of mixins.
@johnandrew721
@johnandrew721 6 жыл бұрын
Could you make a tutorial on how to track the number of times an IP address has visited my site? Is there a plugin for this or do I have to create a Python file that manually does this then passes data as a dictionary to the views? The idea in mind is to prompt the user if they wanna be a permanent member, after the user has, say, bought several items from my site.
@fleepgeek
@fleepgeek 6 жыл бұрын
My tutorial on preventing multiple user login could give you an idea on how to achieve this. The main idea is to have a model that stores the ip then you use a middleware to check if the current ip is in your db then increment the count. Just checkout the tutorial. I believe it would be helpful for this. All the best
@johnandrew721
@johnandrew721 6 жыл бұрын
@@fleepgeek Thanks bro. I've already downloaded it and will watch it as soon as I'm done with Django Auth customization. I'll give you the feedback!
@johnandrew721
@johnandrew721 6 жыл бұрын
@@fleepgeek Okay, now it's time to put this to the test. It totally makes sense now that I've seen the video on Preventing Multiple Device Login.
@sudipbala9647
@sudipbala9647 4 жыл бұрын
can i use this to keep track of data edited in a model as record to view no. of times edited and also the previos state after editing?
@fleepgeek
@fleepgeek 4 жыл бұрын
Hmmm...you can use some of the logic to store the num of times edited but a simpler way would be to add a field to the model that tracks th e edit count ans increment it whenever the data changes. i think the Django admin keeps track of the previous state. The previous state logic would be something like making a post model something like a category model. So every new edit is a new insert into the post group. So the edit count would be total post in the category - 1 Check to confirm if Django admin does this.
@iramshahzadi4233
@iramshahzadi4233 5 жыл бұрын
code is not working, no records r showing in history...:(
@fleepgeek
@fleepgeek 5 жыл бұрын
Code is working, records r showing in history...lol Okay seriously, you're might be doing something wrong. Did you follow the video step by step?
@iramshahzadi4233
@iramshahzadi4233 5 жыл бұрын
@@fleepgeek no, i run the downloaded code as it is. Sir can uh suggest the possible mistake , that i have made.
@fleepgeek
@fleepgeek 5 жыл бұрын
@@iramshahzadi4233 yes of course. I'm here to help. The mistake you made was refusing to watch the video and follow step by step.
@isaacbamidele9899
@isaacbamidele9899 6 жыл бұрын
Thank you so much Emmanuel
@fleepgeek
@fleepgeek 6 жыл бұрын
You're welcome. Don't forget to share and subscribe. More django tutorials coming soon.
@milamenda8511
@milamenda8511 5 жыл бұрын
@Emmanuel Okiche Thanks for this tutorial it really helped me a lot on a very important project. However, I am facing a problem. I am able to see the History page on admin, but it keeps remaining empty. You included ObjectViewMixin on Post Detail View. However my project’s views are all FBV and I am not able to change them because of the concept of the website. Could you please help me to solve this problem? How could I make this tutorial work on my FBV? Thanks a lot!
@fleepgeek
@fleepgeek 5 жыл бұрын
I'm glad you found it helpful. You could use a decorator instead of a mixin to achieve the same effect using a FBV. Just study how i implementated the mixin and use the same concept for the decorator.
@fleepgeek
@fleepgeek 5 жыл бұрын
Secondly, a CBV can always replace a FBV no mattet the concept of the site. You just have to dig deep and understand how CBV works. I have a CBV course on my channel. All the best
@johnandrew721
@johnandrew721 6 жыл бұрын
The video on preventing multiple logins was a success!! @Emmanuel Okiche.. So, you were saying?? About tracking how many times a visitor has bought something from my site and to notify him/her after, say, 5 transactions, if he/she wants to be a permanent member.
@medinimedini7168
@medinimedini7168 6 жыл бұрын
source code please
@fleepgeek
@fleepgeek 6 жыл бұрын
github.com/fleepgeek/django-history-app
@vickytuite8261
@vickytuite8261 2 жыл бұрын
Please use larger fonts. It is really hard to read. I'm not a fan of dark mode, but it would be better if the fonts were larger.
@fleepgeek
@fleepgeek 2 жыл бұрын
Thanks for the feedback. Would work on that :]
Prevent Multiple Device Login for a User in Django 2 using Middleware
26:28
Learn Django - Build a Custom User Model with Extended Fields
39:42
Learn Django - Build an Asynchronous Chatroom with Django and Channels
1:31:27
Learn the basics of Django's Model Managers and Querysets
19:38
Matt Freire
Рет қаралды 45 М.
Django + Chart.js // Learn to intergrate Chart.js with Django
26:45
CodingEntrepreneurs
Рет қаралды 232 М.
How to Track User Activity through Django Login
13:28
Yiqing Lan
Рет қаралды 12 М.
How to create a like button with counter in django
36:04
Pyplane
Рет қаралды 24 М.
Creating a Machine Learning Based App in Django Complete tutorial 2020
57:49
Technology for Noobs
Рет қаралды 81 М.
Custom Django User Model // DJANGO Tutorial
1:04:40
CodingEntrepreneurs
Рет қаралды 157 М.
Django live search | live search using django and javascript
20:07