- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Django model object hit counting
In this article, we are going to make a project in which we will see how to make a Django table that will store all the data of hit count and detailed data of hit. It can be used generate useful reports. So, let's get started.
Setup your urls.py and install the django-hitcount module
pip install django-hitcount
In settings.py, add the following line −
INSTALLED_APPS+ = ['hitcount']
Here we added this library as an app in the project.
Run the following commands −
python manage.py makemigrations python manage.py migrate
Here, we create migrations and then we migrate it.
That's all. This library will create a table that will store all the data.
Go to http://127.0.0.1 and login
Hit counts and Hits contain what we wanted, you can explore other two.
- Model object's history tracking in Django
- Add the slug field inside Django Model
- Adding translation to a model instance in Django
- Django model data to JSON data in 2 lines
- How to make any Django model's file downloadable?
- Object-oriented Data Model
- Object-relational Data Model
- Comparison between E-R Model and Object Oriented Model
- Django – Showing model data directly into table with sorting and pagination
- What is a Document Object Model?
- Design Hit Counter in C++
- How to extract the model equation from model object in R?
- Bricks Falling When Hit in C++
- How to create a JSON Object using Object Model in Java?
- Django – Making a contact form and storing its data without model, query and html