diff --git a/config/settings/base.py b/config/settings/base.py
index 1d0225b..47d1cf4 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -57,6 +57,7 @@
"una_hora.users.apps.UsersConfig",
"una_hora.comments.apps.CommentsConfig",
"una_hora.meetings.apps.MeetingsConfig",
+ "una_hora.search",
]
MIDDLEWARE = [
diff --git a/config/urls.py b/config/urls.py
index 3e76dd6..d47b069 100644
--- a/config/urls.py
+++ b/config/urls.py
@@ -22,6 +22,8 @@
urlpatterns = [
path("", TemplateView.as_view(template_name="base.html"), name="home-example"),
path("admin/", admin.site.urls),
+ path("users/", include("una_hora.users.urls")),
+ path("search/", include("una_hora.search.urls")),
]
if settings.DEBUG:
diff --git a/templates/common/pagination.html b/templates/common/pagination.html
new file mode 100644
index 0000000..952a311
--- /dev/null
+++ b/templates/common/pagination.html
@@ -0,0 +1,63 @@
+
+ {% for last_users in page_obj.object_list %}
+
+ {{last_users.FullName}}
+
+ {% endfor %}
+
+
+
diff --git a/una_hora/search/__init__.py b/una_hora/search/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/una_hora/search/admin.py b/una_hora/search/admin.py
new file mode 100644
index 0000000..e813532
--- /dev/null
+++ b/una_hora/search/admin.py
@@ -0,0 +1,3 @@
+# from django.contrib import admin
+
+# Register your models here.
diff --git a/una_hora/search/apps.py b/una_hora/search/apps.py
new file mode 100644
index 0000000..6acc252
--- /dev/null
+++ b/una_hora/search/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class SearchConfig(AppConfig):
+ name = "una_hora.search"
diff --git a/una_hora/search/migrations/__init__.py b/una_hora/search/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/una_hora/search/models.py b/una_hora/search/models.py
new file mode 100644
index 0000000..812d9cc
--- /dev/null
+++ b/una_hora/search/models.py
@@ -0,0 +1,3 @@
+# from django.db import models
+
+# Create your models here.
diff --git a/una_hora/search/templates/search/search_page.html b/una_hora/search/templates/search/search_page.html
new file mode 100644
index 0000000..a65fb7f
--- /dev/null
+++ b/una_hora/search/templates/search/search_page.html
@@ -0,0 +1,6 @@
+
+
+ {% block body %}
+ Hola mundo desde search.
+ {% endblock %}
+
diff --git a/una_hora/search/tests.py b/una_hora/search/tests.py
new file mode 100644
index 0000000..e9137c8
--- /dev/null
+++ b/una_hora/search/tests.py
@@ -0,0 +1,3 @@
+# from django.test import TestCase
+
+# Create your tests here.
diff --git a/una_hora/search/urls.py b/una_hora/search/urls.py
new file mode 100644
index 0000000..bd092ab
--- /dev/null
+++ b/una_hora/search/urls.py
@@ -0,0 +1,7 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+ path("", views.search_page, name="search_page"),
+]
diff --git a/una_hora/search/views.py b/una_hora/search/views.py
new file mode 100644
index 0000000..ab64a5c
--- /dev/null
+++ b/una_hora/search/views.py
@@ -0,0 +1,7 @@
+from django.shortcuts import render
+
+
+# Create your views here.
+def search_page(request):
+ print("hola")
+ return render(request, "./search/search_page.html")
diff --git a/una_hora/users/models.py b/una_hora/users/models.py
index a09f519..c16e7fb 100644
--- a/una_hora/users/models.py
+++ b/una_hora/users/models.py
@@ -94,6 +94,13 @@ class User(AbstractBaseUser, PermissionsMixin):
USERNAME_FIELD = "email"
REQUIRED_FIELDS = []
+ def serialize(self):
+ return {
+ "id": self.id,
+ "full_name": self.full_name,
+ "bio": self.bio,
+ }
+
def __str__(self):
return self.email
diff --git a/una_hora/users/urls.py b/una_hora/users/urls.py
new file mode 100644
index 0000000..feeff9d
--- /dev/null
+++ b/una_hora/users/urls.py
@@ -0,0 +1,7 @@
+from django.urls import path
+
+from . import views
+
+urlpatterns = [
+ path("", views.last_twelve, name="last_twelve"),
+]
diff --git a/una_hora/users/views.py b/una_hora/users/views.py
new file mode 100644
index 0000000..8a27266
--- /dev/null
+++ b/una_hora/users/views.py
@@ -0,0 +1,18 @@
+from django.core.paginator import Paginator
+from django.shortcuts import render
+
+from .models import User
+
+
+def last_twelve(request):
+ last_users = User.objects.filter(is_active=True)
+ last_users = last_users.order_by("-date_joined").all()
+ paginator = Paginator([last_user.serialize() for last_user in last_users], 12)
+ page_number = request.GET.get("page")
+ page_obj = paginator.get_page(page_number)
+ page_items = len(page_obj)
+ return render(
+ request,
+ "common/pagination.html",
+ {"page_obj": page_obj, "page_items": page_items},
+ )