

{"id":98558,"date":"2021-07-24T09:00:02","date_gmt":"2021-07-24T03:30:02","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=98558"},"modified":"2026-06-01T11:58:07","modified_gmt":"2026-06-01T06:28:07","slug":"expense-tracker-python","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/","title":{"rendered":"Python Expense Tracker Project with Source Code"},"content":{"rendered":"<p>Inflow and Outflow record of money can be easily kept with the help of expense tracker. It helps to manage finances. In this project, we will develop an expense tracker that will track our expenses. Let\u2019s start developing the project.<\/p>\n<h3>Python Expense Tracker Project<\/h3>\n<p>In this python django project, we will create an expense tracker that will take details of our expenses. While filling the signup form a person will also need to fill in the details about the income and the amount he\/she wants to save. Some people earn on a daily basis, so their income can also be added on a regular basis. Details of expenses will be shown in the form of a pie chart on a weekly, monthly, and yearly basis. Installation of django is a must to start with the Expense Tracker project.<\/p>\n<h3>Project Prerequisites<\/h3>\n<p>Sound knowledge of django framework, html, css, javascript and python is required before starting this Expense Tracker project of Python.<\/p>\n<h3>Download Python Expense Tracker Project Code<\/h3>\n<p>Download source code of python expense tracker: <a href=\"https:\/\/drive.google.com\/file\/d\/12ap20TpaYAFzsqE_PgJ-FUhhicH8xZSS\/view?usp=drive_link\"><strong>Expense Tracker Project Code<\/strong><\/a><\/p>\n<h3>Project File Structure<\/h3>\n<p>1. Install django framework<br \/>\n2. Create a project and an app<br \/>\n3. Models.py<br \/>\n4. Admin.py<br \/>\n5. Urls.py<br \/>\n6. Views.py<\/p>\n<h4>1. Install django framework:<\/h4>\n<p>To begin with the project, you need to install django on your system. To install django, write the following command on cmd or terminal window.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Pip install django<\/pre>\n<h4>2. Create a project and an app:<\/h4>\n<p>We will create a new project named ExpenseTracker and an app to start the project. Write the following command on the terminal window.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">django-admin startproject ExpenseTracker\r\npython mange.py startapp home\r\n<\/pre>\n<p>Create a template and static folder to store your files. Template folder will contain all the html files. Static folder will contain all the css files ,images and javascript files.<\/p>\n<h4>3. Models.py<\/h4>\n<p>Database connectivity is done with the help of models.py. Create the following models in models.py file in the app of your project.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from django.db import models\r\nfrom django.utils.timezone import now\r\nfrom django.contrib.auth.models import User\r\nfrom django.conf import settings\r\nfrom django.db.models.signals import post_save\r\nfrom django.dispatch import receiver\r\nfrom django.db.models import Sum\r\n#Create your models here.\r\nSELECT_CATEGORY_CHOICES = [\r\n    (\"Food\",\"Food\"),\r\n    (\"Travel\",\"Travel\"),\r\n    (\"Shopping\",\"Shopping\"),\r\n    (\"Necessities\",\"Necessities\"),\r\n    (\"Entertainment\",\"Entertainment\"),\r\n    (\"Other\",\"Other\")\r\n ]\r\nADD_EXPENSE_CHOICES = [\r\n     (\"Expense\",\"Expense\"),\r\n     (\"Income\",\"Income\")\r\n ]\r\nPROFESSION_CHOICES =[\r\n    (\"Employee\",\"Employee\"),\r\n    (\"Business\",\"Business\"),\r\n    (\"Student\",\"Student\"),\r\n    (\"Other\",\"Other\")\r\n]\r\nclass Addmoney_info(models.Model):\r\n    user = models.ForeignKey(User,default = 1, on_delete=models.CASCADE)\r\n    add_money = models.CharField(max_length = 10 , choices = ADD_EXPENSE_CHOICES )\r\n    quantity = models.BigIntegerField()\r\n    Date = models.DateField(default = now)\r\n    Category = models.CharField( max_length = 20, choices = SELECT_CATEGORY_CHOICES , default ='Food')\r\n    class Meta:\r\n        db_table:'addmoney'\r\n        \r\nclass UserProfile(models.Model):\r\n    user = models.OneToOneField(User,on_delete=models.CASCADE)\r\n    profession = models.CharField(max_length = 10, choices=PROFESSION_CHOICES)\r\n    Savings = models.IntegerField( null=True, blank=True)\r\n    income = models.BigIntegerField(null=True, blank=True)\r\n    image = models.ImageField(upload_to='profile_image',blank=True)\r\n    def __str__(self):\r\n       return self.user.username\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>SELECT_CATEGORY_CHOICES , EXPENSE_CHOICES , PROFESSION_CHOICES contain the list of options that will be given while filling the expense form.<\/p>\n<p>a. Foreign key: It establishes many to one relationship.<\/p>\n<p>b. Charfield():It stores small and large size strings in the database.<\/p>\n<p>c. BigIntegerField():It can store numbers from -9223372036854775808 to 9223372036854775807 in the database.<\/p>\n<p>d. Datefield(): It accepts date as input.<\/p>\n<p>e. Integerfield():It stores integer numbers in a database.<\/p>\n<p>f. Imagefield():It stores images in the database.<\/p>\n<h4>4. Admin.py<\/h4>\n<p>It will help register the tables in the database.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Register your models here.\r\nfrom .models import Addmoney_info\r\nFrom django.contrib import admin\r\nclass Addmoney_infoAdmin(admin.ModelAdmin):\r\n    list_display=(\"user\",\"quantity\",\"Date\",\"Category\",\"add_money\")\r\nadmin.site.register(Addmoney_info,Addmoney_infoAdmin)\r\nfrom django.contrib.sessions.models import Session\r\nadmin.site.register(Session)\r\nfrom .models import UserProfile\r\nadmin.site.register(UserProfile)\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><br \/>\nAddmoney_info, UserProfile are the names of the models that we want to register in the database. list_display contains the name of the columns that will be displayed in the database.<\/p>\n<p>To store these models in the database, run the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">python manage.py makemigrations\r\n     python manage.py migrate\r\n<\/pre>\n<p>For accessing the database, create the superuser. To create a superuser run the following command on your terminal window.<\/p>\n<p>python manage.py createsuperuser<\/p>\n<h4>5. Urls.py<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from django.contrib import admin\r\nfrom django.urls import path\r\nfrom django.urls import include\r\nfrom . import views\r\nfrom django.contrib.auth import views as auth_views\r\n \r\nurlpatterns = [\r\n    path('', views.home, name='home'),\r\n    path('index\/', views.index, name='index'),\r\n    path('register\/',views.register,name='register'),\r\n    path('handleSignup\/',views.handleSignup,name='handleSignup'),\r\n    path('handlelogin\/',views.handlelogin,name='handlelogin'),\r\n    path('handleLogout\/',views.handleLogout,name='handleLogout'),\r\n    path('reset_password\/',auth_views.PasswordResetView.as_view(template_name = \"home\/reset_password.html\"),name='reset_password'),\r\n    path('reset_password_sent\/',auth_views.PasswordResetDoneView.as_view(template_name=\"home\/reset_password_sent.html\"),name='password_reset_done'),\r\n    path('reset\/&lt;uidb64&gt;\/&lt;token&gt;\/',auth_views.PasswordResetConfirmView.as_view(template_name =\"home\/password_reset_form.html\"),name='password_reset_confirm'),\r\n    path('reset_password_complete\/',auth_views.PasswordResetView.as_view(template_name =\"home\/password_reset_done.html\"),name='password_reset_complete'),\r\n    path('addmoney\/',views.addmoney,name='addmoney'),\r\n    path('addmoney_submission\/',views.addmoney_submission,name='addmoney_submission'),\r\n    path('charts\/',views.charts,name='charts'),\r\n    path('tables\/',views.tables,name='tables'),\r\n    path('expense_edit\/&lt;int:id&gt;',views.expense_edit,name='expense_edit'),\r\n    path('&lt;int:id&gt;\/addmoney_update\/', views.addmoney_update, name=\"addmoney_update\") ,\r\n    path('expense_delete\/&lt;int:id&gt;',views.expense_delete,name='expense_delete'),\r\n    path('profile\/',views.profile,name = 'profile'),\r\n    path('expense_month\/',views.expense_month, name = 'expense_month'),\r\n    path('stats\/',views.stats, name = 'stats'),\r\n    path('expense_week\/',views.expense_week, name = 'expense_week'),\r\n    path('weekly\/',views.weekly, name = 'weekly'),\r\n    path('check\/',views.check,name=\"check\"),\r\n    path('search\/',views.search,name=\"search\"),\r\n    path('&lt;int:id&gt;\/profile_edit\/',views.profile_edit,name=\"profile_edit\"),\r\n    path('&lt;int:id&gt;\/profile_update\/',views.profile_update,name=\"profile_update\"),\r\n    path('info\/',views.info,name=\"info\"),\r\n    path('info_year\/',views.info_year,name=\"info_year\"),\r\n]\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>These are the names of the urls that we can access. If we try to access urls other than these, it will give an error.<\/p>\n<p>a. path(): It is used to route the url with the functions views in your app folder.<\/p>\n<p>b. include(): An element is returned by it, to include that element in urlpatterns.<\/p>\n<h4>6. Views.py<\/h4>\n<p><strong>a. Importing modules<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from django.shortcuts import render,HttpResponse,redirect\r\nfrom django.contrib import messages\r\nfrom django.contrib.auth import authenticate ,logout\r\nfrom django.contrib.auth import login as dj_login\r\nfrom django.contrib.auth.models import User\r\nfrom .models import Addmoney_info,UserProfile\r\nfrom django.contrib.sessions.models import Session\r\nfrom django.core.paginator import Paginator, EmptyPage , PageNotAnInteger\r\nfrom django.db.models import Sum\r\nfrom django.http import JsonResponse\r\nimport datetime\r\nfrom django.utils import timezone\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>a. Render: It returns the Httpresponse object and combines the template with the dictionary that is mentioned in it.<br \/>\nb. HttpResponse: It displays a text response to the user.<br \/>\nc. Redirect: It redirects the user to the specified url.<br \/>\nd. Messages: It helps to store and display messages to the user on the screen.<br \/>\ne. Authenticate: It verifies the user.<br \/>\nf. User: This model handles authentication as well as authorization.<br \/>\ng. Session: It helps the user to access only their data. Without sessions, every user\u2019s data will be displayed to the user.<br \/>\nh. Paginator: It is used to manage paginated data.<br \/>\ni. datetime:It is used to get the current date and time.<\/p>\n<p><strong>b. Login and Index function<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def home(request):\r\n    if request.session.has_key('is_logged'):\r\n        return redirect('\/index')\r\n    return render(request,'home\/login.html')\r\n   # return HttpResponse('This is home')\r\ndef index(request):\r\n    if request.session.has_key('is_logged'):\r\n        user_id = request.session[\"user_id\"]\r\n        user = User.objects.get(id=user_id)\r\n        addmoney_info = Addmoney_info.objects.filter(user=user).order_by('-Date')\r\n        paginator = Paginator(addmoney_info , 4)\r\n        page_number = request.GET.get('page')\r\n        page_obj = Paginator.get_page(paginator,page_number)\r\n        context = {\r\n            # 'add_info' : addmoney_info,\r\n           'page_obj' : page_obj\r\n        }\r\n    #if request.session.has_key('is_logged'):\r\n        return render(request,'home\/index.html',context)\r\n    return redirect('home')\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>home() is a function that allows the user to access the dashboard once the user is logged in. index() function contains the backend of the dashboard page.<\/p>\n<p>a. filter(): Queryset is filtered by filter().<\/p>\n<p>b. get(): Single unique object can be obtained with get().<\/p>\n<p>c. order_by(): It orders the queryset.<\/p>\n<p><strong>c. Other Functions<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def addmoney(request):\r\n    return render(request,'home\/addmoney.html')\r\n \r\ndef profile(request):\r\n    if request.session.has_key('is_logged'):\r\n        return render(request,'home\/profile.html')\r\n    return redirect('\/home')\r\n \r\ndef profile_edit(request,id):\r\n    if request.session.has_key('is_logged'):\r\n        add = User.objects.get(id=id)\r\n \r\n        return render(request,'home\/profile_edit.html',{'add':add})\r\n    return redirect(\"\/home\")\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>The first function redirects the user to the page where we can enter our expenses and income. profile() function redirects the user to the profile page where information of the user is displayed. profile_edit() redirects to the page where information of the user can be edited. These pages can only be accessed if the user is logged in.<\/p>\n<p><strong>d. Updating Profile<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def profile_update(request,id):\r\n    if request.session.has_key('is_logged'):\r\n        if request.method == \"POST\":\r\n            user = User.objects.get(id=id)\r\n            user.first_name = request.POST[\"fname\"]\r\n            user.last_name = request.POST[\"lname\"]\r\n            user.email = request.POST[\"email\"]\r\n            user.userprofile.Savings = request.POST[\"Savings\"]\r\n            user.userprofile.income = request.POST[\"income\"]\r\n            user.userprofile.profession = request.POST[\"profession\"]\r\n            user.userprofile.save()\r\n            user.save()\r\n            return redirect(\"\/profile\")\r\n    return redirect(\"\/home\")   \r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>profile_update() function performs the backend of the edit profile form. User.objects.get() gets all the information of the user then all the updated information is saved again. This function is performed by save().<\/p>\n<p><strong>e. Signup, Login, and Logout backend:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def handleSignup(request):\r\n    if request.method =='POST':\r\n            # get the post parameters\r\n            uname = request.POST[\"uname\"]\r\n            fname=request.POST[\"fname\"]\r\n            lname=request.POST[\"lname\"]\r\n            email = request.POST[\"email\"]\r\n            profession = request.POST['profession']\r\n            Savings = request.POST['Savings']\r\n            income = request.POST['income']\r\n            pass1 = request.POST[\"pass1\"]\r\n            pass2 = request.POST[\"pass2\"]\r\n            profile = UserProfile(Savings = Savings,profession=profession,income=income)\r\n            # check for errors in input\r\n            if request.method == 'POST':\r\n                try:\r\n                    user_exists = User.objects.get(username=request.POST['uname'])\r\n                    messages.error(request,\" Username already taken, Try something else!!!\")\r\n                    return redirect(\"\/register\")    \r\n                except User.DoesNotExist:\r\n                    if len(uname)&gt;15:\r\n                        messages.error(request,\" Username must be max 15 characters, Please try again\")\r\n                        return redirect(\"\/register\")\r\n            \r\n                    if not uname.isalnum():\r\n                        messages.error(request,\" Username should only contain letters and numbers, Please try again\")\r\n                        return redirect(\"\/register\")\r\n            \r\n                    if pass1 != pass2:\r\n                        messages.error(request,\" Password do not match, Please try again\")\r\n                        return redirect(\"\/register\")\r\n            \r\n            # create the user\r\n            user = User.objects.create_user(uname, email, pass1)\r\n            user.first_name=fname\r\n            user.last_name=lname\r\n            user.email = email\r\n            # profile = UserProfile.objects.all()\r\n \r\n            user.save()\r\n            # p1=profile.save(commit=False)\r\n            profile.user = user\r\n            profile.save()\r\n            messages.success(request,\" Your account has been successfully created\")\r\n            return redirect(\"\/\")\r\n    else:\r\n        return HttpResponse('404 - NOT FOUND ')\r\n    return redirect('\/login')\r\n \r\ndef handlelogin(request):\r\n    if request.method =='POST':\r\n        # get the post parameters\r\n        loginuname = request.POST[\"loginuname\"]\r\n        loginpassword1=request.POST[\"loginpassword1\"]\r\n        user = authenticate(username=loginuname, password=loginpassword1)\r\n        if user is not None:\r\n            dj_login(request, user)\r\n            request.session['is_logged'] = True\r\n            user = request.user.id \r\n            request.session[\"user_id\"] = user\r\n            messages.success(request, \" Successfully logged in\")\r\n            return redirect('\/index')\r\n        else:\r\n            messages.error(request,\" Invalid Credentials, Please try again\")  \r\n            return redirect(\"\/\")  \r\n    return HttpResponse('404-not found')\r\ndef handleLogout(request):\r\n        del request.session['is_logged']\r\n        del request.session[\"user_id\"] \r\n        logout(request)\r\n        messages.success(request, \" Successfully logged out\")\r\n        return redirect('home')\r\n\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>handlesignup() function handles the backend of signup form. Uname, fname, lname, email , pass1, pass2, income, savings and profession will store the information of the form in these variables.<\/p>\n<p>Various conditions are there to sign up . The username should be unique, pass1 and pass 2 should be the same and also the length of the username should be maximum 15 characters. handlelogin() handles the backend of the login page. If the information entered by the user is correct, the user will be redirected to the dashboard. handleLogout() handles the backend of logout.<\/p>\n<p>a. error(): This function gives the error message on the screen if a condition is not satisfied.<\/p>\n<p>b. len():This function returns the length of the string, array, dictionary etc.<\/p>\n<p>c. success():If a condition is satisfied, it displays the message that is specified in the parentheses.<\/p>\n<p><strong>f. Add Money Form and Add Money Update Backend:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def addmoney_submission(request):\r\n    if request.session.has_key('is_logged'):\r\n        if request.method == \"POST\":\r\n            user_id = request.session[\"user_id\"]\r\n            user1 = User.objects.get(id=user_id)\r\n            addmoney_info1 = Addmoney_info.objects.filter(user=user1).order_by('-Date')\r\n            add_money = request.POST[\"add_money\"]\r\n            quantity = request.POST[\"quantity\"]\r\n            Date = request.POST[\"Date\"]\r\n            Category = request.POST[\"Category\"]\r\n            add = Addmoney_info(user = user1,add_money=add_money,quantity=quantity,Date = Date,Category= Category)\r\n            add.save()\r\n            paginator = Paginator(addmoney_info1, 4)\r\n            page_number = request.GET.get('page')\r\n            page_obj = Paginator.get_page(paginator,page_number)\r\n            context = {\r\n                'page_obj' : page_obj\r\n                }\r\n            return render(request,'home\/index.html',context)\r\n    return redirect('\/index')\r\ndef addmoney_update(request,id):\r\n    if request.session.has_key('is_logged'):\r\n        if request.method == \"POST\":\r\n            add  = Addmoney_info.objects.get(id=id)\r\n            add .add_money = request.POST[\"add_money\"]\r\n            add.quantity = request.POST[\"quantity\"]\r\n            add.Date = request.POST[\"Date\"]\r\n            add.Category = request.POST[\"Category\"]\r\n            add .save()\r\n            return redirect(\"\/index\")\r\n    return redirect(\"\/home\")  \r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>addmoney_submission() handles the backend of the form we filled for our daily expenses. addmoney_update() saves the information of the form after we have edited .<\/p>\n<p><strong>g. Expense Edit and Expense Delete Backend:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def expense_edit(request,id):\r\n    if request.session.has_key('is_logged'):\r\n        addmoney_info = Addmoney_info.objects.get(id=id)\r\n        user_id = request.session[\"user_id\"]\r\n        user1 = User.objects.get(id=user_id)\r\n        return render(request,'home\/expense_edit.html',{'addmoney_info':addmoney_info})\r\n    return redirect(\"\/home\")  \r\n \r\ndef expense_delete(request,id):\r\n    if request.session.has_key('is_logged'):\r\n        addmoney_info = Addmoney_info.objects.get(id=id)\r\n        addmoney_info.delete()\r\n        return redirect(\"\/index\")\r\n    return redirect(\"\/home\") \r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>expense_edit() form redirects the user to the edit form and also extracts the details of the user from the database and displays it on the screen. expense_delete() helps in deleting the expenses.<\/p>\n<p><strong>h. Monthly, weekly , yearly expense Backend<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def expense_month(request):\r\n    todays_date = datetime.date.today()\r\n    one_month_ago = todays_date-datetime.timedelta(days=30)\r\n    user_id = request.session[\"user_id\"]\r\n    user1 = User.objects.get(id=user_id)\r\n    addmoney = Addmoney_info.objects.filter(user = user1,Date__gte=one_month_ago,Date__lte=todays_date)\r\n    finalrep ={}\r\n \r\n    def get_Category(addmoney_info):\r\n        # if addmoney_info.add_money==\"Expense\":\r\n        return addmoney_info.Category    \r\n    Category_list = list(set(map(get_Category,addmoney)))\r\n \r\n    def get_expense_category_amount(Category,add_money):\r\n        quantity = 0 \r\n        filtered_by_category = addmoney.filter(Category = Category,add_money=\"Expense\") \r\n        for item in filtered_by_category:\r\n            quantity+=item.quantity\r\n        return quantity\r\n \r\n    for x in addmoney:\r\n        for y in Category_list:\r\n            finalrep[y]= get_expense_category_amount(y,\"Expense\")\r\n \r\n    return JsonResponse({'expense_category_data': finalrep}, safe=False)\r\n \r\n \r\ndef stats(request):\r\n    if request.session.has_key('is_logged') :\r\n        todays_date = datetime.date.today()\r\n        one_month_ago = todays_date-datetime.timedelta(days=30)\r\n        user_id = request.session[\"user_id\"]\r\n        user1 = User.objects.get(id=user_id)\r\n        addmoney_info = Addmoney_info.objects.filter(user = user1,Date__gte=one_month_ago,Date__lte=todays_date)\r\n        sum = 0 \r\n        for i in addmoney_info:\r\n            if i.add_money == 'Expense':\r\n                sum=sum+i.quantity\r\n        addmoney_info.sum = sum\r\n        sum1 = 0 \r\n        for i in addmoney_info:\r\n            if i.add_money == 'Income':\r\n                sum1 =sum1+i.quantity\r\n        addmoney_info.sum1 = sum1\r\n        x= user1.userprofile.Savings+addmoney_info.sum1 - addmoney_info.sum\r\n        y= user1.userprofile.Savings+addmoney_info.sum1 - addmoney_info.sum\r\n        if x&lt;0:\r\n            messages.warning(request,'Your expenses exceeded your savings')\r\n            x = 0\r\n        if x&gt;0:\r\n            y = 0\r\n        addmoney_info.x = abs(x)\r\n        addmoney_info.y = abs(y)\r\n        return render(request,'home\/stats.html',{'addmoney':addmoney_info})\r\n \r\ndef expense_week(request):\r\n    todays_date = datetime.date.today()\r\n    one_week_ago = todays_date-datetime.timedelta(days=7)\r\n    user_id = request.session[\"user_id\"]\r\n    user1 = User.objects.get(id=user_id)\r\n    addmoney = Addmoney_info.objects.filter(user = user1,Date__gte=one_week_ago,Date__lte=todays_date)\r\n    finalrep ={}\r\n \r\n    def get_Category(addmoney_info):\r\n        return addmoney_info.Category\r\n    Category_list = list(set(map(get_Category,addmoney)))\r\n \r\n \r\n    def get_expense_category_amount(Category,add_money):\r\n        quantity = 0 \r\n        filtered_by_category = addmoney.filter(Category = Category,add_money=\"Expense\") \r\n        for item in filtered_by_category:\r\n            quantity+=item.quantity\r\n        return quantity\r\n \r\n    for x in addmoney:\r\n        for y in Category_list:\r\n            finalrep[y]= get_expense_category_amount(y,\"Expense\")\r\n \r\n    return JsonResponse({'expense_category_data': finalrep}, safe=False)\r\n    \r\ndef weekly(request):\r\n    if request.session.has_key('is_logged') :\r\n        todays_date = datetime.date.today()\r\n        one_week_ago = todays_date-datetime.timedelta(days=7)\r\n        user_id = request.session[\"user_id\"]\r\n        user1 = User.objects.get(id=user_id)\r\n        addmoney_info = Addmoney_info.objects.filter(user = user1,Date__gte=one_week_ago,Date__lte=todays_date)\r\n        sum = 0 \r\n        for i in addmoney_info:\r\n            if i.add_money == 'Expense':\r\n                sum=sum+i.quantity\r\n        addmoney_info.sum = sum\r\n        sum1 = 0 \r\n        for i in addmoney_info:\r\n            if i.add_money == 'Income':\r\n                sum1 =sum1+i.quantity\r\n        addmoney_info.sum1 = sum1\r\n        x= user1.userprofile.Savings+addmoney_info.sum1 - addmoney_info.sum\r\n        y= user1.userprofile.Savings+addmoney_info.sum1 - addmoney_info.sum\r\n        if x&lt;0:\r\n            messages.warning(request,'Your expenses exceeded your savings')\r\n            x = 0\r\n        if x&gt;0:\r\n            y = 0\r\n        addmoney_info.x = abs(x)\r\n        addmoney_info.y = abs(y)\r\n    return render(request,'home\/weekly.html',{'addmoney_info':addmoney_info})\r\n \r\ndef check(request):\r\n    if request.method == 'POST':\r\n        user_exists = User.objects.filter(email=request.POST['email'])\r\n        messages.error(request,\"Email not registered, TRY AGAIN!!!\")\r\n        return redirect(\"\/reset_password\")\r\n \r\ndef info_year(request):\r\n    todays_date = datetime.date.today()\r\n    one_week_ago = todays_date-datetime.timedelta(days=30*12)\r\n    user_id = request.session[\"user_id\"]\r\n    user1 = User.objects.get(id=user_id)\r\n    addmoney = Addmoney_info.objects.filter(user = user1,Date__gte=one_week_ago,Date__lte=todays_date)\r\n    finalrep ={}\r\n \r\n    def get_Category(addmoney_info):\r\n        return addmoney_info.Category\r\n    Category_list = list(set(map(get_Category,addmoney)))\r\n \r\n \r\n    def get_expense_category_amount(Category,add_money):\r\n        quantity = 0 \r\n        filtered_by_category = addmoney.filter(Category = Category,add_money=\"Expense\") \r\n        for item in filtered_by_category:\r\n            quantity+=item.quantity\r\n        return quantity\r\n \r\n    for x in addmoney:\r\n        for y in Category_list:\r\n            finalrep[y]= get_expense_category_amount(y,\"Expense\")\r\n \r\n    return JsonResponse({'expense_category_data': finalrep}, safe=False)\r\n \r\ndef info(request):\r\n    return render(request,'home\/info.html')\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>expense_month() function gets the data of the expenses of the current month. get_category() function gets the category (expense\/income) from the database. get_expense_category_amount() fetches the amount from the database of the category(expense). stats() function calculates the overall expenses and savings made by the user in a month. expense_week() and info_year() performs the same function as expense_month() but on a weekly basis. weekly() gets the amount saved in a month and also the overall expenses of a user.<\/p>\n<h3>Python Expense Tracker Output:<\/h3>\n<p><strong>Login Form:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99356\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page.png\" alt=\"login page\" width=\"1920\" height=\"990\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page-1536x792.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/login-page-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Dashboard:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99358\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard.png\" alt=\"expense tracker dashboard\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/expense-tracker-dashboard-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99359\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard.png\" alt=\"dashboard\" width=\"1920\" height=\"990\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard-1536x792.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/dashboard-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Monthly Expense Page:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99361\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense.png\" alt=\"monthly expense\" width=\"1920\" height=\"989\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense-768x396.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense-1536x791.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/monthly-expense-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>History Page:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-99363\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history.png\" alt=\"history\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/history-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>We have successfully created the expense tracker project in python. We learned a variety of concepts while making this project.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2504,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/12ap20TpaYAFzsqE_PgJ-FUhhicH8xZSS\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601062826\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/12ap20TpaYAFzsqE_PgJ-FUhhicH8xZSS\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 01:02:39&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-05 09:48:13&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-08 15:18:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-12 12:02:20&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-12 12:02:20&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Inflow and Outflow record of money can be easily kept with the help of expense tracker. It helps to manage finances. In this project, we will develop an expense tracker that will track our&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":99367,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[19201,24832,24809,24812,24810,24811,21082],"class_list":["post-98558","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-django-project","tag-expense-tracker","tag-python-expense-tracker","tag-python-expense-tracker-code","tag-python-expense-tracker-project","tag-python-expense-tracker-project-code","tag-python-project"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Expense Tracker Project with Source Code - DataFlair<\/title>\n<meta name=\"description\" content=\"Build Python Expense Tracker - Inflow Outflow record of money can be easily kept with the help of expense tracker.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Expense Tracker Project with Source Code - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Build Python Expense Tracker - Inflow Outflow record of money can be easily kept with the help of expense tracker.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-24T03:30:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T06:28:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Expense Tracker Project with Source Code - DataFlair","description":"Build Python Expense Tracker - Inflow Outflow record of money can be easily kept with the help of expense tracker.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/","og_locale":"en_US","og_type":"article","og_title":"Python Expense Tracker Project with Source Code - DataFlair","og_description":"Build Python Expense Tracker - Inflow Outflow record of money can be easily kept with the help of expense tracker.","og_url":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-07-24T03:30:02+00:00","article_modified_time":"2026-06-01T06:28:07+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Expense Tracker Project with Source Code","datePublished":"2021-07-24T03:30:02+00:00","dateModified":"2026-06-01T06:28:07+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/"},"wordCount":1172,"commentCount":11,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg","keywords":["Django Project","expense tracker","Python Expense Tracker","Python Expense Tracker Code","Python Expense Tracker Project","Python Expense Tracker Project Code","Python project"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/","url":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/","name":"Python Expense Tracker Project with Source Code - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg","datePublished":"2021-07-24T03:30:02+00:00","dateModified":"2026-06-01T06:28:07+00:00","description":"Build Python Expense Tracker - Inflow Outflow record of money can be easily kept with the help of expense tracker.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/expense-tracker-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/07\/python-project-expense-tracker.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/expense-tracker-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Expense Tracker Project with Source Code"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=98558"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98558\/revisions"}],"predecessor-version":[{"id":148573,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/98558\/revisions\/148573"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/99367"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=98558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=98558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=98558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}