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

AttributeError 'APISHistoricalRecords' object has no attribute 'id' #1450

Closed
koeaw opened this issue Nov 26, 2024 · 1 comment · Fixed by #1452 or #1428
Closed

AttributeError 'APISHistoricalRecords' object has no attribute 'id' #1450

koeaw opened this issue Nov 26, 2024 · 1 comment · Fixed by #1452 or #1428

Comments

@koeaw
Copy link
Contributor

koeaw commented Nov 26, 2024

I'm getting this error after switching from v0.29.0 to v.0.30.0 and trying to run my app locally, the culprit seems to be:

class GenericModel:
def __repr__(self):
return super().__repr__() + f" (ID: {self.id})"

Note: TB's pyproject.toml may say it's on v0.30.0 but I'd forgotten to update my dependencies/switch branch... I.e. I created (migrations for) all models so far on v0.29.0 and everything worked fine.

This sounds like I'm missing id fields in my History models, which... shouldn't be the case, should it?

@koeaw
Copy link
Contributor Author

koeaw commented Nov 26, 2024

Hmm, ok, this seems to only happen with the debug toolbar enabled, will investigate further at a later point.

b1rger added a commit that referenced this issue Nov 27, 2024
Some models do not have an `id` attribute, therefore it makes sense to
check for its existence before using it in the __repr__ string.

Closes: #1450
@b1rger b1rger closed this as completed in 076e9f3 Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant