pre–db-reset commit; attempting to update User model w. uuid pk enumeration
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import lxml.html
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import html
|
from django.utils import html
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
@@ -6,7 +7,7 @@ from ..forms import (
|
|||||||
EMPTY_ITEM_ERROR,
|
EMPTY_ITEM_ERROR,
|
||||||
)
|
)
|
||||||
from ..models import Item, List
|
from ..models import Item, List
|
||||||
import lxml.html
|
from apps.lyric.models import User
|
||||||
|
|
||||||
class HomePageTest(TestCase):
|
class HomePageTest(TestCase):
|
||||||
def test_uses_home_template(self):
|
def test_uses_home_template(self):
|
||||||
@@ -144,3 +145,9 @@ class ListViewTest(TestCase):
|
|||||||
self.assertContains(response, expected_error)
|
self.assertContains(response, expected_error)
|
||||||
self.assertTemplateUsed(response, "apps/dashboard/list.html")
|
self.assertTemplateUsed(response, "apps/dashboard/list.html")
|
||||||
self.assertEqual(Item.objects.all().count(), 1)
|
self.assertEqual(Item.objects.all().count(), 1)
|
||||||
|
|
||||||
|
class MyListsTest(TestCase):
|
||||||
|
def test_my_lists_url_renders_my_lists_template(self):
|
||||||
|
user = User.objects.create(email="a@b.cde")
|
||||||
|
response = self.client.get(f"/apps/dashboard/users/{user.id}/")
|
||||||
|
self.assertTemplateUsed(response, "my-lists.html")
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ from . import views
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('new_list', views.new_list, name='new_list'),
|
path('new_list', views.new_list, name='new_list'),
|
||||||
path('<int:list_id>/', views.view_list, name='view_list'),
|
path('<int:list_id>/', views.view_list, name='view_list'),
|
||||||
|
path('users/<uuid:user_id>/', views.my_lists, name='my_lists'),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Token(models.Model):
|
|||||||
uid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
uid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
|
||||||
class User(models.Model):
|
class User(models.Model):
|
||||||
id = models.BigAutoField(primary_key=True)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
email = models.EmailField(unique=True)
|
email = models.EmailField(unique=True)
|
||||||
|
|
||||||
REQUIRED_FIELDS = []
|
REQUIRED_FIELDS = []
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<h1>Welcome, Earthman</h1>
|
<h1>Welcome, Earthman</h1>
|
||||||
</a>
|
</a>
|
||||||
{% if user.email %}
|
{% if user.email %}
|
||||||
|
<a class="navbar-link" href="{% url 'my_lists' user.email %}">My lists</a>
|
||||||
<span class="navbar-text">Logged in as {{ user.email }}</span>
|
<span class="navbar-text">Logged in as {{ user.email }}</span>
|
||||||
<form method="POST" action="{% url "logout" %}">
|
<form method="POST" action="{% url "logout" %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|||||||
Reference in New Issue
Block a user