First, I would make sure all namespace are unique.

Then I would try {% url "ytlinks:save_ytlink" %}
In 'links.views.save_ytlink', I have no idea what links or views are.

You might also want to re-read the documentation on urls namespace and
included urlconfs
https://docs.djangoproject.com/en/1.10/topics/http/urls/#url-namespaces-and-included-urlconfs

2017-02-16 16:52 GMT+01:00 xyron <martialartstricke...@gmail.com>:
> Code hier eingeben...
>
> Hey there,
>
> I'm searching since more than 12 hours for a solution for my problem and I'm
> kinda frustrated.
>
> I want to use a form and define the link using django template language in a
> html-file:
>
> {% extends "base/header.html" %}
> {% block content %}
>
>   <div class="login">
>    <h1>Enter Youtube-Link</h1>
>     <form action=" {% url 'links.views.save_ytlink' %} " method="post">
>
> I get following error:
>
> Reverse for 'links.views.save_ytlink' with arguments '()' and keyword
> arguments '{}' not found. 0 pattern(s) tried: []
>
> My project structure looks like this:
>
> ----mysite
>     +---links
>     ¦   +---templates
>     ¦   ¦   +---home.html
>     ¦   +---urls.py
>     ¦   +---views.py
>     +---mainapp
>         +---templates
>         ¦   +---base
>         ¦   ¦   +---header.html
>         ¦   +---links
>         ¦   +---register
>         +-------urls.py
>         +-------views.py
>
>
> mainapp.urls.py looks like this:
>
> urlpatterns = [
>     url(r'^', include('links.urls', namespace='ytlinks'), name='index'),
>     url(r'^admin/', admin.site.urls),
>     url(r'^register', include('register.urls'), name='register'),
>     url(r'^ytlinks/', include('links.urls', namespace='ytlinks')),
> ]
>
>
> links.urls.py looks like this:
>
> urlpatterns = [
>        url(r'^save_ytlink', views.save_ytlink, name='save_ytlink'),
>        url(r'^list$', views.ytlinks_list, name='ytlinks_list'),
>        url(r'^', views.ytlinks, name='ytlinks'),
> ]
>
>
> links.views.py looks like this:
>
> def save_ytlink(request):
>     msg = ""
>     msg_status = "" # possible: 'success', 'info', 'danger', 'warning'
>
>
>     # Check if user came here by form
>     if request.method == 'GET':
>         return render(request, 'home.html')
>
>
>     ytlink = request.POST['ytlink']
>     allow_save = True
>
>
>     # Validation
>     # ...
>
>
>     return render(request, 'home.html', {'queryset':'', 'msg':msg,
> 'msg_status':msg_status})
>
>
> Things I tried:
>
> <form action=" {% url 'links.views.save_ytlink' %} " method="post">
> <form action=" {% url 'save_ytlink' %} " method="post">
> <form action=" {% url save_ytlink %} " method="post">
> <form action=" {% url "links.views.save_ytlink" %} " method="post">
> <form action=" {% url myapp:save_ytlink %} " method="post">
>
> (and much more)
>
> I tried to set namespaces, to see if it makes any difference. Also stuff
> with ../views.save_ytlink didn't work.
>
> Also if I create a file called "test.html" (located in the same directory),
> it doesn't  change the error.
>
> {% url 'test.html' %}
>
> If I use:
>
> <form action="" method="post">
>
> It works.
>
> What am I doing wrong? I really, really appreciate any attempt to help.
>
> xyron
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9d3cb6ff-3bea-458f-94b2-ff72a7b53045%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTacxPg283AxpNraK4sOdFNM97ERAoBsvL3rWW7gDpwoTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to