Re: digg style pagination

2009-08-17 Thread sniper

Hi,
Thanks for the help. I thought there would be django's official built
in
functionality which i might have missed, but looks like i have to
use unofficial third party code.


On Aug 14, 6:49 pm, Benjamin  Wohlwend  wrote:
> Hi,
>
> On Aug 14, 8:54 pm,sniper wrote:
>
> > I am asking this because in the admin page, the list page uses digg
> > style paging.
>
> Like everything else that comes with Django, the admin app is open
> source, so nothing stops you from having a peek. This particular
> functionality can be found in django/contrib/admin/templatetags/
> admin_list.py, line 28[1]. The template tag has some admin-specifics
> in it, you'd have to copy the template tag and adjust it. Or, and this
> is probably what David so eloquently suggested, you could use one of
> the countless digg-style paginators for Django that float around the
> net. I'm quite fond of this[2] one because it extends the built-in
> pagination facilities instead of completely reinventing the wheel.
>
> Kind regards,
> Benjamin
>
> [1]http://code.djangoproject.com/browser/django/trunk/django/contrib/adm...
> [2]http://www.djangosnippets.org/snippets/773/
--~--~-~--~~~---~--~~
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: digg style pagination

2009-08-14 Thread sniper

You didn't understand my question... i am asking if there is a
django's built in functionality.
Google shows people making custom ones or extending paginator.

On Aug 14, 3:00 pm, David Zhou  wrote:
> http://tinyurl.com/mj29fw
>
> -- dz
>
>
>
> On Fri, Aug 14, 2009 at 2:54 PM, sniper wrote:
>
> > I am trying to do pagination. Just wanted to know if there is a
> > shortcut to show digg style pagination or i have to write my own?
> > I am asking this because in the admin page, the list page uses digg
> > style paging.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



digg style pagination

2009-08-14 Thread sniper

I am trying to do pagination. Just wanted to know if there is a
shortcut to show digg style pagination or i have to write my own?
I am asking this because in the admin page, the list page uses digg
style paging.


--~--~-~--~~~---~--~~
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: Model example for simple family tree

2009-08-12 Thread sniper

It works!! Thanks

On Aug 11, 7:44 pm, Mike Dewhirst  wrote:
> sniperwrote:
> > Hi,
> > I am new to django and wanted to try it out.
>
> > I would like to create a table for family tree
> > where Relation is a many to many table which contains Profile ids
>
> > profile_id, relative_id,type,priority.
>
> > RELATIVE_CHOICES = (
> >         (u'F', u'Father'),
> >         (u'M', u'Mother'),
> >         (u'B', u'Brother'),
> >         (u'S', u'Sister'),
> >         (u'N', u'Son'),
> >         (u'D', u'Daugter'),
> >         (u'H', u'Husband'),
> >         (u'W', u'Wife'),
> >     )
>
> > # Create your models here.
> > class Profile(models.Model):
> >    first_name = models.CharField(max_length=20)
> >    last_name = models.CharField(max_length=20,null=True)
> >    gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
> >    birth_date = models.DateTimeField('birth day',null=True)
> >    notes = models.TextField(null=True)
>
> Sniper
>
> I did exactly the same thing at exactly the same stage of my own
> exposure to Django. It gets easier as the newness wears off a bit and
> you get to trust the error messages.
>
> Good luck
>
> > class Relation(models.Model):
>
>      person = models.ForeignKey(Profile, related_name='person_set')
>
> >    person = models.ForeignKey(Profile)
>
>      relative = models.ForeignKey(Profile, related_name='relation_set')
>
>
>
> >    relative = models.ForeignKey(Profile)
> >    type=models.CharField(max_length=2, choices=RELATIVE_CHOICES)
> >    priority = models.IntegerField(default=1)
>
> > how do i do that?
> > right now i am getting this error
>
> > Error: One or more models did not validate:
> > ftree.relation: Accessor for field 'person' clashes with related field
> > 'Profile.relation_set'. Add a
> >  related_name argument to the definition for 'person'.
> > ftree.relation: Accessor for field 'relative' clashes with related
> > field 'Profile.relation_set'. Add
> >  a related_name argument to the definition for 'relative'.
>
> > thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Model example for simple family tree

2009-08-11 Thread sniper

Hi,
I am new to django and wanted to try it out.

I would like to create a table for family tree
where Relation is a many to many table which contains Profile ids

profile_id, relative_id,type,priority.

RELATIVE_CHOICES = (
(u'F', u'Father'),
(u'M', u'Mother'),
(u'B', u'Brother'),
(u'S', u'Sister'),
(u'N', u'Son'),
(u'D', u'Daugter'),
(u'H', u'Husband'),
(u'W', u'Wife'),
)

# Create your models here.
class Profile(models.Model):
first_name = models.CharField(max_length=20)
last_name = models.CharField(max_length=20,null=True)
gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
birth_date = models.DateTimeField('birth day',null=True)
notes = models.TextField(null=True)


class Relation(models.Model):
person = models.ForeignKey(Profile)
relative = models.ForeignKey(Profile)
type=models.CharField(max_length=2, choices=RELATIVE_CHOICES)
priority = models.IntegerField(default=1)

how do i do that?
right now i am getting this error

Error: One or more models did not validate:
ftree.relation: Accessor for field 'person' clashes with related field
'Profile.relation_set'. Add a
 related_name argument to the definition for 'person'.
ftree.relation: Accessor for field 'relative' clashes with related
field 'Profile.relation_set'. Add
 a related_name argument to the definition for 'relative'.

thanks


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---