Skip to content

question about relations and admin GUI #152

@blinkinglight

Description

@blinkinglight

hey,
i am trying to make simple "issue tracker"
user has many projects
issue belongs to project

problem is that in issue, Project "has many" shows all projects and i cant find where i can filter choises out.
this only works in Projects to filter out but not for Project selection in issue.

projects.ListModifier = func(s *uadmin.ModelSchema, u *uadmin.User) (string, []interface{}) {

		var userProject []models.UserProject

		uadmin.Filter(&userProject, "user_id = ?", u.ID)
		var ids []uint
		for _, v := range userProject {
			ids = append(ids, v.ProjectID)
		}

		if !u.Admin {
			return "id in (?)", []interface{}{ids}
		}
		return "", []interface{}{}
	}
	```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions