Re: How to order "links" in the Admin?

2011-08-11 Thread Andre Lopes
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
 wrote:
> This is a meta option.
>
> 
> 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']
> 
>
> see: https://docs.djangoproject.com/en/1.3/ref/models/options/#ordering
>
> On Aug 10, 4:25 am, Andre Lopes  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:
>> 
>> 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')
>> 
>>
>> Now I will populate the database with data:
>>
>> 
>> 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
>> 
>>
>> The output of this will be: Google, Yahoo, Altavista
>>
>> Another example: (Here I will reorder the links positions)
>>
>> 
>> 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
>> 
>>
>> 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  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 
>>
>> >> Hi,
>>
>> >> I'm testing Django for my first project using it.
>>
>> >> I have a model like this:
>> >> 
>> >> 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')
>> >> 
>>
>> >> 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 

Re: How to order "links" in the Admin?

2011-08-10 Thread Eric Hutchinson
This is a meta option.


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']


see: https://docs.djangoproject.com/en/1.3/ref/models/options/#ordering

On Aug 10, 4:25 am, Andre Lopes  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:
> 
> 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')
> 
>
> Now I will populate the database with data:
>
> 
> 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
> 
>
> The output of this will be: Google, Yahoo, Altavista
>
> Another example: (Here I will reorder the links positions)
>
> 
> 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
> 
>
> 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  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 
>
> >> Hi,
>
> >> I'm testing Django for my first project using it.
>
> >> I have a model like this:
> >> 
> >> 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')
> >> 
>
> >> 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.



Re: How to order "links" in the Admin?

2011-08-10 Thread creecode
Hello Andre,

Try a Google search for "django admin drag drop reorder admin".  Several 
results there that might point you in the right direction.

I have used a variation on this Django Snippet < 
http://djangosnippets.org/snippets/1053/ > to do reordering in some of my 
projects.

Toodle-l...
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SSBCKCjJ3y8J.
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: How to order "links" in the Admin?

2011-08-10 Thread Andre Lopes
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:

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')


Now I will populate the database with data:


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


The output of this will be: Google, Yahoo, Altavista

Another example: (Here I will reorder the links positions)


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


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  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 
>>
>> Hi,
>>
>> I'm testing Django for my first project using it.
>>
>> I have a model like this:
>> 
>> 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')
>> 
>>
>> 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.



Re: How to order "links" in the Admin?

2011-08-09 Thread Jian Chang
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 

> Hi,
>
> I'm testing Django for my first project using it.
>
> I have a model like this:
> 
> 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')
> 
>
> 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.



How to order "links" in the Admin?

2011-08-09 Thread Andre Lopes
Hi,

I'm testing Django for my first project using it.

I have a model like this:

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')


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.