I'm trying to internationalize my site with Django CMS 3.7.
The language code and content are all setup fine, but I couldn't setup the URL with multilingual.
When I tried to set URL with another language (e.g. Chinese) I got the error message: "Slug must not be empty."
Only English works. See screenshot attached.
Any ideas to fix this?
You just have to put a slug for each language on each page, the slug is what will be shown in the url after the language code.
Example:
Page: Home
ENG:
slug = home
ESP:
slug = inicio
.
.
.
Related
In the Admin pages of the Polls Tutorial there is a link to "View Site" that has the URL http://localhost:8000/ but it should be http://localhost:8000/polls/ to list the polls in the indexView class.
I could not find where to change that View Site link.
Right now with the Polls Tutorial done and all working except this last little bit I want to get it done to use as a reference.
http://localhost:8000 now gives...
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
polls/
admin/
The empty path didn’t match any of these.
The best way for me was to change the "View Site" link in the admin header.
go to admin.py and set
admin.site.site_url = 'http://localhost:8000/instruction/'
I have a django site onto which I have added wagtail following these instructions.
I have set up Social Media setting using these instructions
I have sucessfully added details on the admin page ad I can return and edit these details
However I cannot access them in a template
If I display
{{settings.site_settings.SiteSettings.facebook}}
I get '' (tested using {% if settings.site_settings.SiteSettings.facebook == '' ...)
However
{{settings.site_settings.SiteSettings}}
returns None
and
{{settings.site_settings}}
returns SettingsModuleProxy(site_settings)
What am I doing wrong?
The problem was simply that I had misspelt the SiteSettings class name in models.py (very red-face)
I am new in python django 1.9 and tried to redirect using urls.py file,
Here I explain actually what I tried.
Old : www.abc.com/c.aaa.html , www.abc.com/p.aaa.html and www.abc.com/books2
just redirect to home page like www.abc.com
url(r'/c.*$', include('apps.urls'),name='home'),
url(r'/p.*$', include('apps.urls'),name='home')
Try to use django's base RedirectView. For example you could do this:
url(r'/c.aaa.html$', RedirectView.as_view(url='/'), name='go-to-home'),
Check this and this documentation materials for information on how to do redirects in django.
I am developing cmdb application and trying to create a link to admin page of the device ( /admin/cmdb/device/device_id/) in django-tables2 LinkColumn with the following syntax:
id = tables.LinkColumn('admin:cmdb:device', args=[A('pk')])
This fails with error
NoReverseMatch at /cmdb/emp/171/
'cmdb' is not a registered namespace inside 'admin'
(/cmdb/emp/171/ - is the page on which the table is rendered)
How can I write the correct path in LinkColumn argument to Django admin page?
The goal could be achieved by using TemplateColumn:
id2 = tables.TemplateColumn('{{record.id}}')
but possibly someone could advise how to use LinkColumn?
Your question is not about the LinkColumn but about finding out the url names of the django admin pages.
In any case, you can find your answer here: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls
So if the name of your application is cmdb and the name of your model is device, the url name of the device edit page would be admin:cmdb_device_change which could be used in the LinkColumn (also it can be used in the TemplateColumn using {% url "admin:cmdb_device_chang" record.id %}).
I'm trying to put my Django site in a subpath, say www.example.com/mysite/ but I can't get it to work 100%.
I read up on the answer Django Apache Redirect Problem , where it is suggested to just change the site in the admin from www.example.com to www.example.com/mysite/, which is exactly what I want to do and it almost works. All urls in the main urls.py gets redirected properly, but everything in the includes drop the "mysite" directive when using the links in the templates (one example is {% url journal_index %} which after the change should go to www.example.com/mysite/journal but goes go www.example.com/journal/).
Hope this makes sense.
Cheers!
Try adding the FORCE_SCRIPT_NAME setting:
FORCE_SCRIPT_NAME = '/mysite'