Hi
I'm guessing this is going to involve regexp or something, but I'll give it a shot. At the minute, a user can break a website by typing something similar to £$(*£$(£@$&£($ in the title field, which is converted into a slug using Django slugify.
Because none of these characters can be converted, Django returns an error. My question ...
You know, like myblog.com/posts/donald-e-knuth.
Should I do this with the built in parameterize method?
What about a plugin? I could imagine a plugin being nice for handling duplicate slugs, etc. Here are some popular Github plugins -- does anyone have any experience with them?
http://github.com/rsl/stringex/tree/master
http://github...
hello,
I am writing a URL Slug for routing. Should I leave the slug constraint blank or what?
Here is my code:
routes.MapRoute(
null,
"q/{slug}/{id}",
new { controller = "q", action = "Index" },
new { id = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-f...
I have a user model and a profile model.
user has_one :profile
profile belongs_to :user
Because of this relationship, I pull up my profiles by calling the user id. So my urls look like this: website.com/users/[user_id]/profile
I'm not sure if there's a solution to my problem. Here it is:
I would like to display SEO friendly urls. I'...
is there a way to get the same results of using pre-populated fields in django's admin site for slug fields in a standard modelform
...
I'm currently working on a toy project in Django.
Part of my app allows users to leave reviews. I'd like to take the title of the review and slugify it to create a url.
So, if a user writes a review called "The best thing ever!", the url would be something like: www.example.com/reviews/the-best-thing-ever.
That's all well and good...
Hi - I am working on a django project and would like to include a slug at the end of the url, as is done here on stackoverflow.com: http://example.com/object/1/my-slug-generated-from-my-title
The object ID will be used to look up the item, not the slug -- and, like stackoverflow.com, the slug won't matter at all when getting the link (j...
Hi
I have asked on here before about mod_rewrite and got the perfect answer but now I need to do something more complex and really needed the advice of someone who knows mod_rewrite much better.
My rewrite rule looks like this so far:
RewriteRule ([a-zA-Z_-]+)/([0-9]?) index.php?cat=$1&page=$2
And that shows the URL as follows: /cat...
A site in Vietnamese, it is virtually no different to English. However, there is a problem that is slug. When I type characters such as "ư", "ơ", "á",... Django is not identified. Solution here is to replace characters that do not sign into.
Eg:
ư -> u
ơ -> o
á -> a
One from "những-viên-kẹo" will become "nhung-vien-keo".
However,...
I am trying to enable sluggified URLs in Django of the form that SO uses: example.com/id/slug.
I have no problem enabling slugs, and have URLs currently set up of the form: http://127.0.0.1:8000/articles/id/ (eg. /articles/1/) and that works fine. The corresponding URLpattern is:
(r'^(?P<object_id>\d+)/$', 'django.views.generic.list_de...
Web frameworks such as Rails and Django has built-in support for "slugs" which are used to generate readable and SEO-friendly URLs:
Slugs in Rails
Slugs in Django
A slug string typically contains only of the characters a-z, 0-9 and - and can hence be written without URL-escaping (think "foo%20bar").
I'm looking for a Java slug funct...
I'm about to setup permalinks on a website and I'm wondering what sort of conventions I should follow in regards to generating them from the existing table of news articles.
So far here are the rules/steps I've come up with:
Create a dump file of my live database, set it up locally
Add a new 'permalink' column to my news_articles tabl...
On my PHP site, currently users login with an email address and a password. I would like to add a username as well, this username they g\set will be unique and they cannot change it. I am wondering how I can make this name have no spaces in it and work in a URL so I can use there username to link to there profiles and other stuff. If ...
I have a database design case which I am curios whether Doctrine ORM supports it out-of-box.
Product:
columns:
id: {type: integer, primary: true, autoincrement: true }
type_id: { type: integer, notnull: true }
brand_id: { type: integer, notnull: true }
relations:
ProductType:
class: ProductType
loc...
Django has a unique_for_date property you can set when adding a SlugField to your model. This causes the slug to be unique only for the Date of the field you specify:
class Example(models.Model):
title = models.CharField()
slug = models.SlugField(unique_for_date='publish')
publish = models.DateTimeField()
What would be the...
I'm trying to translate the following slugify method from PHP to C#:
http://snipplr.com/view/22741/slugify-a-string-in-php/
Edit: For the sake of convenience, here the code from above:
/**
* Modifies a string to remove al non ASCII characters and spaces.
*/
static public function slugify($text)
{
// replace non letter or digits ...
I'd like my website to have URLs looking like this:
example.com/2010/02/my-first-post
I have my Post model with slug field ('my-first-post') and published_on field (from which we will deduct the year and month parts in the url).
I want my Post model to be RESTful, so things like url_for(@post) work like they should, ie: it should gen...
Hello
I'm trying to add a "fullname" in the route in my url, and I wonder which chars I should replace? Should I use _ instead of space? and what other chars might "need" replacing?
Mostly gonna use swedish names, but some might have some strange letters, not icelandic ones though :)
/M
...
I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I do that?
...
I use django-1.1 and satchmo (commit: 1385 75a2ea838067)
I found that if there is a "love" speech in the slug item, for example, love-x10, dsfdsfloveddd, love-love ...
the product's url is "http://example.com/product/lovelove/", if you click "add to cart" button, the server give me a Blank Page, Empty! And the server is temporarily una...