how to format a a url to return something like this “product/4/improved-led-lamp” in the templateDjango blows up with 1.1, Can't find urls moduleHaving trouble with getting URL config to work% url % not work in DjangoDjango 1.8.3 urlsHow to link my css, js and image file link in djangoextends not working in Django 1.9NoReverseMatch error: Split URL and Views into multiple files to link and reverse them from a single REST Api RootDjango - Slug field for model object not being applied to URLWhy is Django template pattern matching with wrong view and causing a NoReverseMatch error?urls.py django 2.0.2 need parameters

A quine of sorts

Installed software from source, how to say yum not to install it from package?

Why wasn't ASCII designed with a contiguous alphanumeric character order?

What is the meaning of 'shout over' in a sentence exactly?

Where to connect the fuse and why?

Correct use of the the idiom 'Гнать/Катить бочку'

ESTA Elegible after Qatar?

Listen to my Story...Let us find the Unique Invisible Pan Digital Pair

Does "boire un jus" tend to mean "coffee" or "juice of fruit"?

What does 'in attendance' mean on a death certificate - England?

Is my guitar action too high or is the bridge too high?

How does mmorpg store data?

How do I keep a running total of data in a column in Excel?

Can I take Amul cottage cheese from India to Netherlands?

Why is exile often an intermediate step?

What verb for taking advantage fits in "I don't want to ________ on the friendship"?

Does it make sense to (partially) create a conlang that you don't intend to actually use in the story?

How to track mail undetectably?

The alcoholic village festival

Automorphisms and epimorphisms of finite groups

How can an inexperienced GM keep a game fun for experienced players?

Why will we fail creating a self sustaining off world colony?

Fully submerged water bath for stove top baking?

I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again



how to format a a url to return something like this “product/4/improved-led-lamp” in the template


Django blows up with 1.1, Can't find urls moduleHaving trouble with getting URL config to work% url % not work in DjangoDjango 1.8.3 urlsHow to link my css, js and image file link in djangoextends not working in Django 1.9NoReverseMatch error: Split URL and Views into multiple files to link and reverse them from a single REST Api RootDjango - Slug field for model object not being applied to URLWhy is Django template pattern matching with wrong view and causing a NoReverseMatch error?urls.py django 2.0.2 need parameters













1















I'm trying to return a formatted url that will look like this "edit-book/4/improved-led-lamp" using the % url % tag



I've tried % url 'dashboard:editbook' 4 slug %



here is the root url.py



from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('home.urls')),
path('dashboard/', include('dashboard.urls')),
path('admin/', admin.site.urls),
]


here is my dashboard app's urls,py



from django.urls import path
from . import views

app_name = 'dashboard'
urlpatterns = [
path('edit-book/<int:id>/<slug:title>', views.BookView.as_view(), name='editbook'),
]


if I visit "edit-book/4/improved-led-lamp" in my browser, it resolves, but when I try to reproduce this in the view using % url % tag, it throws noReverseMatch error



this is the error
screenshot of error










share|improve this question
























  • Please show the full error.

    – Daniel Roseman
    Mar 25 at 15:57











  • @DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

    – dmoxy
    Mar 25 at 16:11















1















I'm trying to return a formatted url that will look like this "edit-book/4/improved-led-lamp" using the % url % tag



I've tried % url 'dashboard:editbook' 4 slug %



here is the root url.py



from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('home.urls')),
path('dashboard/', include('dashboard.urls')),
path('admin/', admin.site.urls),
]


here is my dashboard app's urls,py



from django.urls import path
from . import views

app_name = 'dashboard'
urlpatterns = [
path('edit-book/<int:id>/<slug:title>', views.BookView.as_view(), name='editbook'),
]


if I visit "edit-book/4/improved-led-lamp" in my browser, it resolves, but when I try to reproduce this in the view using % url % tag, it throws noReverseMatch error



this is the error
screenshot of error










share|improve this question
























  • Please show the full error.

    – Daniel Roseman
    Mar 25 at 15:57











  • @DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

    – dmoxy
    Mar 25 at 16:11













1












1








1








I'm trying to return a formatted url that will look like this "edit-book/4/improved-led-lamp" using the % url % tag



I've tried % url 'dashboard:editbook' 4 slug %



here is the root url.py



from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('home.urls')),
path('dashboard/', include('dashboard.urls')),
path('admin/', admin.site.urls),
]


here is my dashboard app's urls,py



from django.urls import path
from . import views

app_name = 'dashboard'
urlpatterns = [
path('edit-book/<int:id>/<slug:title>', views.BookView.as_view(), name='editbook'),
]


if I visit "edit-book/4/improved-led-lamp" in my browser, it resolves, but when I try to reproduce this in the view using % url % tag, it throws noReverseMatch error



this is the error
screenshot of error










share|improve this question
















I'm trying to return a formatted url that will look like this "edit-book/4/improved-led-lamp" using the % url % tag



