This is the Django learning repo with rapid development .
Here goes the content for the site .
-
first we create the model using the oops class and str , meta() class
-
We register the model to the admin file
-
We add the app to the settings of the projects.
-
Adding the datefield to the model
-
Migration of the database to the the db.squlite
-
Adding the choice fill for status for the charfield.
-
then migration database.
-
Superuser creation
-
Using the object relation mapper (ORM) creating the queryset .
-
Using the Query set in view we declare the function for the url.
-
Adding get_object_or_404 from django.http
-
create a custom urls.py in django to create the route.
-
Adding the blog app to the mysite project url.
-
Accessing the Django.admin and create a post
-
using a decorater custom admin added which is going to be helpfull for the post when added or updated.
-
Using the Django.auth.models from there User added for the many to one relation author foreign key object.
-
Finally a post is created.
-
Creating the templates for the site to show the structure is- templates ---->blog ---->base.html this will be the main rendering part and have a sidebar to it. which will inherit the list and detail ----> post ----> list.html ----> detail.html
-
Successfully added the published . Going to the 2nd chapter.
-
Adding the cannonical route for the url ---> it workslike we import the reverse method from the django.urls then make function for the get_absoluet_url() in the models then it added in the list.html
-
Adding the seo friendly route for the site. ways to do it is 1. Added the slug field unique by adding the unique='publish' no slug can be added to the database as a same slug name on the same data 2. changing the url for that like - int:year/int:month/int:daypost:slug 3. Now we change the post_detail 4. in models.py have to change the get_absolute_url() have to add year,month,day,slug as parameter.
-
Adding the Paginator for the site. Have to add django.core.paginator import Paginator then according to that have to add page number and then add a paginator html file with checking the if else based upon the posts.