Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Cannot resolve field "id" #535

Open
binhetech opened this issue Apr 16, 2024 · 0 comments
Open

Bug: Cannot resolve field "id" #535

binhetech opened this issue Apr 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@binhetech
Copy link

Describe the bug
A clear and concise description of what the bug is.

i want to use 'user_id' as the primary key for mongoengine ORM, but when i click the [edit] button from the author admin view, it shows:
mongoengine.errors.InvalidQueryError: Cannot resolve field "id"
so, is the 'id' name the only one ? could i use annother name, such as 'user_id' as the primary key?

To Reproduce
Explain how to reproduce the bug.

class Author(db.Document):
meta = {
'collection': 'author_profile'
}
user_id = db.StringField(min_length=3)
name = db.StringField(min_length=3)
description= db.StringField(max_length=20)

class AuthorView(ModelView):
pk_attr = "user_id"
fields = [
"name",
StringField('description')
]

Environment (please complete the following information):

  • Starlette-Admin version: [0.4.0]
  • ORM/ODMs: [MongoEngine]

Additional context
Add any other context about the problem here.
屏幕截图 2024-04-16 235553

@binhetech binhetech added the bug Something isn't working label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant