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...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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,
Thanks a lot for your help.
Best Regards,