Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions website/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,17 @@ def __init__(self, *args, **kwargs):
# When editing, show all repositories from the organization
self.fields["repositories"].queryset = Repo.objects.filter(organization=self.instance.organization)
else:
# When creating new, start with empty queryset
self.fields["repositories"].queryset = Repo.objects.none()
# When creating new, try to get organization from form data
organization_id = None
if "data" in kwargs and kwargs["data"]:
organization_id = kwargs["data"].get("organization")

if organization_id:
# Show repositories from the selected organization
self.fields["repositories"].queryset = Repo.objects.filter(organization_id=organization_id)
else:
# No organization selected yet, start with empty queryset
self.fields["repositories"].queryset = Repo.objects.none()

def clean_new_repo_urls(self):
"""Validate and parse new repository URLs."""
Expand Down
Loading