pallets-eco / pallets-eco/flask-admin

Add Related or ForeignKey Model

Open
#472 7 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
6.1k
Forks
1.6k
Avg merge
6d 14h
Merged PRs (30d)
1

Description

Currently, relationships are generally handled nicely, but adding an entry that references multiple related models is cumbersome.

I have a model that references 3 other models via ForeignKey. Let's just call it a Store model. The store model references an owner, a district and a category. To add a new store, you can select from all the available owners, districts and categories. But if you have to add a new store that has a new owner, district and category, you find yourself bouncing around creating 3 models and then the final Store entry.

It would be nice if, like Django, there would be something like an "add" button next to the ForeignKey fields, the entry form could appear in a popup window, or a modal if you want to utilize bootstrap. Upon saving the new entry, the field is completed for you with the new entry selected.

Any thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing ForeignKey field rendering and add/edit form flow, focusing on how related entries are currently selected. Define the popup or modal behavior, including Bootstrap integration if used, and verify that saving a related entry selects it in the original form.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.