from urllib import request
from django.contrib import messages
from django.db import IntegrityError
from django.shortcuts import render, redirect, get_object_or_404
from django.template import context
from pos.models import category
# Create your views here.
def admindashbord(request):
return render(request, "homepage.html")
def docs(request):
return render(request,"docs.html")
def order(request):
return render(request,"orders.html")
# In page menue
def medicine(request):
return render(request, "Medicene.html")
# In page menue / add_category
def addCategory(request):
return render(request, "Category/ADD_category.html")
def store(request):
try:
col=category()
col.categoryName=request.POST["genre"]
col.save()
messages.success(request, "Add successfully")
except IntegrityError:
messages.error(request, "Already exists")
return redirect("add_category")
# In page menue / update_category
def updateCategory(request):
return render(request, "Category/Update_category.html")
def update(request,id):
try:
col = category.objects.get(pk=id)
context={
"category":col
}
except Exception as ex:
print(ex)
return redirect("updatecategory",context)
# In page menue / delete_category
def delete(request,id):
try:
if request.method == "GET":
col = category.objects.filter(id=id)
col.delete()
except Exception as ex:
print(ex)
return redirect("category")
def Category(request):
Category = category.objects.all()
context = {"categorys": Category}
return render(request, "Category/category.html", context)
# In page menue / add_product
def addProduct(request):
return render(request, "ADD_Product.html")
# External Menue
def login(request):
return render(request, "login.html")
def sigin(request):
return render(request, "signup.html")
def resetPass(request):
return render(request, "reset-password.html")
def Error404(request):
return render(request, "404.html")
#chart
def chart(request):
return render(request, "charts.html")
# Help
def help(request):
return render(request, "help.html")
# setting
def setting(request):
return render(request, "settings.html")
# Account
def account(request):
return render(request, "account.html")
# Notificate
def notificate(request):
return render(request, "notifications.html")