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?
@fleepgeek4 жыл бұрын
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.
@michaelarthurholloway95392 жыл бұрын
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'....)
@fleepgeek2 жыл бұрын
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-yassine42113 жыл бұрын
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?
@fleepgeek3 жыл бұрын
Maybe decorators could do it but i haven't tried it out.
@johnandrew7216 жыл бұрын
@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?
@fleepgeek6 жыл бұрын
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.
@saedetohidi18474 жыл бұрын
how i can use it with function base view?
@fleepgeek4 жыл бұрын
You could use decoratiors instead of mixins.
@johnandrew7216 жыл бұрын
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.
@fleepgeek6 жыл бұрын
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
@johnandrew7216 жыл бұрын
@@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!
@johnandrew7216 жыл бұрын
@@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.
@sudipbala96474 жыл бұрын
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?
@fleepgeek4 жыл бұрын
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.
@iramshahzadi42335 жыл бұрын
code is not working, no records r showing in history...:(
@fleepgeek5 жыл бұрын
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?
@iramshahzadi42335 жыл бұрын
@@fleepgeek no, i run the downloaded code as it is. Sir can uh suggest the possible mistake , that i have made.
@fleepgeek5 жыл бұрын
@@iramshahzadi4233 yes of course. I'm here to help. The mistake you made was refusing to watch the video and follow step by step.
@isaacbamidele98996 жыл бұрын
Thank you so much Emmanuel
@fleepgeek6 жыл бұрын
You're welcome. Don't forget to share and subscribe. More django tutorials coming soon.
@milamenda85115 жыл бұрын
@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!
@fleepgeek5 жыл бұрын
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.
@fleepgeek5 жыл бұрын
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
@johnandrew7216 жыл бұрын
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.
@medinimedini71686 жыл бұрын
source code please
@fleepgeek6 жыл бұрын
github.com/fleepgeek/django-history-app
@vickytuite82612 жыл бұрын
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.