Skip to content

Conversation

@Satish-Medar
Copy link

@Satish-Medar Satish-Medar commented Nov 17, 2025

Closes #4802

This is a new, clean PR for the "Recently Registered Organizations" feature, as requested by @DonnieBLT.

The previous PR (#4801) was closed due to including unrelated files and merge conflicts. This new PR contains only the 3 files necessary for the feature, has been fully formatted, and is 100% clean.

The code has been tested locally and is working as expected.

Screenshot 2025-11-17 230525

Summary by CodeRabbit

Release Notes

  • New Features

    • Recently Registered Organizations section now appears on the organization registration page, displaying the five most recently created organizations with direct links and timestamps.
  • Improvements

    • Enhanced notification system with broader message handling supporting additional alert types.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

The changes implement a feature to display the five most recently registered organizations on the organization registration page. This includes adding a get_absolute_url() method to the Organization model, fetching recent active organizations in the view, and rendering them in a new template section with improved notification handling.

Changes

Cohort / File(s) Summary
Model Enhancement
website/models.py
Adds get_absolute_url() method to Organization model that returns the detail URL using the organization's slug via reverse("organization_detail", kwargs={"slug": self.slug}).
View Logic
website/views/company.py
Updates RegisterOrganizationView.get() to fetch the five most recently created active organizations and pass them to the template under the recent_organizations context key.
Template Updates
website/templates/organization/register_organization.html
Adds "Recently Registered Organizations" section that displays a grid of organization items with links and timestamps; expands notification rendering to support a default message branch alongside existing error, warning, and success branches; removes non-functional HTML comments.

Sequence Diagram

sequenceDiagram
    participant User
    participant View as RegisterOrganizationView
    participant DB as Database
    participant Template

    User->>View: GET /register-org
    View->>DB: Query 5 most recent<br/>active organizations
    DB-->>View: Organizations list
    View->>Template: Render with context<br/>(recent_organizations)
    Template-->>User: HTML with recent orgs<br/>section + form
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify the get_absolute_url() method follows Django conventions and any URL naming conventions in the codebase
  • Confirm the organization query (active status, ordering by creation date, limit enforcement) is correct and performant
  • Review template rendering logic for the grid layout, links, and timestamp display formatting
  • Ensure the expanded notification handling covers all message levels appropriately without breaking existing behavior

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: adding recently registered organizations to the registration page, which matches the primary objective.
Linked Issues check ✅ Passed The PR implementation fully satisfies issue #4802 requirements: fetches 5 most recently registered organizations and displays them on the registration page with proper UI integration.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the linked issue objective. The three modified files (models.py, template, and views) each serve a specific purpose for the feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added unresolved-conversations: 0 PR has 0 unresolved conversations files-changed: 3 PR changes 3 files labels Nov 17, 2025
@github-actions
Copy link
Contributor

👋 Hi @Satish-Medar!

This pull request needs a peer review before it can be merged. Please request a review from a team member who is not:

  • The PR author
  • DonnieBLT
  • coderabbit
  • copilot

Once a valid peer review is submitted, this check will pass automatically. Thank you!

@github-actions github-actions bot added the has-conflicts PR has merge conflicts that need to be resolved label Nov 17, 2025
@github-actions
Copy link
Contributor

⚠️ Merge Conflicts Detected

Hi @Satish-Medar!

This pull request has merge conflicts with the base branch that need to be resolved before it can be merged.

To resolve the conflicts:

  1. Sync your branch with the base branch:

    git fetch origin
    git merge origin/main
  2. Resolve any conflicts in your editor

  3. Commit the changes:

    git add .
    git commit -m "Resolve merge conflicts"
    git push

Once you push the resolved conflicts, this label and comment will be automatically updated.

Thank you! 🙏

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
website/templates/organization/register_organization.html (1)

208-237: LGTM! Well-structured recent organizations section.

The implementation correctly displays the recent organizations with:

  • Conditional rendering that only shows when data exists
  • Responsive grid layout (1/2/3 columns)
  • Proper use of semantic HTML and ARIA attributes
  • Safe template variable usage with auto-escaping
  • Clean integration with the new get_absolute_url() method

Optional enhancement: Display actual organization logos

Consider displaying the actual organization logo when available instead of the generic building icon:

-<div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md">
-    <svg class="h-8 w-8 text-gray-600"
-         xmlns="http://www.w3.org/2000/svg"
-         fill="none"
-         viewBox="0 0 24 24"
-         stroke-width="1.5"
-         stroke="currentColor">
-        <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" />
-    </svg>
-</div>
+<div class="flex-shrink-0 flex items-center justify-center w-16 h-16 bg-gray-200 rounded-l-md overflow-hidden">
+    {% if org.logo %}
+        <img src="{{ org.logo.url }}" alt="{{ org.name }} logo" class="h-full w-full object-cover">
+    {% else %}
+        <svg class="h-8 w-8 text-gray-600"
+             xmlns="http://www.w3.org/2000/svg"
+             fill="none"
+             viewBox="0 0 24 24"
+             stroke-width="1.5"
+             stroke="currentColor">
+            <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" />
+        </svg>
+    {% endif %}
+</div>

This would make the section more visually distinctive while maintaining the clean fallback.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 180761a and 9713277.

📒 Files selected for processing (3)
  • website/models.py (1 hunks)
  • website/templates/organization/register_organization.html (3 hunks)
  • website/views/company.py (1 hunks)
🔇 Additional comments (3)
website/views/company.py (1)

136-138: LGTM! Clean implementation of the recent organizations feature.

The query logic correctly fetches the 5 most recently created active organizations. The use of is_active=True filter is appropriate since organizations are set to active upon creation (line 182 in the POST method).

website/models.py (1)

233-234: LGTM! Standard Django pattern for canonical URLs.

The method correctly returns the absolute URL using the organization's slug. The slug is guaranteed to exist due to the save() method (lines 219-231) which auto-generates unique slugs when needed.

website/templates/organization/register_organization.html (1)

263-320: LGTM! Improved notification handling with default info branch.

The addition of the {% else %} branch provides complete coverage for messages that don't match the standard error/warning/success levels. The info-style styling with the fa-info-circle icon is appropriate and maintains consistency with the existing notification patterns.

@github-project-automation github-project-automation bot moved this from Backlog to Ready in 📌 OWASP BLT Project Board Nov 17, 2025
@github-actions
Copy link
Contributor

❌ Pre-commit checks failed

The pre-commit hooks found issues that need to be fixed. Please run the following commands locally to fix them:

# Install pre-commit if you haven't already
pip install pre-commit

# Run pre-commit on all files
pre-commit run --all-files

# Or run pre-commit on staged files only
pre-commit run

After running these commands, the pre-commit hooks will automatically fix most issues.
Please review the changes, commit them, and push to your branch.

💡 Tip: You can set up pre-commit to run automatically on every commit by running:

pre-commit install
Pre-commit output
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/pycqa/isort.
[WARNING] repo `https://github.com/pycqa/isort` uses deprecated stage names (commit, merge-commit, push) which will be removed in a future version.  Hint: often `pre-commit autoupdate --repo https://github.com/pycqa/isort` will fix this.  if it does not -- consider reporting an issue to that repo.
[INFO] Initializing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Initializing environment for https://github.com/djlint/djLint.
[INFO] Initializing environment for local.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/astral-sh/ruff-pre-commit.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/djlint/djLint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for local.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
check python ast.........................................................Passed
check builtin type constructor use.......................................Passed
check yaml...............................................................Passed
fix python encoding pragma...............................................Passed
mixed line ending........................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /home/runner/work/BLT/BLT/blt/urls.py


For more information, see the pre-commit documentation.

@github-actions github-actions bot added the pre-commit: failed Pre-commit checks failed label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

files-changed: 3 PR changes 3 files has-conflicts PR has merge conflicts that need to be resolved pre-commit: failed Pre-commit checks failed unresolved-conversations: 0 PR has 0 unresolved conversations

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

Feature: Add Recently Registered Orgs to Registration Page

1 participant