Comments (10)
It seems that "activation.key" is not defined or is None for your first example, that's why app couldn't resolve current_item, and having no current_item where couldn't be any title for a page.
However this behaviour for URL-resolving funtion is logical since noone should ever pass None into \w+.
So the only way sitetree could ease your pain is to render empty string in place of sitetree_page_title instead of 500. A fix is soon to come.
Note: "URL as a pattern" should be checked regardless if you use URL patters in URL edit, e.g. for "registration_activate activation.key".
from django-sitetree.
It seems that your settings.DEBUG is set to True otherwise sitetree_page_title template tag fails silently with empty string for title.
from django-sitetree.
idlesign,
Thank you for your prompt answer.
Github ate the definition of activation.key
url(r'^activate/(?P\w+)/$',
activate,
name='registration_activate'),
should be
url(r'^activate/(?P-lt-activation_key-gt-\w+)/$',
activate,
name='registration_activate'),
where -lt- and -gt- stand for the opening and closing characters surrounding the variable name
Isn't this a declaration that sitetree would interpret as "activation.key" in the URL field?
from django-sitetree.
(?P<activation_key>\w+) — is a named regular expression group and it says that URL should be
activate/{any_alphanumeric_characters_or_underscores_here}/
Django tries to resolve a URL for view registration_activate activation.key
and since activation.key
is None it won't match any URL (None is not an alphanumeric character or underscore
), so it won't match a current sitetree item either. And as long as DEBUG param in your settings.py is set to True you'll get an exception, i.e. 500.
from django-sitetree.
idlesign,
May I ask what would make site tree take something like (?P<category_id>\d+) and convert it into "category.id", but instead not convert something like (?P<activation_key>\w+) into activation.key ?
from django-sitetree.
No-no, I dare say, that you're taking the whole idea wrong: sitetree won't convert anything, it plays by rules, you defined for it.
When you put in admin URL-pattern registration_activate activation.key
sitetree will try to get activation.key
variable from template context for the requested page; and then will try to find a URL from those that are defined in your urls.py (and similar) that will match name registration_activate
and is able to handle the value passed to it by activation.key
.
I hope that answers your question %)
from django-sitetree.
And that is the request context one defines in the view... I was putting in the template hoping that this would create an "activation" object in my context. But template contexts are defined in the views...
django-registration does not define an "activation" object in the context of activate.html, despite using "activation_id" to name the regular expression in the URL. By naming a regular expression in the URL, one can refer to it in the args and kwargs arguments of the view, and that's all django-registration does with it...
from django-sitetree.
I've had a look at django-registration and it seems that registration_activate
is a stand-in-the-middle view, so the only chance for a user to see your activate.html
page is to enter an invalid key.
There is a little sense in defining a sitetree item specifically for stand-in-the-middle pages, because they do not exactly belong to site stucture as a whole, if you catch my meaning.
So for you there are two options, I think:
- Not to use sitetree for
activate.html
(you may harcode the header and not usesitetree_page_title
); - Or you can do it a hard way, by overriding activate view so that
registration_activate activation.key
resolves correctly.extra_context
view param seems to be a good starting point.
from django-sitetree.
I went for option 1.
In my activate.html template instead of this:
{% block page_title %}
{% sitetree_page_title from "root" %}
{% endblock %}I use this:
{% block page_title %}
Account activation
{% endblock %}And skip breadcrumbs and menus...
Thank you!! :-)
from django-sitetree.
You're welcome.
from django-sitetree.
Related Issues (20)
- Dynamic Trees - missing something? HOT 6
- Finer add permission check for displaying the "Add site tree Item" button HOT 3
- Incorporate one dynamic tree into another HOT 2
- How to pass the data models to a menu template ? HOT 4
- Menu Components only appear when the current page HOT 5
- Django 3.1 compatibility HOT 2
- Tests are missing from the sdist HOT 1
- Matching this when multiple URL matches fails HOT 2
- Tree items not displayed in menu if url contains certain special characters HOT 4
- Query the AppConfig directly for its module name HOT 4
- NoReverseMatch on custom models HOT 5
- SiteTree class not returning current item HOT 1
- Sitetreedump with "tree" arguments don't work correctly HOT 1
- compose_dynamic_tree with access_by_perms called in `config.ready` results in database errors HOT 3
- Allow HTML in title_resolved (to allow font-awesome icons) HOT 4
- When changing DEFAULT_AUTO_FIELD setting there are pending migrations
- Building and using a dynamic menu HOT 2
- Dynamic tree items: allow custom attribute binding in item() HOT 1
- Dynamic tree items: simplified access check
- Mapping nested entities to bread crumbs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-sitetree.