I've tried % url 'dashboard:editbook' 4 slug %



here is the root url.py



from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('', include('home.urls')),
path('dashboard/', include('dashboard.urls')),
path('admin/', admin.site.urls),
]


here is my dashboard app's urls,py



from django.urls import path
from . import views

app_name = 'dashboard'
urlpatterns = [
path('edit-book/<int:id>/<slug:title>', views.BookView.as_view(), name='editbook'),
]


if I visit "edit-book/4/improved-led-lamp" in my browser, it resolves, but when I try to reproduce this in the view using % url % tag, it throws noReverseMatch error



this is the error
screenshot of error







python django django-templates






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 16:13







dmoxy

















asked Mar 25 at 15:47









dmoxydmoxy

185 bronze badges




185 bronze badges












  • Please show the full error.

    – Daniel Roseman
    Mar 25 at 15:57











  • @DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

    – dmoxy
    Mar 25 at 16:11

















  • Please show the full error.

    – Daniel Roseman
    Mar 25 at 15:57











  • @DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

    – dmoxy
    Mar 25 at 16:11
















Please show the full error.

– Daniel Roseman
Mar 25 at 15:57





Please show the full error.

– Daniel Roseman
Mar 25 at 15:57













@DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

– dmoxy
Mar 25 at 16:11





@DanielRoseman, I just uploaded a screenshot of the error, plus i've edited the code to provide more details

– dmoxy
Mar 25 at 16:11










1 Answer
1






active

oldest

votes


















2














Your syntax looks correct and if slug variable consists of slug ([-a-zA-Z0-9_]+) it should be working.



Look into contents of slug. Error screenshot shows that it's an empty string.






share|improve this answer

























  • I've updated the question

    – dmoxy
    Mar 25 at 16:12






  • 1





    screenshot shows that slug variable is empty string. You need an actual slug there.

    – Kyryl Havrylenko
    Mar 25 at 16:14











  • thanks mate, you were right

    – dmoxy
    Mar 25 at 16:17










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341601%2fhow-to-format-a-a-url-to-return-something-like-this-product-4-improved-led-lamp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Your syntax looks correct and if slug variable consists of slug ([-a-zA-Z0-9_]+) it should be working.



Look into contents of slug. Error screenshot shows that it's an empty string.






share|improve this answer

























  • I've updated the question

    – dmoxy
    Mar 25 at 16:12






  • 1





    screenshot shows that slug variable is empty string. You need an actual slug there.

    – Kyryl Havrylenko
    Mar 25 at 16:14











  • thanks mate, you were right

    – dmoxy
    Mar 25 at 16:17















2














Your syntax looks correct and if slug variable consists of slug ([-a-zA-Z0-9_]+) it should be working.



Look into contents of slug. Error screenshot shows that it's an empty string.






share|improve this answer

























  • I've updated the question

    – dmoxy
    Mar 25 at 16:12






  • 1





    screenshot shows that slug variable is empty string. You need an actual slug there.

    – Kyryl Havrylenko
    Mar 25 at 16:14











  • thanks mate, you were right

    – dmoxy
    Mar 25 at 16:17













2












2








2







Your syntax looks correct and if slug variable consists of slug ([-a-zA-Z0-9_]+) it should be working.



Look into contents of slug. Error screenshot shows that it's an empty string.






share|improve this answer















Your syntax looks correct and if slug variable consists of slug ([-a-zA-Z0-9_]+) it should be working.



Look into contents of slug. Error screenshot shows that it's an empty string.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 25 at 16:13

























answered Mar 25 at 16:03









Kyryl HavrylenkoKyryl Havrylenko

4592 silver badges9 bronze badges




4592 silver badges9 bronze badges












  • I've updated the question

    – dmoxy
    Mar 25 at 16:12






  • 1





    screenshot shows that slug variable is empty string. You need an actual slug there.

    – Kyryl Havrylenko
    Mar 25 at 16:14











  • thanks mate, you were right

    – dmoxy
    Mar 25 at 16:17

















  • I've updated the question

    – dmoxy
    Mar 25 at 16:12






  • 1





    screenshot shows that slug variable is empty string. You need an actual slug there.

    – Kyryl Havrylenko
    Mar 25 at 16:14











  • thanks mate, you were right

    – dmoxy
    Mar 25 at 16:17
















I've updated the question

– dmoxy
Mar 25 at 16:12





I've updated the question

– dmoxy
Mar 25 at 16:12




1




1





screenshot shows that slug variable is empty string. You need an actual slug there.

– Kyryl Havrylenko
Mar 25 at 16:14





screenshot shows that slug variable is empty string. You need an actual slug there.

– Kyryl Havrylenko
Mar 25 at 16:14













thanks mate, you were right

– dmoxy
Mar 25 at 16:17





thanks mate, you were right

– dmoxy
Mar 25 at 16:17






Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341601%2fhow-to-format-a-a-url-to-return-something-like-this-product-4-improved-led-lamp%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현