Skip to content

Commit 5ad61b1

Browse files
committed
Enabled support for slug field, updated url_name remove special chars
1 parent e4b47b3 commit 5ad61b1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

main/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def save(self, *args, **kwargs):
4646
if not self.id:
4747
self.created_time = timezone.now()
4848
if not self.url_name:
49-
self.url_name = (str(self.name).replace(' ', '-')).replace('/', '-').lower()
49+
self.url_name = (str(self.name).replace(' ', '-')).replace('/', '-').replace('@','').lower()
5050
return super(Component, self).save(*args, **kwargs)
5151

5252
def __unicode__(self):

main/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
url(r'^updatedata/$', views.update_data, name="update_data"),
99
url(r'^all/$', views.all_components, name="all_components"),
1010
url(r'^top/$', views.top_components, name="top_components"),
11-
url(r'^details/(?P<url_name>\w+)/$', views.component_details, name="component_details"),
11+
url(r'^details/(?P<url_name>[\w-]+)/$', views.component_details, name="component_details"),
1212
]

0 commit comments

Comments
 (0)