This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_required | |
def createInvoice(request): | |
#create a blank invoice .... | |
number = 'INV-'+str(uuid4()).split('-')[1] | |
newInvoice = Invoice.objects.create(number=number) | |
newInvoice.save() | |
inv = Invoice.objects.get(number=number) | |
return redirect('create-build-invoice', slug=inv.slug) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@login_required | |
def clients(request): | |
context = {} | |
clients = Client.objects.all() | |
context['clients'] = clients | |
if request.method == 'GET': | |
form = ClientForm() | |
context['form'] = form | |
return render(request, 'invoice/clients.html', context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.decorators import user_passes_test | |
#Anonymous required | |
def anonymous_required(function=None, redirect_url=None): | |
if not redirect_url: | |
redirect_url = 'dashboard' | |
actual_decorator = user_passes_test( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
from django.contrib.auth.models import User | |
from django.forms import widgets | |
from .models import * | |
import json | |
class UserLoginForm(forms.ModelForm): | |
username = forms.CharField( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.template.defaultfilters import slugify | |
from django.utils import timezone | |
from uuid import uuid4 | |
from django.contrib.auth.models import User | |
class Client(models.Model): |
NewerOlder