hackforla / hackforla/knowledgebase

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

未关闭
#49 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
category: M-M complexity: medium dependency draft feature: table: organization milestone: missing role: back end dev size: 2pt
主要语言
Python
星标
2
派生
5
PR 合并指标
30 天内没有已合并 PR

描述

### 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.

贡献指南

打开贡献指南

调研方向

首先检查 dependency #47 和 PracticeArea 模型示例。然后检查 model_inline.py 和 admin.py,注意 Organization/User 标题与 AssetGroup/Tool 操作项之间的不匹配。完成的标准是:预期的关系已得到表示、已在 admin UI 中公开、已有测试覆盖,并且可以在 Postgres 表中验证其创建和更新数据。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python
领域
api, backend, database, testing
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。