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

Cannot delete translations in the admin #317

Closed
orf opened this issue Oct 22, 2016 · 10 comments
Closed

Cannot delete translations in the admin #317

orf opened this issue Oct 22, 2016 · 10 comments
Labels
Milestone

Comments

@orf
Copy link

orf commented Oct 22, 2016

Hi,
I've got a model with a string pk, e.g com.test.app. I can no longer delete translations within the admin, because inside delete_translation the object_id parameter is 'com.test.app/change', where I think it should just be com.test.app.

This triggers the raise Http404 error.

@spectras spectras added the bug label Oct 28, 2016
@spectras
Copy link
Collaborator

Hello,
Thanks for reporting. I am very, very low on time until the beginning of December, at which point I'll have some time for hvad again. I will try to see fixing it before, but no promises.

@spectras
Copy link
Collaborator

I gave it a go last night, and was not able to reproduce the bug. Could you please show me a sample of your model / admin that exhibits the bad behavior? Thanks!

@michalkaspar
Copy link

Hi,
I have a same issue. I see problem in this code:

return [ url(r'^(.+)/delete-translation/(.+)/$', self.admin_site.admin_view(self.delete_translation), name='%s_%s_delete_translation' % info), ] + urlpatterns

Variable object_id is there whole url before /delete-translation/ which contains also '/change' part.

@spectras
Copy link
Collaborator

spectras commented Jan 26, 2017

Hello! Excellent catch.
Though I still don't understand how comes the /change part ends up before delete-translation.

Does it happen when you click the "Delete Translation" link on the change page, or when you confirm deletion in the subsequent page?
And, if it's when you confirm deletion, can you tell me whether there is already a /change in the url in your browser just before you confirm, then when you get the error?

@michalkaspar
Copy link

It happens when i click on "Delete Translation" link in change page.

@spectras
Copy link
Collaborator

Thanks. Could you also tell me whether:

  • The delete translation link has the /change part before delete-translation?
  • The change page itself has the /change part doubled?

Also, just to be sure I'm testing with the right version, can you tell me which Django version you run?

@michalkaspar
Copy link

Thanks for quick response,

my url looks for example like: .../5263/change/delete-translation/cs

I'm using python 3.5 and django 1.10.4.

@spectras
Copy link
Collaborator

Thanks to you.
Well, that url is incorrectly generated. I'll try to see why…

@spectras
Copy link
Collaborator

I think found the culprit. A sub-template generates dumb relative urls. Not a problem with numeric pk as the /change part just gets discarded, but troublesome with string pks obviously. Fix going through travis testing now.

@spectras
Copy link
Collaborator

Issue should be fixed on master. You can try it using pip install https://github.com/KristianOellegaard/django-hvad/archive/master.zip.

@spectras spectras added this to the v1.7.0 milestone Jan 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants