Skip to main content

Posts

Showing posts from September, 2020

Load more button

 As an optional add on, I told students they could add infinite scrolling, pagination, or load more buttons to their index page. I've seen one student work on implementing pagination so far. Most of them skip the add on. Django has an inbuilt paginator class  which I hope to try using on my pet project one day soon. Today, however, a student wanted to use a load more button but was struggling to get it to work. I've briefly looked into it in the past and I knew it involved Javascript, but that was about the extent of my knowledge. I pulled his branch and ran the project. First, I opened up chrome developer tools and I saw a few errors were showing up in the console. And they pointed to the Javascript. Turns out he was using jQuery, but had not included it from a CDN or downloaded it. First problem discovered. Off to a good start.  Next, errors were no longer showing up but nothing was working. All items were visible on the page, which means  a) there wasn't need for a "

Setting up user logins

I've been meaning to experiment with user authentication in Django for awhile now, but I kept putting it off. I finally created a new pet project and decided that user authentication was the first thing I wanted to set up for my project. Django has a built-in User model but the Django documentation highly encourages us to set up a custom user model. Just in case you need to customise it at some point. Even if you have no need for it right now. Looking at the Django documentation was really overwhelming(surprise!) so I looked around for a tutorial I could follow. I've already started a project, so I had to fit whatever tutorial into what I had already set up. The learndjango tutorial(link below) seemed easy enough to follow. Step 1 : Create a 'User' app   Done. Step 2: Create the initial custom user model First, I had to add 'users.apps,UsersConfig' to the INSTALLED_APPS. mainapp/settings.py Next, I had to tell Django to use my custom user model. mainapp/settings