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: 'bool' object has no attribute 'last' #12

Open
bibekbc opened this issue May 24, 2017 · 1 comment
Open

AttributeError: 'bool' object has no attribute 'last' #12

bibekbc opened this issue May 24, 2017 · 1 comment

Comments

@bibekbc
Copy link

bibekbc commented May 24, 2017

Hello Sir,
I am having trouble when I want to make a post. After I press the button 'SAVE' I get an error .
/posts/models.py", line 30, in upload_location
new_id = qs.last().id + 1
AttributeError: 'bool' object has no attribute 'last'

@MayurUp
Copy link

MayurUp commented Mar 10, 2019

You can try..
Simple return
return "%s/%s" %(instance.id, filename)

Skip,
#filebase, extension = filename.split(".")
#return "%s/%s.%s" %(instance.id, instance.id, extension)
# PostModel = instance.class
# new_id = 1
# qs = PostModel.objects.order_by("id").exists()
# if qs:
# new_id = qs.last().id + 1

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

2 participants