diff --git a/htmx_contact/main.py b/htmx_contact/main.py index 9390e85..5515fd6 100644 --- a/htmx_contact/main.py +++ b/htmx_contact/main.py @@ -67,7 +67,7 @@ def new_contact(): **request.form ) with Session.begin() as session: - contact = Contact(**validated_form) + contact = Contact(user_id=current_user.id, **validated_form.model_dump()) session.add(contact) session.commit() flash("New Contacted added!") diff --git a/htmx_contact/static/css/main.css b/htmx_contact/static/css/main.css index 8d1c9c1..1469379 100644 --- a/htmx_contact/static/css/main.css +++ b/htmx_contact/static/css/main.css @@ -24,8 +24,8 @@ opacity: 1; } -input[type=text] { - width: 300px; +input[type=text], +input[type=email] { padding: 10px 5px; border-radius: .25rem; border: 2px solid black; @@ -117,3 +117,51 @@ table { justify-content: space-between; align-items: center; } + +label { + display: block; +} + +fieldset { + font-size: 20px; + border-radius: 5px; +} + +.red { + background-color: crimson; +} + +.flex-row { + display: flex; +} + +.flex-space-betw { + justify-content: space-between; + align-items: center; +} + +.flex-center { + justify-content: center; + align-items: center; +} + +.flex-column { + display: flex; + flex-direction: column; +} + +.font-red { + color: crimson; +} + +form span { + display: block; +} + +.width-375-px { + width: 375px; +} + +.width-100 { + width: 100%; +} diff --git a/htmx_contact/templates/contacts.html b/htmx_contact/templates/contacts.html index e458288..7a3ff76 100644 --- a/htmx_contact/templates/contacts.html +++ b/htmx_contact/templates/contacts.html @@ -2,11 +2,12 @@ {% block content %}
+

Contact.app

-
+
- - + +
Add Contact diff --git a/htmx_contact/templates/new_contact.html b/htmx_contact/templates/new_contact.html index f51c259..f24802c 100644 --- a/htmx_contact/templates/new_contact.html +++ b/htmx_contact/templates/new_contact.html @@ -1,36 +1,39 @@ {% extends 'base.html' %} {% block content %} +
+

New Contact

- - -
+
Contact Values

- - {{ errors.get('email','') }} + + {{ errors.get('email','') }}

- - {{ errors.get('first_name','') }} + + {{ errors.get('first_name','') }}

- - {{ errors.get('last_name', '') }} + + {{ errors.get('last_name', '') }}

- - {{ errors.get('phone','') }} + + {{ errors.get('phone','') }}

- +
+ Back + +
-

- Back -

+
+
+ {% endblock %}