Re: simple friends template help

2015-02-02 Thread Pawan Kumar
Hi Justin, 

I'm relatively new to django and while using the django simple friend app i 
have bumped into the same issue as you. 
I do not know how to tie back the views to templates so the results are 
visually appreciated. 

would you be able to help me out?

I want to see a template or page saying "you have sent a friend request to 
X" when i use http://127.0.0.8800/add/x...@gmail.com url

Please let me know what you think.

Thanks,
Pawan

On Monday, March 28, 2011 at 6:02:52 AM UTC+5:30, justin jools wrote:
>
> need some help setting up templates for friends list: 
>
> how do I iterate a list of invited friends and are friends? I have 
> tried: 
>
>
>   {% for friends in Friendship.objects.are_friends %} 
>
>  target_user: {{ friends.target_user}} 
>  current_user:{{ friends.current_user}} 
>  are_friends: {{ friends.are_friends}} 
>  is_invited: {{ friends.is_invited}} 
>
>   {% endfor %} 
>
> gives me nothing but: 
>
> {{ is_invited }} 
> {{ are_friends }} 
> {{ target_user }} 
> {{ current_user }} 
>
>
> output: 
>
> false 
> false 
> name 
> name 
>
> I have been trying to figure this out for months. Please help.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e1f2a0f-39b4-4bcf-9222-ea8b11c66474%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: simple friends template help

2011-03-28 Thread justin jools
I think I've resolved some of my problems:

I was wondering how to list friend request but now I think I have to
use Django-Notifications to pick up the signals, would this be right?


complete models:

class FriendshipRequest(models.Model):
from_user = models.ForeignKey(User,
related_name="invitations_from")
to_user = models.ForeignKey(User, related_name="invitations_to")
message = models.CharField(max_length=200, blank=True)
created = models.DateTimeField(default=datetime.datetime.now,
   editable=False)
accepted = models.BooleanField(default=False)

class Meta:
verbose_name = _(u'friendship request')
verbose_name_plural = _(u'friendship requests')
unique_together = (('to_user', 'from_user'),)

def __unicode__(self):
return _(u'%(from_user)s wants to be friends with %
(to_user)s') % \
{'from_user': unicode(self.from_user),
 'to_user': unicode(self.to_user)}

def accept(self):
Friendship.objects.befriend(self.from_user, self.to_user)
self.accepted = True
self.save()
signals.friendship_accepted.send(sender=self)

def decline(self):
signals.friendship_declined.send(sender=self, cancelled=False)
self.delete()

def cancel(self):
signals.friendship_declined.send(sender=self, cancelled=True)
self.delete()


class FriendshipManager(models.Manager):
def friends_of(self, user, shuffle=False):
qs = User.objects.filter(friendship__friends__user=user)
if shuffle:
qs = qs.order_by('?')
return qs

def are_friends(self, user1, user2):
return bool(Friendship.objects.get(user=user1).friends.filter(
 
user=user2).count())

def befriend(self, user1, user2):
Friendship.objects.get(user=user1).friends.add(
 
Friendship.objects.get(user=user2))

def unfriend(self, user1, user2):
Friendship.objects.get(user=user1).friends.remove(
 
Friendship.objects.get(user=user2))


class Friendship(models.Model):
user = models.OneToOneField(User, related_name='friendship')
friends = models.ManyToManyField('self', symmetrical=True)

objects = FriendshipManager()

class Meta:
verbose_name = _(u'friendship')
verbose_name_plural = _(u'friendships')

def __unicode__(self):
return _(u'%(user)s\'s friends') % {'user':
unicode(self.user)}

def friend_count(self):
return self.friends.count()
friend_count.short_description = _(u'Friends count')

def friend_summary(self, count=7):
friend_list = self.friends.all().select_related(depth=1)
[:count]
return u'[%s%s]' % (u', '.join(unicode(f.user) for f in
friend_list),
u', ...' if self.friend_count() > count
else u'')
friend_summary.short_description = _(u'Summary of friends')


class UserBlocks(models.Model):
user = models.OneToOneField(User, related_name='user_blocks')
blocks = models.ManyToManyField(User,
related_name='blocked_by_set')

class Meta:
verbose_name = verbose_name_plural = _(u'user blocks')

def __unicode__(self):
return _(u'Users blocked by %(user)s') % {'user':
unicode(self.user)}

def block_count(self):
return self.blocks.count()
block_count.short_description = _(u'Blocks count')

def block_summary(self, count=7):
block_list = self.blocks.all()[:count]
return u'[%s%s]' % (u', '.join(unicode(user) for user in
block_list),
u', ...' if self.block_count() > count
else u'')
block_summary.short_description = _(u'Summary of blocks')


def create_friendship_instance(sender, instance, created, raw,
**kwargs):
if created and not raw:
Friendship.objects.create(user=instance)
models.signals.post_save.connect(create_friendship_instance,
 sender=User,
 dispatch_uid='friends.models.create_'
\
  'friendship_instance')


def create_userblocks_instance(sender, instance, created, raw,
**kwargs):
if created and not raw:
UserBlocks.objects.create(user=instance)
models.signals.post_save.connect(create_userblocks_instance,
 sender=User,
 dispatch_uid='friends.models.create_'
\
  'userblocks_instance')


On Mar 28, 6:57 pm, Joel Goldstick  wrote:
> On Mon, Mar 28, 2011 at 12:14 PM, mike171562 
> wrote:
>
>
>
> > Maybe you could use the ifequal tag in your template, not sure what
> > your trying to do , but in your view you could do a friend =
> > Friends.objects.all() and in your template,
>
> > {% ifequal friend.isfriend True %}
> > do something here
> > {%endifequal%}
>
> > {% ifequal friend.is_invited %}
> > something else
> > {%endifequal%}
>
> > On Mar 27, 7:32 pm, justin jools  wrote:

Re: simple friends template help

2011-03-28 Thread justin jools
I now have a different overriding problem with this simple-friends
app:

url patterns are simple:

urlpatterns = patterns('friends.views',
url(r'^$',
'friend_list',
name='friends_home'),
url(r'^list/(?P\w+)/$',
'friend_list',
name='friend_list'),
url(r'^add/(?P\w+)/$',
'friendship_request',
name='friendship_request'),
url(r'^accept/(?P\w+)/$',
'friendship_accept',
name='friendship_accept'),
url(r'^decline/(?P\w+)/$',
'friendship_decline',
name='friendship_decline'),
url(r'^cancel/(?P\w+)/$',
'friendship_cancel',
name='friendship_cancel'),
url(r'^delete/(?P\w+)/$',
'friendship_delete',
name='friendship_delete'),
url(r'^block/(?P\w+)/$',
'block_user',
name='block_user'),
url(r'^unblock/(?P\w+)/$',
'unblock_user',
name='unblock_user'),
)

but when I try /friends/add/jo

I get:

DoesNotExist at /friends/add/jo/

Friendship matching query does not exist.

Request Method: GET
Request URL:http://127.0.0.1:8000/friends/add/jo/
Django Version: 1.3 pre-alpha
Exception Type: DoesNotExist
Exception Value:

Friendship matching query does not exist.

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: simple friends template help

2011-03-28 Thread Joel Goldstick
On Mon, Mar 28, 2011 at 12:14 PM, mike171562 wrote:

> Maybe you could use the ifequal tag in your template, not sure what
> your trying to do , but in your view you could do a friend =
> Friends.objects.all() and in your template,
>
> {% ifequal friend.isfriend True %}
> do something here
> {%endifequal%}
>
> {% ifequal friend.is_invited %}
> something else
> {%endifequal%}
>
> On Mar 27, 7:32 pm, justin jools  wrote:
> > need some help setting up templates for friends list:
> >
> > how do I iterate a list of invited friends and are friends? I have
> > tried:
> >
> >   {% for friends in Friendship.objects.are_friends %}
> >
> >  target_user: {{ friends.target_user}}
> >  current_user:{{ friends.current_user}}
> >  are_friends: {{ friends.are_friends}}
> >  is_invited: {{ friends.is_invited}}
> >
> >   {% endfor %}
> >
> > gives me nothing but:
> >
> > {{ is_invited }}
> > {{ are_friends }}
> > {{ target_user }}
> > {{ current_user }}
> >
> > output:
> >
> > false
> > false
> > name
> > name
> >
> > I have been trying to figure this out for months. Please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
Can you show us the code that produces these values?

-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: simple friends template help

2011-03-28 Thread mike171562
Maybe you could use the ifequal tag in your template, not sure what
your trying to do , but in your view you could do a friend =
Friends.objects.all() and in your template,

{% ifequal friend.isfriend True %}
do something here
{%endifequal%}

{% ifequal friend.is_invited %}
something else
{%endifequal%}

On Mar 27, 7:32 pm, justin jools  wrote:
> need some help setting up templates for friends list:
>
> how do I iterate a list of invited friends and are friends? I have
> tried:
>
>   {% for friends in Friendship.objects.are_friends %}
>
>          target_user: {{ friends.target_user}}
>          current_user:{{ friends.current_user}}
>          are_friends: {{ friends.are_friends}}
>          is_invited: {{ friends.is_invited}}
>
>   {% endfor %}
>
> gives me nothing but:
>
>     {{ is_invited }}
>     {{ are_friends }}
>     {{ target_user }}
>     {{ current_user }}
>
> output:
>
> false
> false
> name
> name
>
> I have been trying to figure this out for months. Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-simple-friends template help

2011-03-27 Thread justin jools
need some help setting up templates for friends list:

how do I iterate a list of invited friends and are friends? I have
tried:


  {% for friends in Friendship.objects.are_friends %}

 target_user: {{ friends.target_user}}
 current_user:{{ friends.current_user}}
 are_friends: {{ friends.are_friends}}
 is_invited: {{ friends.is_invited}}

  {% endfor %}

gives me nothing but:

{{ is_invited }}
{{ are_friends }}
{{ target_user }}
{{ current_user }}


output:

false
false
name
name

I have been trying to figure this out for months. Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



simple friends template help

2011-03-27 Thread justin jools
need some help setting up templates for friends list:

how do I iterate a list of invited friends and are friends? I have
tried:


  {% for friends in Friendship.objects.are_friends %}

 target_user: {{ friends.target_user}}
 current_user:{{ friends.current_user}}
 are_friends: {{ friends.are_friends}}
 is_invited: {{ friends.is_invited}}

  {% endfor %}

gives me nothing but:

{{ is_invited }}
{{ are_friends }}
{{ target_user }}
{{ current_user }}


output:

false
false
name
name

I have been trying to figure this out for months. Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread David De La Harpe Golden
On 15/07/10 18:00, natebeacham wrote:
> Or, if you don't want to over complicate things...

Heh. yes, well. :-)

Though doing it on the server does mean it stays working
for people who disable javascript.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
wow works like a dream :)
perfect time saver bit of script
thanks :)

On Jul 15, 6:00 pm, natebeacham  wrote:
> Or, if you don't want to over complicate things...
>
> $(function() {
>     $('#nav li a').each(function() {
>         if ($(this).attr('href') == window.location.pathname) {
>             $(this).addClass('active');
>         }
>     });
>
> });
>
> On Jul 15, 12:15 pm, David De La Harpe Golden
>
>
>
>  wrote:
> > On 15/07/10 16:31, justin jools wrote:
>
> > > I thought I had solved but I haven't.
> > > [...]
> > > using seperate block nav for evey page seems like a lot of
> > > duplication...
>
> > Well, you could also pass through a context variable to the template
> > from each of your view functions telling what item in your navbar to
> > make current, you don't need to do the "{%with ...%}{{block.super}}"
> > hack I showed, that just helps make which navbar item is current a
> > "purely in the templates" issue, which is potentially handy.
>
> > i.e. in your view you might do something like
>
> > return render_to_response('blah.html',
> >         dict(nav_current='blah',...),
> >         context_instance=RequestContext(request))- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
I'm just going to go with nav blocks for the time being and find
something dynamic later...
I was looking at Jquery json cookies but seems a lot of effort for a
small menu
very interesting about context variables, I'll look into this ;)

Thanks

On Jul 15, 5:15 pm, David De La Harpe Golden
 wrote:
> On 15/07/10 16:31, justin jools wrote:
>
> > I thought I had solved but I haven't.
> > [...]
> > using seperate block nav for evey page seems like a lot of
> > duplication...
>
> Well, you could also pass through a context variable to the template
> from each of your view functions telling what item in your navbar to
> make current, you don't need to do the "{%with ...%}{{block.super}}"
> hack I showed, that just helps make which navbar item is current a
> "purely in the templates" issue, which is potentially handy.
>
> i.e. in your view you might do something like
>
> return render_to_response('blah.html',
>         dict(nav_current='blah',...),
>         context_instance=RequestContext(request))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread natebeacham
Or, if you don't want to over complicate things...

$(function() {
$('#nav li a').each(function() {
if ($(this).attr('href') == window.location.pathname) {
$(this).addClass('active');
}
});
});

On Jul 15, 12:15 pm, David De La Harpe Golden
 wrote:
> On 15/07/10 16:31, justin jools wrote:
>
> > I thought I had solved but I haven't.
> > [...]
> > using seperate block nav for evey page seems like a lot of
> > duplication...
>
> Well, you could also pass through a context variable to the template
> from each of your view functions telling what item in your navbar to
> make current, you don't need to do the "{%with ...%}{{block.super}}"
> hack I showed, that just helps make which navbar item is current a
> "purely in the templates" issue, which is potentially handy.
>
> i.e. in your view you might do something like
>
> return render_to_response('blah.html',
>         dict(nav_current='blah',...),
>         context_instance=RequestContext(request))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread David De La Harpe Golden
On 15/07/10 16:31, justin jools wrote:
> I thought I had solved but I haven't.
> [...]
> using seperate block nav for evey page seems like a lot of
> duplication...

Well, you could also pass through a context variable to the template
from each of your view functions telling what item in your navbar to
make current, you don't need to do the "{%with ...%}{{block.super}}"
hack I showed, that just helps make which navbar item is current a
"purely in the templates" issue, which is potentially handy.

i.e. in your view you might do something like

return render_to_response('blah.html',
dict(nav_current='blah',...),
context_instance=RequestContext(request))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
I thought I had solved but I haven't.
Re: That means a whole different page is requested by the browser.
I get your point, you are saying when clicking a link even though the
script and navigation are in base.html it is still loading a new
instance of base.html and therefore can't keep state for jquery...
jquery only wokrs when page is in static and not navigated away
from... makes sense...

how do I store state across pages then to achieve this? save to JSON?

using seperate block nav for evey page seems like a lot of
duplication...

On Jul 15, 3:52 pm, David De La Harpe Golden
 wrote:
> On 15/07/10 15:19, justin jools wrote:
>
> >    
> >            $(document).ready(function() {
> >                            $('#nav li a').click(function() {
> >                                      $('.active').removeClass('active');
> >                                      $(this).addClass('active');
> >                            });
> >            });
> >    
>
> Okay hold on here, I'm obviously too used to there being some ajaxy hook
> on clicked links - you are just toggling a class there, clicking such a
> link will still navigate away immediately to an entirely different page
> since you haven't actually prevented the default action in that event
> handler.
>
> That means a whole different page is requested by the browser.
> Django is on the server side.  Once it's spat out the generated page
> (rendered from the template) to the client (browser), it doesn't have
> further involvement until the next time the client requests something
> from the server.
>
> If you haven't taken some sort of steps to arrange for a different link
> in your nav bar to _start out_ as active on that different page, then it
> will be whatever it is set to in your first template.
>
> If you want a different link to _start out_ with class "active" in
> different pages, you can do that in the templates.
>
> e.g. (one of several ways to do it, not necessarily the neatest):
>
> parent:
>
> {% block nav %}
> 
>   
>             href="/home/">
>          Home
>     
>   
>   
>             href="/about/">
>          About
>     
>   
>
> ...
> {% endblock nav %}
>
> child:
>
> {% block nav %}
> {% with 'about' as nav_current %}
> {{block.super}}
> {% endwith %}
> {% endblock nav %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
Solved it!!!

really stupid! I knew it would be something like this. I removed
class="active" on home, now it works. Seems django was resetting to
default base.html settings. It doesn't do this in straight HTML. So
now I'll have to set the home active onload dynamically.

hope this tip helps someone.

   
Home
About
Work
Blog
Contact
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread David De La Harpe Golden
On 15/07/10 15:19, justin jools wrote:

>   
>   $(document).ready(function() {
>   $('#nav li a').click(function() {
> $('.active').removeClass('active');
> $(this).addClass('active');
>   });
>   });
>   

Okay hold on here, I'm obviously too used to there being some ajaxy hook
on clicked links - you are just toggling a class there, clicking such a
link will still navigate away immediately to an entirely different page
since you haven't actually prevented the default action in that event
handler.

That means a whole different page is requested by the browser.
Django is on the server side.  Once it's spat out the generated page
(rendered from the template) to the client (browser), it doesn't have
further involvement until the next time the client requests something
from the server.

If you haven't taken some sort of steps to arrange for a different link
in your nav bar to _start out_ as active on that different page, then it
will be whatever it is set to in your first template.


If you want a different link to _start out_ with class "active" in
different pages, you can do that in the templates.

e.g. (one of several ways to do it, not necessarily the neatest):

parent:

{% block nav %}

  

 Home

  
  

 About

  

...
{% endblock nav %}


child:


{% block nav %}
{% with 'about' as nav_current %}
{{block.super}}
{% endwith %}
{% endblock nav %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
tried putting the nav function in the child template made no
difference.
I have another button jquery script which is working fine, so maybe it
is my script but when I test in straight in html it works... bizarre
complete script:

http://www.w3.org/
TR/html4/strict.dtd">





Devhead {%block pagetitle %}{% endblock %}








 
  var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17360645-1']);
_gaq.push(['_trackPageview']);
  (function() {
var ga = document.createElement('script'); ga.type = 'text/
javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://
ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
  })();




$(document).ready(function() {
$(".button-list .next").click(function() {
project = 
$(this).parents().filter(".project").eq(0);
currentimg = project.find(".images-list 
li.current");
nextimg = currentimg.next();
firstimg = project.find(".images-list 
li:first");
currentimg.removeClass("current");
if (nextimg.is("li")) 
nextimg.addClass("current");
else firstimg.addClass("current");
return false;
});
$(".button-list .prev").click(function() {
project = 
$(this).parents().filter(".project").eq(0);
currentimg = project.find(".images-list 
li.current");
previmg = currentimg.prev();
lastimg = project.find(".images-list li:last");
currentimg.removeClass("current");
if (previmg.is("li")) 
previmg.addClass("current");
else lastimg.addClass("current");
return false;
});
});


$(document).ready(function() {
$('#nav li a').click(function() {
  $('.active').removeClass('active');
  $(this).addClass('active');
});
});










 
Home
About
Work
Blog
Contact
 




{% block extra-head %}{% endblock %}





{% block title %}{% endblock %}
{% block content %}{% endblock %}







c 2010 Powered by
http://www.djangoproject.com/";>Django
Hosted by
https://servqc.net/";>ServQc.








On Jul 15, 3:11 pm, justin jools  wrote:
> the paths are correct, as I have tested the jquery click function with
> alert ()
> I do have child templates and blocks but I took all this out to see
> why the jquery was being overriden/reset/disabled by django.
> It finds the jquery no problem but always resets to the default base
> template, and doesn't change it:
>   Home a>
>
> I see from our example I should put the function in the child
> template, I'll try this but seems strange it doesnt work in base
> template.
>
> On Jul 15, 2:40 pm, David De La Harpe Golden
>
>
>
>  wrote:
> > On 15/07/10 13:40, justin jools wrote:
>
> > > 2. base.html with jquery nav, exactly the same except for
> > > {{ MEDIA_URL }} which is correct.
>
> > FWIW, we use a jquery load line in our base template and it works fine
> > (pretty disastrous for us if it didn't).
>
> > You're 100% sure the pathss correct (like when you "view source" the
> > rendered page and look at the rendered links in your browser) -
> > forgetting a trailing slash on settings.MEDIA_URL is a common mistake,
> > as is inserting an extra one somewhere.
>
> > In case you've been away on mars or something: the "firebug" extension
> > for firefox is extremely useful for poking about rendered pages.
>
> > > 
> > [That's now a pretty old jquery version, not that it should matter
> > particularly.]
>
> > It's not clear to me if you've just got a test view that renders the
> > base template directly, or if you've really got child templates:
> > Was that really your base template though? I mean you've got no

Re: Jquery nav disabled in Django base template??? help please

2010-07-15 Thread justin jools
the paths are correct, as I have tested the jquery click function with
alert ()
I do have child templates and blocks but I took all this out to see
why the jquery was being overriden/reset/disabled by django.
It finds the jquery no problem but always resets to the default base
template, and doesn't change it:
  Home

I see from our example I should put the function in the child
template, I'll try this but seems strange it doesnt work in base
template.

On Jul 15, 2:40 pm, David De La Harpe Golden
 wrote:
> On 15/07/10 13:40, justin jools wrote:
>
> > 2. base.html with jquery nav, exactly the same except for
> > {{ MEDIA_URL }} which is correct.
>
> FWIW, we use a jquery load line in our base template and it works fine
> (pretty disastrous for us if it didn't).
>
> You're 100% sure the pathss correct (like when you "view source" the
> rendered page and look at the rendered links in your browser) -
> forgetting a trailing slash on settings.MEDIA_URL is a common mistake,
> as is inserting an extra one somewhere.
>
> In case you've been away on mars or something: the "firebug" extension
> for firefox is extremely useful for poking about rendered pages.
>
> > 
> [That's now a pretty old jquery version, not that it should matter
> particularly.]
>
> It's not clear to me if you've just got a test view that renders the
> base template directly, or if you've really got child templates:
> Was that really your base template though? I mean you've got no
> {% block blah %} things for child pages to override.
>
> They're relevant because you presumably have blocks in your base
> template, and you presumably override them in the child templates, so
> you might want to make sure you're not overriding a block containing the
> jquery-loading script tag, or at least use {{block.super}}  to pull it
> in if you do.
>
> our base looks something like (simplified):
>
> 
>   
>     {% block title %}BlahProj{% endblock title %}
>
>      href="{{MEDIA_URL}}ext/jquery-ui/css/redmond/jquery-ui-1.8.2.custom.css"
> rel="stylesheet" />
>      media="screen"
>  rel="stylesheet" />
>
>