Skip to content

Commit

Permalink
Merge pull request #10 from AnimalFoodBank:wip/oct26
Browse files Browse the repository at this point in the history
Wip/oct26
  • Loading branch information
delano authored Oct 30, 2023
2 parents 479b18e + ef09664 commit e628da7
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 32 deletions.
8 changes: 4 additions & 4 deletions afb/afb/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
from django.contrib import admin
from django.urls import include, path

from afbcore.views import AboutView, ClientCreateView, CreateClientFormView, DashboardView, MyLoginView
from afbcore.views import AboutView, ClientSignupFormView, DashboardView, MyLoginView
from afbcore.views import ClientRequestView

urlpatterns = [
path('admin/', admin.site.urls),

path('dashboard', DashboardView.as_view(), name='dashboard'),
path('', DashboardView.as_view()),

path('', CreateClientFormView.as_view()),


path('join/', ClientSignupFormView.as_view()),

# Part of django-tailwind
# See https://django-tailwind.readthedocs.io/en/latest/installation.html#configuration
path('__reload__/', include('django_browser_reload.urls')),

path('request/', ClientRequestView.as_view(), name='create_request'),

path('login/', MyLoginView.as_view(), name='login'),

path('about/', AboutView.as_view()),
Expand Down
2 changes: 1 addition & 1 deletion afb/afbcore/forms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django import forms

from .client import ClientForm
from .client import ClientSignupForm


class LoginForm(forms.Form):
Expand Down
4 changes: 2 additions & 2 deletions afb/afbcore/forms/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from afbcore.models import Client


class ClientForm(ModelForm):
class ClientSignupForm(ModelForm):

class Meta:
model = Client
Expand All @@ -15,5 +15,5 @@ class Meta:
"email",
"address",
"phone_number",
"status"
# "status",
]
19 changes: 19 additions & 0 deletions afb/afbcore/models/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@


from django.forms import ModelForm

from afbcore.models import Client


class ClientSignupForm(ModelForm):

class Meta:
model = Client
fields = [
"first_name",
"last_name",
"email",
"address",
"phone_number",
# "status",
]
13 changes: 0 additions & 13 deletions afb/afbcore/templates/afbcore/client_form.html

This file was deleted.

30 changes: 30 additions & 0 deletions afb/afbcore/templates/afbcore/client_signup_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

{% extends 'appshell.html' %}

{% load static %}
{% load tailwind_filters %}


{% block contentHeader %}

<h1 class="text-3xl font-bold tracking-tight text-gray-900">Join</h1>

{% endblock %}


{% block content %}

<h2 class="text-2xl font- tracking-tight">Create a client profile</h2>

<form method="post" class="mt-4" enctype="multipart/form-data">
{% csrf_token %}

{{form | crispy}}

<div class="mt-4">
<button type="submit" class="bg-red-500">Create</button>
</div>
</form>


{% endblock %}
11 changes: 8 additions & 3 deletions afb/afbcore/templates/appshell.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@


{% load static %}
{% load tailwind_filters %}


{% block title %}AFB{% endblock %}

Expand Down Expand Up @@ -106,7 +108,8 @@
<!-- Active: "bg-gray-100", Not Active: "" -->
<a href="#" class="block px-4 py-2 text-sm text-gray-700 " role="menuitem" tabindex="-1" id="user-menu-item-0">Your Profile</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-1">Settings</a>
<a href="/login" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-2">Sign In</a>
<a href="/join" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-2">Join</a>
<a href="/login" class="block px-4 py-2 text-sm text-gray-700" role="menuitem" tabindex="-1" id="user-menu-item-3">Sign In</a>
</div>
</div>
</div>
Expand All @@ -133,7 +136,7 @@
<div class="md:hidden" id="mobile-menu">
<div class="space-y-1 px-2 pb-3 pt-2 sm:px-3">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<a href="/" class="bg-gray-900 text-white block rounded-md px-3 py-2 text-base font-medium" aria-current="page">Dashboard</a>
<a href="/dashboard" class="bg-gray-900 text-white block rounded-md px-3 py-2 text-base font-medium" aria-current="page">Dashboard</a>
<a href="/request" class="text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium">Request</a>
<a href="/about" class="text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium">About</a>
</div>
Expand All @@ -157,6 +160,7 @@
<div class="mt-3 space-y-1 px-2">
<a href="#" class="block rounded-md px-3 py-2 text-base font-medium text-gray-400 hover:bg-gray-700 hover:text-white">Your Profile</a>
<a href="#" class="block rounded-md px-3 py-2 text-base font-medium text-gray-400 hover:bg-gray-700 hover:text-white">Settings</a>
<a href="/join" class="block rounded-md px-3 py-2 text-base font-medium text-gray-400 hover:bg-gray-700 hover:text-white">Join</a>
<a href="/login" class="block rounded-md px-3 py-2 text-base font-medium text-gray-400 hover:bg-gray-700 hover:text-white">Sign In</a>

</div>
Expand All @@ -166,9 +170,10 @@

<header class="bg-white shadow">
<div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
<h1 class="text-3xl font-bold tracking-tight text-gray-900">Dashboard</h1>
{% block contentHeader %}{% endblock %}
</div>
</header>

<main>
<div class="mx-auto max-w-7xl py-6 sm:px-6 lg:px-8">

Expand Down
10 changes: 10 additions & 0 deletions afb/afbcore/templates/dashboard/client.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

{% extends 'appshell.html' %}


{% block contentHeader %}

<h1 class="text-3xl font-bold tracking-tight text-gray-900">Dashboard</h1>

{% endblock %}


{% block content %}


Expand All @@ -9,7 +17,9 @@
<img src="{% static 'img/afb_icon_colour.png' %}" alt="Icon">
{% endcomment %}

{% comment "" %}
{% include 'forms/new_request.html' %}
{% endcomment %}

{% comment %}

Expand Down
14 changes: 5 additions & 9 deletions afb/afbcore/views/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.views.generic.edit import CreateView
from django.views.generic.edit import FormView

from afbcore.forms import ClientForm
from afbcore.forms import ClientSignupForm
from afbcore.models import Client


Expand All @@ -18,14 +18,10 @@ class DashboardView(TemplateView):
template_name = "dashboard/client.html"


class CreateClientFormView(FormView):
template_name = "afbcore/client_form.html"
form_class = ClientForm


class ClientCreateView(CreateView):
model = Client
fields = ["first_name", "last_name", "email", "address", "phone_number", "status"]
class ClientSignupFormView(FormView):
template_name = "afbcore/client_signup_form.html"
form_class = ClientSignupForm
success_url = "/dashboard"


class ClientRequestView(TemplateView):
Expand Down

0 comments on commit e628da7

Please sign in to comment.