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

supports Django 1.11 #28

Closed
dubirajara opened this issue Apr 4, 2017 · 11 comments
Closed

supports Django 1.11 #28

dubirajara opened this issue Apr 4, 2017 · 11 comments

Comments

@dubirajara
Copy link
Contributor

hi, does not support the new django 1.11 version?
i have this problem:

ERRORS:
core._Tagulous_Ideas_tags: (models.E023) The model name '_Tagulous_Ideas_tags' cannot start or end with an underscore as it collides with the query lookup syntax.
The command "python manage.py migrate" failed and exited with 1 during .

thanks

@radiac
Copy link
Owner

radiac commented Apr 5, 2017

I don't think anybody has started work on 1.11 support yet - I'll update this issue when there is news.

@theskumar
Copy link

theskumar commented May 17, 2017

Django 1.11 is here 🎉 Wondering if we can get this in! :)

@tomasgarzon
Copy link

Hi, when do you think we will have the next release with this issue resolved?

@dubirajara
Copy link
Contributor Author

hi @radiac , i fork this project and i change the Prefix for models auto-generated by tagulous, i remove MODEL_PREFIX "undercore _" to work django versión 1.11, now its work fine with Django 1.11
Can I have a problem with that change I made?

@ricosalomar
Copy link

An easy fix is to use a custom tag model, a la:

class TagModel(tagulous.models.TagModel):
    class TagMeta:
        pass
class MyModel(models.Model):
    ....
    tags = tagulous.models.TagField(to=TagModel)

That way tagulous doesn't need to auto-generate model names.

@dubirajara
Copy link
Contributor Author

dubirajara commented Jul 1, 2017

@ricosalomar its not work to me. ValueError: Cannot set tag options on explicit tag model <class 'myideas.core.models.TagModel'>

@ricosalomar
Copy link

ricosalomar commented Jul 1, 2017

@dubirajara I'm running Django 1.11 and Python 3.5. And it's working for me.
According to your error, it looks like you should check to see which tag_options you are setting (don't set any in the field declaration).
Also, give it a better name, like MyTagModel.
I believe you need to set options in MyTagModel.TagMeta and not in the field.
E.g.:

class MyTagModel(tagulous.models.TagModel):
    class TagMeta:
        autocomplete_view = 'tags_autocomplete'

And the field declaration needs to have no options, except to=...

tags = tagulous.models.TagField(to=MyTagModel)

This will require migrations, of course.
Any chance you could verify @radiac ?

@radiac
Copy link
Owner

radiac commented Jul 2, 2017

Sorry for the delay getting on to this - @dubirajara is right, the main issue seems to be the leading _ in the model prefix, and removing that seems to get everything working. As @ricosalomar says, a custom tag model will get around that problem altogether (and yes, tag options on custom tag models have to be set on the model itself - otherwise you could end up with two tag fields pointing at the same custom tag model with different options, which would lead to madness).

I've now got a working branch with experimental Django 1.11 support - that is to say some tests are failing, but they don't seem to be failing in a way which should have much of an impact. At least I think - hence "experimental".

I'm really busy irl at the moment, but hope to get the remaining failing tests fixed and Tagulous 0.13.0 out shortly.

In the meantime, you should be able to install the branch with:

pip install -e git+https://github.com/radiac/django-tagulous.git@feature/django-1_11#egg=django-tagulous

Be sure to read the upgrade instructions for this next version though - because the prefix has changed, you'll need to create migrations to rename your auto-generated tag models.

@metaljoe
Copy link

Hi. I'm upgrading a Django application to 1.11 and had the same problem. Is there an update on when 0.13.0 will be available?

Oh, and thanks for this library - it's been really useful!

@radiac
Copy link
Owner

radiac commented Apr 30, 2018

0.13.0 has now been released, supporting Django 1.11.

Thanks for your patience everyone - life has been hectic!

@radiac radiac closed this as completed Apr 30, 2018
@metaljoe
Copy link

Big thank you for releasing this 👍

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