Commit bb58d738 authored by Patrick Kimber's avatar Patrick Kimber

Running postgres in Docker

parent cb752f5e
Pipeline #49997262 passed with stage
in 4 minutes and 14 seconds
# Set environment variables for this VE
source venv-invoice/bin/activate.fish
set -x DATABASE_HOST "localhost"
set -x DATABASE_PASS "docker"
set -x DATABASE_PASS "postgres"
set -x DATABASE_USER "postgres"
set -x DEFAULT_FROM_EMAIL "web@pkimber.net"
set -x DJANGO_SETTINGS_MODULE "example_invoice.dev_patrick"
......
......@@ -5,7 +5,7 @@ from django.urls import reverse
from contact.tests.factories import ContactFactory, UserContactFactory
from crm.tests.factories import CrmContactFactory, TicketFactory
from invoice.tests.factories import InvoiceContactFactory
from invoice.tests.factories import InvoiceContactFactory, InvoiceFactory
from login.tests.factories import TEST_PASSWORD, UserFactory
from login.tests.fixture import perm_check
from login.tests.scenario import get_user_web
......@@ -21,3 +21,10 @@ def test_contact_detail(perm_check):
@pytest.mark.django_db
def test_contact_list(perm_check):
perm_check.staff(reverse("contact.list"))
@pytest.mark.django_db
def test_invoice_detail(perm_check):
invoice = InvoiceFactory()
url = reverse("invoice.detail", args=[invoice.pk])
perm_check.staff(url)
......@@ -5,7 +5,13 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path, reverse_lazy
from django.views.generic import RedirectView
from .views import ContactDetailView, ContactListView, HomeView, SettingsView
from .views import (
ContactDetailView,
ContactListView,
HomeView,
InvoiceDetailView,
SettingsView,
)
admin.autodiscover()
......@@ -26,6 +32,11 @@ urlpatterns = [
),
url(regex=r"^crm/", view=include("crm.urls")),
url(regex=r"^invoice/", view=include("invoice.urls")),
url(
regex=r"^invoice/(?P<pk>\d+)/$",
view=InvoiceDetailView.as_view(),
name="invoice.detail",
),
url(regex=r"^report/", view=include("report.urls")),
url(
r"^home/user/$",
......
......@@ -4,6 +4,7 @@ from django.views.generic import DetailView, TemplateView, ListView
from base.view_utils import BaseMixin
from contact.views import ContactDetailMixin, ContactListMixin
from invoice.views import InvoiceDetailMixin
class ContactDetailView(
......@@ -22,6 +23,16 @@ class ContactListView(
template_name = "example/contact_list.html"
class InvoiceDetailView(
LoginRequiredMixin,
StaffuserRequiredMixin,
InvoiceDetailMixin,
BaseMixin,
DetailView,
):
pass
class HomeView(TemplateView):
template_name = "example/home.html"
......
......@@ -9,7 +9,6 @@ from .views import (
invoice_download,
InvoiceContactCreateView,
InvoiceContactUpdateView,
InvoiceDetailView,
InvoiceDraftCreateView,
InvoiceLineCreateView,
InvoiceLineUpdateView,
......@@ -86,11 +85,6 @@ urlpatterns = [
view=invoice_download,
name="invoice.download",
),
url(
regex=r"^(?P<pk>\d+)/$",
view=InvoiceDetailView.as_view(),
name="invoice.detail",
),
url(
regex=r"^(?P<pk>\d+)/line/create/$",
view=InvoiceLineCreateView.as_view(),
......
......@@ -397,9 +397,7 @@ class InvoiceCreateViewMixin(BaseMixin, CreateView):
return context
class InvoiceDetailView(
LoginRequiredMixin, StaffuserRequiredMixin, BaseMixin, DetailView
):
class InvoiceDetailMixin:
model = Invoice
......
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