I'm trying to set up my app in two languages, however I'm getting 404 error on all app's urls, even though I've set up another app a while ago the exact same way.
models.py:
class New(models.Model):
title = models.CharField(max_length=300)
slug = models.SlugField(max_length=300, editable=False)
pub_date = models.DateTimeField(auto_now_add=True)
text = models.TextField()
def __unicode__(self):
return self.title
def save(self, *args, **kwargs):
if not self.id:
# Newly created object, so set slug
self.slug = slugify(self.title)
super(New, self).save(*args, **kwargs)
translation.py:
class NewTranslationOptions(TranslationOptions):
fields = ('title','text')
translator.register(New, NewTranslationOptions)
urls.py:
urlpatterns += i18n_patterns('',
url(r'^categories/$', 'products.views.categories_index', name='categories_index'),
url(r'^(?P<category_slug>[\w-]+)/$', 'products.views.specific_category', name='specific_category'),
url(r'^(?P<category_slug>[\w-]+)/(?P<product_slug>[\w-]+)/$', 'products.views.specific_product', name='specific_product'),
url(r'^news/$', 'news.views.news_index', name='news_index'),
url(r'^news/(?P<news_slug>[\w-]+)/$', 'news.views.specific_new', name='specific_new'),
)
Here you can also see urls of my other app products, it works just fine. If you need anything else please let me know.
Your
specific_category
andspecific_product
url patterns are catching urls fromnews
app:Reorder your urls patterns:
Or, consider adding
category/
prefix to patterns fromproducts
app: