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
[Bug] related_name in blog.models.Post made translatable #25
Comments
this should be fixed in scotu/mightylemon@37a087f Other (little) work has been done in my locale-it branch on translatable strings apart from italian translations if you are interested |
Thanks for the answer. I've got one more question to you. How do you deal with locale settings? After I set LANGUAGE_CODE='pl' I have to do some hacks to have archive working. Here is what happens:
I wonder what is your solution for the above issues. |
I've noticed that too, but I haven't dugg into the problem right now... I'm glad you've done so :) thanks The best long term solution I see is avoid using the three-letters formatting for the month but go with the number. Doing so the url does not need to be translated and we can have one url for one resource instead of lots of urls for one resource (web crawlers...) I'm looking forward other proposals... |
Yup. This is what I did. I replaced %b with %m (number of month) in blog.models.Post's get_absulute_url and changed blog.models.urls adding a month_format:'%m' to date_based_dict as well as modfied regexes to expect a number: (?P\d{2}). |
Related_name set for "blog" field in "Post" in blog.models shouldn't be translatable.
The code is:
class Post(models.Model):
blog = models.ForeignKey(Blog, related_name=_("posts"))
This breaks things as soon as i18n is enabled and "posts" is translated to other language. You get an attribute error when blog.posts is called (for example in blog.views.py in privileged_post_queryset.
The solution is to change the above code to:
class Post(models.Model):
blog = models.ForeignKey(Blog, related_name="posts")
The text was updated successfully, but these errors were encountered: