Re: href not working

2018-05-31 Thread Melvyn Sopacua
On donderdag 31 mei 2018 15:49:28 CEST Caleb Bryson wrote:
> my blog view.py is empty at the moment
> 
> 
> Mysite url.py
> 
> from django.contrib import admin
> 
> from django.conf.urls import url, include
> 
> 
> 
> urlpatterns = [
> 
> url(r'^admin/', admin.site.urls),
> 
> url(r'^', include( 'hybridair.urls')),

This matches anything that has a beginning. So that always matches, anything 
after it, is ignored (Django works on first match base).


> url(r'^', views.index, name='index'),

And again.

So anything that is not admin, goes to the homepage.
-- 
Melvyn Sopacua

-- 
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/2507550.5rhCOJ8Mzy%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Caleb Bryson


my blog view.py is empty at the moment


Mysite url.py

from django.contrib import admin

from django.conf.urls import url, include

 

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'^', include( 'hybridair.urls')),

url(r'^blog/$', include( 'blog.urls')),

]

 

 

 

Hybrid Air url.py

from django.conf.urls import url, include

from . import views

urlpatterns = [

url(r'^', views.index, name='index'),

url(r'^contact/', views.contact, name='contact'),

]

 

 

Hybrid Air view.py

from django.shortcuts import render

 

def index(request):

return render(request, 'hybridair/home.html')

 

def contact(request):

return render(request, 'hybridair/basic.html' ('content' ['contact the 
team at', 'mar...@flymat21.com']))

 

def blog(request):

return render(request, 'hybridair/header.html')

 

 

 

 

 

blog url.py

from django.conf.urls import url, include

from django.views.generic import ListView, DetailView

from blog.models import Post

 

urlpatterns = [

url(r'^$', ListView.as_view(

queryset=Post.objects.order_by('-date')[:25],

template_name="blog/blog.html")),

 

url(r'^(?P\d+)$', DetailView.as_view(model = Post,

template_name='blog/post.html')),

]

Do you see what I need to change?

On Thursday, May 31, 2018 at 9:01:23 AM UTC-4, Melvyn Sopacua wrote:
>
> On donderdag 31 mei 2018 05:56:59 CEST Caleb Bryson wrote: 
> > So i am trying to create a directory with a Home,Blog,and Contact 
> > selection. But every time i click on one of them they all go back to the 
> > home page. 
>
> If the url in your addressbar is /blog/  after clickin on it, but you see 
> the 
> homepage content, then your homepage url pattern matches too much. 
>
> If you get redirected to the homepage, then there's something wrong in 
> your 
> blog view code. 
>
> Given that it applies to both contact and blog, the first option is more 
> likely, but you could be making the same mistake in both views. 
>
> -- 
> Melvyn Sopacua 
>

-- 
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/2ed614e4-cb26-47ef-9bfb-4e07d10b5ef2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Caleb Bryson


my blog view.py is empty at the moment


Mysite url.py

from django.contrib import admin

from django.conf.urls import url, include

 

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'^', include( 'hybridair.urls')),

url(r'^blog/$', include( 'blog.urls')),

]

 

 

 

Hybrid Air url.py

from django.conf.urls import url, include

from . import views

urlpatterns = [

url(r'^', views.index, name='index'),

url(r'^contact/', views.contact, name='contact'),

]

 

 

Hybrid Air view.py

from django.shortcuts import render

 

def index(request):

return render(request, 'hybridair/home.html')

 

def contact(request):

return render(request, 'hybridair/basic.html' ('content' ['contact the 
team at', 'mar...@flymat21.com']))

 

def blog(request):

return render(request, 'hybridair/header.html')

 

 

 

 

 

blog url.py

from django.conf.urls import url, include

from django.views.generic import ListView, DetailView

from blog.models import Post

 

urlpatterns = [

url(r'^$', ListView.as_view(

queryset=Post.objects.order_by('-date')[:25],

template_name="blog/blog.html")),

 

url(r'^(?P\d+)$', DetailView.as_view(model = Post,

template_name='blog/post.html')),

]

Do you see what I need to change?

On Thursday, May 31, 2018 at 7:11:46 AM UTC-4, Mohammed Noor wrote:
>
> I think the mistake is using a '/' before the name inside href. Try 
> changing it from href= '/contact'/ to href= 'contact/' 
>
> Have a great day 
>
> On 31-May-2018, at 9:26 AM, Caleb Bryson > 
> wrote:
>
> So i am trying to create a directory with a Home,Blog,and Contact 
> selection. But every time i click on one of them they all go back to the 
> home page. How do i fix this, and here is the secton of code below. let me 
> know if you need to see more
>
> 
>
> Home
> Blog
> Contact
>
>   
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@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/9dc7004b-4fff-412d-8560-6308f13db92c%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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/e7cc8fdf-03a2-4d4e-a8f6-1b949714fbc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Caleb Bryson


my blog view.py is empty at the moment


Mysite url.py

from django.contrib import admin

from django.conf.urls import url, include

 

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'^', include( 'hybridair.urls')),

url(r'^blog/$', include( 'blog.urls')),

]

 

 

 

Hybrid Air url.py

from django.conf.urls import url, include

from . import views

urlpatterns = [

url(r'^', views.index, name='index'),

url(r'^contact/', views.contact, name='contact'),

]

 

 

Hybrid Air view.py

from django.shortcuts import render

 

def index(request):

return render(request, 'hybridair/home.html')

 

def contact(request):

return render(request, 'hybridair/basic.html' ('content' ['contact the 
team at', 'mar...@flymat21.com']))

 

def blog(request):

return render(request, 'hybridair/header.html')

 

 

 

 

 

blog url.py

from django.conf.urls import url, include

from django.views.generic import ListView, DetailView

from blog.models import Post

 

urlpatterns = [

url(r'^$', ListView.as_view(

queryset=Post.objects.order_by('-date')[:25],

template_name="blog/blog.html")),

 

url(r'^(?P\d+)$', DetailView.as_view(model = Post,

template_name='blog/post.html')),

]

Do you see what I need to change?
On Thursday, May 31, 2018 at 4:31:47 AM UTC-4, Mike Dewhirst wrote:
>
> On 31/05/2018 1:56 PM, Caleb Bryson wrote: 
> > So i am trying to create a directory with a Home,Blog,and Contact 
> > selection. But every time i click on one of them they all go back to 
> > the home page. 
>
> It feels like your urls.py is insufficiently fleshed out or maybe your 
> home page url isn't fully formed. Django obviously thinks that whatever 
> is handed in can be interpreted as requesting the home page view. 
>
> For example, I would expect your home page url pattern (url or re_path 
> depending on Django version) might look something like ... 
>
> url_patterns = [ 
>  url(r'^$', home_page_view), 
>  ... 
> ] 
>
> If you have omitted that $ anything will match and your home page view 
> will be called. 
>
> Just a guess 
>
>
> > How do i fix this, and here is the secton of code below. let me know 
> > if you need to see more 
> > 
> >  
> >  
> > Home 
> > Blog 
> > Contact 
> >  
> >  
> > -- 
> > 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...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@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/9dc7004b-4fff-412d-8560-6308f13db92c%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/9dc7004b-4fff-412d-8560-6308f13db92c%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 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/1fb184b5-04e1-4592-90b4-bafaa4809dbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Melvyn Sopacua
On donderdag 31 mei 2018 05:56:59 CEST Caleb Bryson wrote:
> So i am trying to create a directory with a Home,Blog,and Contact
> selection. But every time i click on one of them they all go back to the
> home page.

If the url in your addressbar is /blog/  after clickin on it, but you see the 
homepage content, then your homepage url pattern matches too much.

If you get redirected to the homepage, then there's something wrong in your 
blog view code.

Given that it applies to both contact and blog, the first option is more 
likely, but you could be making the same mistake in both views.

-- 
Melvyn Sopacua

-- 
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/1865269.oQ2Mhu4JUg%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Mohammed Noor
I think the mistake is using a '/' before the name inside href. Try changing it 
from href= '/contact'/ to href= 'contact/' 

Have a great day 

> On 31-May-2018, at 9:26 AM, Caleb Bryson  wrote:
> 
> So i am trying to create a directory with a Home,Blog,and Contact selection. 
> But every time i click on one of them they all go back to the home page. How 
> do i fix this, and here is the secton of code below. let me know if you need 
> to see more
> 
> 
> 
> Home
> Blog
> Contact
> 
>   
> -- 
> 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/9dc7004b-4fff-412d-8560-6308f13db92c%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/AD00040D-010E-4613-BAA8-07A3C028FAF9%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: href not working

2018-05-31 Thread Mike Dewhirst

On 31/05/2018 1:56 PM, Caleb Bryson wrote:
So i am trying to create a directory with a Home,Blog,and Contact 
selection. But every time i click on one of them they all go back to 
the home page.


It feels like your urls.py is insufficiently fleshed out or maybe your 
home page url isn't fully formed. Django obviously thinks that whatever 
is handed in can be interpreted as requesting the home page view.


For example, I would expect your home page url pattern (url or re_path 
depending on Django version) might look something like ...


url_patterns = [
    url(r'^$', home_page_view),
    ...
]

If you have omitted that $ anything will match and your home page view 
will be called.


Just a guess


How do i fix this, and here is the secton of code below. let me know 
if you need to see more




Home
Blog
Contact


--
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/9dc7004b-4fff-412d-8560-6308f13db92c%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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/073f2ff6-a8a9-da49-0e16-575db697b3f6%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


href not working

2018-05-30 Thread Caleb Bryson
So i am trying to create a directory with a Home,Blog,and Contact 
selection. But every time i click on one of them they all go back to the 
home page. How do i fix this, and here is the secton of code below. let me 
know if you need to see more


   
Home
Blog
Contact
   
  

-- 
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/9dc7004b-4fff-412d-8560-6308f13db92c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.