hackforla / hackforla/knowledgebase

M-M: Organization to User - create table, api, and tests

Open
#49 0 comments 0 reactions 0 assignees View on GitHub
category: M-M complexity: medium dependency draft feature: table: organization milestone: missing role: back end dev size: 2pt
Dominant language
Python
Stars
2
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Dependencies
- #47

### Overview
As a user I want to be able to see what practice areas are associated with an asset group

### Action Items

- [ ] Remove ManyToMany field for Tool in the Asset Group model
- [ ] Add model AssetGroupsToolsMM with two foreign keys. See PracticeArea as an example.
- [ ] Add code something like this to model_inline.py, replacing AssetGroup with Organizations and Tool with User:
ic```
class AssetGroupsToolInline(admin.TabularInline):
model = AssetGroupsToolsMM
extra = 5

class AssetGroupsToolsAdmin(admin.ModelAdmin):
inlines = [AssetGroupToolsInline]
list_display = ("Tools.name")
search_fields = ["Tools.name"]
```
- Add to admin.py:
```
admin.register(Assets, AssetGroupsToolAdmin)
```

### Manual Verification
- From UI, you should be able to add multiple users to an organization and only the added tools will show on the screen
- From DBVisualizer or other Postgres ide you should be able to see creation and update info in AssetsToolsMM table.

Contributor guide

Open the contributing guide

Research direction

Start by checking dependency #47 and the PracticeArea model example. Then inspect model_inline.py and admin.py, paying attention to the mismatch between the Organization/User title and the AssetGroup/Tool action items. Done means the intended relationship is represented, exposed in the admin UI, covered by tests, and its creation and update data can be verified in the Postgres table.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
api, backend, database, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.