Skip to content

Commit f7a8da2

Browse files
author
Your Name
committed
Feat: Add recently registered orgs to registration page
1 parent 21151b5 commit f7a8da2

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

website/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ def save(self, *args, **kwargs):
230230

231231
super().save(*args, **kwargs)
232232

233+
def get_absolute_url(self):
234+
return reverse("organization_detail", kwargs={"slug": self.slug})
235+
233236

234237
class JoinRequest(models.Model):
235238
team = models.ForeignKey(Organization, null=True, blank=True, on_delete=models.CASCADE)

website/templates/organization/register_organization.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,36 @@ <h2 class="ml-4 text-xl font-semibold text-gray-900">{% trans "Organization Mana
217217
</button>
218218
</div>
219219
</form>
220+
{% if recent_organizations %}
221+
<div class="mt-8">
222+
<h3 class="text-lg font-medium leading-6 text-gray-900">Recently Registered Organizations</h3>
223+
<p class="mt-1 text-sm text-gray-600">Check out the latest organizations that have joined our platform.</p>
224+
<ul role="list"
225+
class="mt-3 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3">
226+
{% for org in recent_organizations %}
227+
<li class="col-span-1 flex rounded-md shadow-sm">
228+
<div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md">
229+
<svg class="h-8 w-8 text-gray-600"
230+
xmlns="http://www.w3.org/2000/svg"
231+
fill="none"
232+
viewBox="0 0 24 24"
233+
stroke-width="1.5"
234+
stroke="currentColor">
235+
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M8.25 6h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5m-7.5 3h7.5" />
236+
</svg>
237+
</div>
238+
<div class="flex flex-1 items-center justify-between truncate rounded-r-md border-b border-r border-t border-gray-200 bg-white">
239+
<div class="flex-1 truncate px-4 py-2 text-sm">
240+
<a href="{{ org.get_absolute_url }}"
241+
class="font-medium text-gray-900 hover:text-gray-600">{{ org.name }}</a>
242+
<p class="text-gray-500">{{ org.created|timesince }} ago</p>
243+
</div>
244+
</div>
245+
</li>
246+
{% endfor %}
247+
</ul>
248+
</div>
249+
{% endif %}
220250
</div>
221251
</div>
222252
<!-- Notification Messages -->

website/views/company.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ def dashboard_view(request, *args, **kwargs):
133133

134134
class RegisterOrganizationView(View):
135135
def get(self, request, *args, **kwargs):
136-
return render(request, "organization/register_organization.html")
136+
recent_organizations = Organization.objects.all().order_by("-created")[:5]
137+
context = {"recent_organizations": recent_organizations}
138+
return render(request, "organization/register_organization.html", context)
137139

138140
def post(self, request, *args, **kwargs):
139141
user = request.user

0 commit comments

Comments
 (0)