diff --git a/squib/profiles/tests.py b/squib/profiles/tests.py index ed00e66d..d45841a4 100644 --- a/squib/profiles/tests.py +++ b/squib/profiles/tests.py @@ -33,10 +33,9 @@ def test_following(self): def test_follow_api_endpoint(self): client = self.get_client() - response = client.post(f"/api/profile/{self.user2.username}/follow", {"action":"follow"}) - print(response) + response = client.post(f"/api/profile/{self.user2.username}/follow/", {"action":"follow"}) r_data = response.json() - count = r_data.get("followers") + count = r_data.get("follower_count") self.assertEqual(count, 1) def test_unfollow_api_endpoint(self): @@ -45,14 +44,14 @@ def test_unfollow_api_endpoint(self): first.profile.followers.add(second) client = self.get_client() - response = client.post(f"/api/profile/{second.username}/follow", {"action":"unfollow"}) + response = client.post(f"/api/profile/{second.username}/follow/", {"action":"unfollow"}) r_data = response.json() - count = r_data.get("followers") + count = r_data.get("follower_count") self.assertEqual(count, 0) def test_cannot_follow_api_endpoint(self): client = self.get_client() - response = client.post(f"/api/profile/{self.user1.username}/follow", {"action":"follow"}) + response = client.post(f"/api/profile/{self.user1.username}/follow/", {"action":"follow"}) r_data = response.json() - count = r_data.get("followers") + count = r_data.get("follower_count") self.assertEqual(count, 0) \ No newline at end of file diff --git a/squib/profiles/urls.py b/squib/profiles/urls.py index bb3ea701..9dd84d13 100644 --- a/squib/profiles/urls.py +++ b/squib/profiles/urls.py @@ -2,7 +2,7 @@ from .views import profile_view, update_profile_view urlpatterns = [ - path("", profile_view), - path("edit/", update_profile_view) + path("", profile_view, name='profile'), + path("edit/", update_profile_view, name='edit') ] \ No newline at end of file diff --git a/squib/squib/settings.py b/squib/squib/settings.py index 579358e5..994b55dc 100644 --- a/squib/squib/settings.py +++ b/squib/squib/settings.py @@ -40,6 +40,11 @@ LOGIN_URL = "/login" +#Form template +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" + +CRISPY_TEMPLATE_PACK = "bootstrap5" + # Application definition INSTALLED_APPS = [ @@ -53,6 +58,8 @@ # extension/ libraries "rest_framework", "corsheaders", + "crispy_forms", + "crispy_bootstrap5", # application "tweet.apps.TweetConfig", diff --git a/squib/templates/account/auth.html b/squib/templates/account/auth.html index 54e26de1..9cfeb54a 100644 --- a/squib/templates/account/auth.html +++ b/squib/templates/account/auth.html @@ -1,16 +1,16 @@ {% extends "base.html" %} {% block title %}{{ title }}{% endblock %} - +{% load crispy_forms_tags %} {% block content %} -
-

{{ title }}

+
+

{{ title }}

{% if description %}

{{ description }}

{% endif %}
{% csrf_token %} - {{form.as_p}} + {{form|crispy}}
diff --git a/squib/templates/base.html b/squib/templates/base.html index a0e855e5..dade7cce 100644 --- a/squib/templates/base.html +++ b/squib/templates/base.html @@ -6,51 +6,34 @@ Squib-{% block title %} {% endblock %} - + + + {% include "react/css.html" %} + -
- - {% include "components/navbar.html" %} -
- {% block content %} - {% endblock %} +
- {% include "react/js.html" %} -
+ + +{% include "react/js.html" %} - \ No newline at end of file + diff --git a/squib/templates/components/navbar.html b/squib/templates/components/navbar.html index 011c433c..662f0013 100644 --- a/squib/templates/components/navbar.html +++ b/squib/templates/components/navbar.html @@ -1,32 +1,39 @@ - \ No newline at end of file + + + + diff --git a/squib/templates/profiles/update.html b/squib/templates/profiles/update.html index 54e26de1..6e07eb92 100644 --- a/squib/templates/profiles/update.html +++ b/squib/templates/profiles/update.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block title %}{{ title }}{% endblock %} - +{% load crispy_forms_tags %} {% block content %}

{{ title }}

@@ -10,7 +10,7 @@

{{ title }}

{% endif %}
{% csrf_token %} - {{form.as_p}} + {{form|crispy}}