-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b0cb8738-198f-46f5-b54a-00bd84a2903d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from .form import LoginForm as MyLoginForm
from django.contrib.auth.forms import AuthenticationForm
from django.contrib import messages
from .models import material
from django.http import HttpResponse
from django.shortcuts import render_to_response

from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth.hashers import check_password

def home(request):
    context= locals()
    template='home.html'
    return render(request, template, context)
def logins(request):
    context=locals()
    template='login.html'

    return render(request,template,context)   
def signup(request):
    context=locals()
    template='signup.html'
    return render(request,template,context)
def checklogin(request):
    if request.method=='POST':
        form=MyLoginForm(data=request.POST)
        if form.is_valid():
            userf=form.Usernames
            passes=form.Passwords
            g=User.objects.get(Username=userf,Password=passes)
        try:
               g=User.objects.get(Username=userf,Password=passes)
        except       
                CRITICAL=50
                messages.add_message(request,CRITICAL,'WRONG USER DETAILS')
            return render(request,'login.html')
        context={'userf':userf}
    return HttpResponseRedirect('/dashboard',context)  
        
             


            
    
def logout(request):
    template='home.html'
    return render(request,template,context=locals())    


   
    
def dashboard(request,context):
        
    users=context
    
    template='index.html'
    render(request,template,{"users":users})
    
def subcontractors(self,request,dashboard):
        total_materials=material.objects.all()
        tempelate='basic_table.html' 
        return render(request,tempelate,locals())

Reply via email to