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

ValueError: invalid literal for int() with base 10 #64

Closed
androane opened this issue Dec 26, 2017 · 7 comments
Closed

ValueError: invalid literal for int() with base 10 #64

androane opened this issue Dec 26, 2017 · 7 comments

Comments

@androane
Copy link

androane commented Dec 26, 2017

When my model has a pk that is a string, the call hit_count = HitCount.objects.get_for_object(obj) fails with invalid literal for int() with base 10: 'blablabla'

I suppose django hit count is not adapted to strings

@thornomad
Copy link
Owner

thornomad commented Dec 26, 2017 via email

@androane
Copy link
Author

@thornomad Thanks for your reply.

I tried that but it seems that it's still not working. Something is breaking, not sure what...

@karinakozarova
Copy link

I had the same problem. I wrote {% get_hit_count for [event] within [days=1] %}. However it should be {% get_hit_count for event within days=1 %}

@bashu
Copy link
Collaborator

bashu commented Jun 8, 2019

@thornomad this one must be fixed (it was my mistake after all)

@bashu bashu closed this as completed in e5f5dfb Jun 10, 2019
bashu added a commit that referenced this issue Jun 10, 2019
bashu added a commit that referenced this issue Jun 10, 2019
bashu added a commit that referenced this issue Jun 10, 2019
@macher91
Copy link

Hi,
I don't won't create new issue but last version is not resolving problem correctly.
PostgreSQL is "strongly typed", that's why I have errors:

No operator matches the given name and argument type(s). You might need to add explicit type casts.

@joshgeller
Copy link

We are having the same problem with Postgres after upgrading to 1.3.1.

@bashu
Copy link
Collaborator

bashu commented Jul 30, 2019

@macher91 @joshgeller can you try this:

create function pg_catalog.text(int) returns text immutable language sql as $$select textin(int4out($1))$$;
create cast (int as text) with function pg_catalog.text(int) as implicit;

ofekih pushed a commit to The-Ofek-Foundation/hitcount that referenced this issue May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants