Impressive! Using it in a project right now, so much nicer for a
non-beginner like me too. No more regexs!
Looking forward to a Django patched that allows casting of the variables
too.
/Emil
On 2016-09-19 08:57, Sjoerd Job Postmus wrote:
Just wanted to announce the following: it's available on pypi:
https://pypi.python.org/pypi/django-simple-url/0.0.2
Kind regards,
Sjoerd Job
On Thursday, September 15, 2016 at 9:03:21 AM UTC+2, Sjoerd Job Postmus
wrote:
Hi :).
Yes, I also added the other syntax yesterday evening, so the
<int:year> syntax is now fully supported. (But it does not yield an
int!!).
Currently only `'int'` is registered as a valid type, with the regex
r'[0-9]+'. More can be registered using
`django_simple_url.register('hex', '[0-9a-fA-F]+')`.
One downside (still) is that it does not get cast to an int.
Although I'm not really sure if I find it logical that it gets cast.
I don't really have that much time to work on it, but I'm hoping to
add the `setup.py` either later today or shortly after the weekend.
Kind regards,
Sjoerd Job
On Thursday, September 15, 2016 at 8:20:03 AM UTC+2, Emil Stenström
wrote:
Great initiative!
I really think you should use the flask syntax instead of the
rails one that I first suggested. Seems this is the consensus
from this thread, and that makes it more likely to get it to
core one day.
/Emil
On Wednesday, 14 September 2016 11:02:23 UTC+2, Sjoerd Job
Postmus wrote:
Hi all,
Since it seemed like an interesting idea to me, I started
development of a third-party plugin.
It's currently at:
https://github.com/sjoerdjob/django-simple-url
<https://github.com/sjoerdjob/django-simple-url>
Since I only started today, I have no readme/setup.py yet.
Will come later this week I hope.
Current usage is
from django_simple_url import simple_url
urlpatterns = [
simple_url('hello/world/', hello_world_view),
simple_url(':year/:month/', posts_for_month_view),
]
It works proper with includes (not adding a $ to the URL),
and leaf views (adding a $ to the URL).
Maybe this week, or early next week I will also add support
for the '<int:year>' syntax.
Kind regards,
Sjoerd Job
On Tuesday, September 13, 2016 at 9:40:47 PM UTC+2, Tim
Graham wrote:
I would like to see if this could be done as a
third-party project (allow "pluggable URLs" which could
use any syntax). If not, then let's accept a patch to
Django to support it. Over time, if there's some strong
consensus about a particular third-party package, then
we could bring it in to core. I think this approach is
less controversial then Django adopting some new,
untested syntax right now.
On Tuesday, September 13, 2016 at 3:33:25 PM UTC-4, Emil
Stenström wrote:
So it looks to me that the consensus is that this IS
in fact a good idea, to supply a simpler, regex-free
method to define URL:s.
It also seems that the best liked version is
something that's similar to what flask uses:
/articles/<int:year>/<int:month>/.
I've never written a DEP before, but it sounds like
a fun challenge. I'll try to look at existing DEPs
for a pattern and then apply that.
Does anyone have something in particular that they
would like to add to the DEP? I figure I'll try to
keep this first version as simple as possible, while
maintaining extension points for features that can
be added later on.
--
You received this message because you are subscribed to a topic in the
Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-developers/u6sQax3sjO4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
django-developers+unsubscr...@googlegroups.com
<mailto:django-developers+unsubscr...@googlegroups.com>.
To post to this group, send email to django-developers@googlegroups.com
<mailto:django-developers@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/54cdc465-ff11-47ab-905b-0ae6e19c4e83%40googlegroups.com
<https://groups.google.com/d/msgid/django-developers/54cdc465-ff11-47ab-905b-0ae6e19c4e83%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/3db013a1-c9ca-e57f-7b80-bd45303d5757%40gmail.com.
For more options, visit https://groups.google.com/d/optout.