Commit a99f737b authored by Claire Zuliani's avatar Claire Zuliani

initial commit

parents
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import Invoice
admin.site.register(Invoice)
from django.apps import AppConfig
class DjangoldpInvoicesConfig(AppConfig):
name = 'djangoldp_invoices'
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-03 18:18
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Invoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('identifier', models.CharField(max_length=255)),
('title', models.CharField(max_length=255)),
('htAmount', models.DecimalField(decimal_places=2, max_digits=11)),
('tvaRate', models.DecimalField(decimal_places=2, max_digits=4)),
('creationDate', models.DateField(default=datetime.date.today)),
('modificationDate', models.DateField(default=datetime.date.today)),
],
options={
'permissions': (('view_invoice', 'Read'), ('control_invoice', 'Control')),
},
),
]
from django.conf import settings
from django.db import models
import datetime
class Invoice(models.Model):
# customer = models.ForeignKey(User, on_delete=models.CASCADE)
# provider = models.ForeignKey(User, on_delete=models.CASCADE)
STATES = (
('pending', 'en attente'),
('paid', 'réglée')
)
identifier = models.CharField(max_length=255)
title = models.CharField(max_length=255)
# state = models.CharField(max_length=1, choices=STATES, default = 'pending')
htAmount = models.DecimalField(max_digits=11, decimal_places=2)
tvaRate = models.DecimalField(max_digits=4, decimal_places=2)
creationDate = models.DateField(default = datetime.date.today)
modificationDate = models.DateField(default = datetime.date.today)
class Meta:
permissions = (
('view_invoice', 'Read'),
('control_invoice', 'Control'),
)
def __str__(self):
return '{} ({})'.format(self.identifier, self.title)
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url, include
from django.conf import settings
from djangoldp.views import LDPViewSet
from .models import Invoice
urlpatterns = [
url(r'^', LDPViewSet.urls(model=Invoice)),
]
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment