Thanks for the reply. What I need is a snipped like this one: http://djangosnippets.org/snippets/1053/
Thanks a lot for your help. Best Regards, On Wed, Aug 10, 2011 at 9:01 AM, Eric Hutchinson <eric.hutchin...@burgopakusa.com> wrote: > This is a meta option. > > <code> > from django.db import models > import datetime > class Directory(models.Model): > website_name = models.CharField(max_length=200) > website_url = models.CharField(max_length=200) > website_position = models.IntegerField() > pub_date = models.DateTimeField('date published') > > class Meta: > ordering=['website_position'] > </code> > > see: https://docs.djangoproject.com/en/1.3/ref/models/options/#ordering > > On Aug 10, 4:25 am, Andre Lopes <lopes80an...@gmail.com> wrote: >> Hi, >> >> Thanks for the reply. >> >> I use the field "website_position" to control the position of the url, >> this is an Integer field. >> >> The model I use is this: >> <code> >> from django.db import models >> import datetime >> >> class Directory(models.Model): >> website_name = models.CharField(max_length=200) >> website_url = models.CharField(max_length=200) >> website_position = models.IntegerField() >> pub_date = models.DateTimeField('date published') >> </code> >> >> Now I will populate the database with data: >> >> <query output> >> website_name | website_url | website_position | pub_date >> Google |http://www.google.com | 1 | >> 10-08-2011 >> Yahoo |http://www.yahoo.com | 2 | >> 10-08-2011 >> Altavista |http://www.altavista.com | 3 >> | 10-08-2011 >> </query output> >> >> The output of this will be: Google, Yahoo, Altavista >> >> Another example: (Here I will reorder the links positions) >> >> <query output> >> website_name | website_url | website_position | pub_date >> Google |http://www.google.com | 3 | >> 10-08-2011 >> Yahoo |http://www.yahoo.com | 2 | >> 10-08-2011 >> Altavista |http://www.altavista.com | 1 >> | 10-08-2011 >> </query output> >> >> Ant the output will be: Altavista, Yahoo, Google >> >> The thing here is that I control the positions of the links in Django >> Admin with integers in the field "website_position". I'd like to know >> if Django Admin have a better way to deal with this. There is possible >> to control this with arrows to change the position of links, I click >> in the up arrow and the link go up... I click in a down arrow and the >> link goes down... This is possible in the Django Admin? >> >> Best Regards, >> >> >> >> >> >> >> >> On Tue, Aug 9, 2011 at 6:43 PM, Jian Chang <changjia...@gmail.com> wrote: >> > you should figure out what it is based on to order these urls. >> >> > i use time stamp to order them. >> >> > 2011/8/10 Andre Lopes <lopes80an...@gmail.com> >> >> >> Hi, >> >> >> I'm testing Django for my first project using it. >> >> >> I have a model like this: >> >> <code> >> >> from django.db import models >> >> import datetime >> >> >> class Directory(models.Model): >> >> website_name = models.CharField(max_length=200) >> >> website_url = models.CharField(max_length=200) >> >> website_position = models.IntegerField() >> >> pub_date = models.DateTimeField('date published') >> >> </code> >> >> >> Basicaly this model is for storing URL's, but I need to order them, >> >> and for that I use "website_position" to control if the link will be >> >> at the top or at the end or in the middles... >> >> >> My question is, there is a better way to control the positions of the >> >> links? Django Admin have any feature that could help to deal with this >> >> specific case? >> >> >> Please let me know. >> >> >> Best Regards, >> >> >> -- >> >> 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. >> >> > -- >> > 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. > > -- > 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. > > -- 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.