Re: Specify order of content items

2006-07-08 Thread David Robinson

[EMAIL PROTECTED] wrote:
> Interesting! Nice to see an example of how to integrate dojo and
> django, there aren't many...
> 
> Are you building a custom administration interface for Sputnik which
> allows for the reordering of news items by use of this technique?
> Did you try to implement this drag and drop functionality for the
> django admin interface as well?


It's a custom interface for managing news items. The reason for that is 
that there is a many-to-many relationship between news items and topics, 
and it's in the linking table that we need to do the sequencing. (Within 
any topic, news items can be sorted differently. For instance, we have a 
home page for people who are on-campus and one for people off-campus, 
and sometimes a story is a bigger deal internally than externally, or 
vice-versa.)

In order to add the sequence field to the linking table and still do 
some other things that we needed to do, we needed to build the admin 
interface ourselves.  We haven't tried adding drag-and-drop 
functionality to anything in the built-in admin interface yet.

I am hoping to flesh out the blog next week and over the coming weeks. 
We've been doing some interesting things with Django, and I would like 
to create the kind of "tales from the front" site that I was looking for 
a couple of months ago when we first started looking into using Django. 
  Thanks for the encouragement.

Dave

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Specify order of content items

2006-07-08 Thread drakepad

Interesting! Nice to see an example of how to integrate dojo and
django, there aren't many...

Are you building a custom administration interface for Sputnik which
allows for the reordering of news items by use of this technique?
Did you try to implement this drag and drop functionality for the
django admin interface as well?

Hope your blog will feature more related writings in the near future.

Thanks.

David Robinson wrote:
> drakepad wrote:
> > Thanks for clarifying the issue Arthur. Drag and drop support would be
> > fantastic indeed...
>
> We've got the same sort of need to specify the order of news items.  And
> we have done it using Dojo's drag and drop. I'm not the one who did it,
> but the guy who did get it to work wrote about the experience on a blog
> we've just started to talk about what we're doing with Django:
> http://www.carthage.edu/webdev/
> 
> Dave


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Specify order of content items

2006-07-07 Thread David Robinson

drakepad wrote:
> Thanks for clarifying the issue Arthur. Drag and drop support would be
> fantastic indeed... 

We've got the same sort of need to specify the order of news items.  And 
we have done it using Dojo's drag and drop. I'm not the one who did it, 
but the guy who did get it to work wrote about the experience on a blog 
we've just started to talk about what we're doing with Django: 
http://www.carthage.edu/webdev/

Dave

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Specify order of content items

2006-07-07 Thread drakepad

Thanks for clarifying the issue Arthur. Drag and drop support would be
fantastic indeed... Would a series of up/down buttons be easier to
implement?

In the meantime, I'll use intervals between the individual items'
position values to leave some room for maneuver.

Ciao!

On 7/8/06, arthur debert <[EMAIL PROTECTED]> wrote:
>
> Hi drakepad.
>
> I am not aware of a good way to implement this, but this is how I have
> been doing it...If you must have an arbitrary order  (not by date or
> alphabetical) you must create a field specifically to store your
> desired order.
>
> class MyModel(Model):
>... regular fields go here...
> position = IntegerField()
>
> class Meta:
> ordering = 'position'
>
> this way your models will be ordered according to the value you supply
> on the 'position' field. The one caveat is that since it's inside the
> model, if you need to , for example swap to items position you will
> have to edit both model instances and change their field accordingly. I
> hope to implement some drag and drop for this in the admin...but this
> is trickier than it seems...and it might be a while unitll I get the
> chance.
>
> If you do the 'position' field trick, any query set will order by it...
> and at any point you can change the ordering (in your views):
> new_order = MyModel.objects.all().order_by('some_field')
>
> cheers,
> arthur
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Specify order of content items

2006-07-07 Thread arthur debert

Hi drakepad.

I am not aware of a good way to implement this, but this is how I have
been doing it...If you must have an arbitrary order  (not by date or
alphabetical) you must create a field specifically to store your
desired order.

class MyModel(Model):
   ... regular fields go here...
position = IntegerField()

class Meta:
ordering = 'position'

this way your models will be ordered according to the value you supply
on the 'position' field. The one caveat is that since it's inside the
model, if you need to , for example swap to items position you will
have to edit both model instances and change their field accordingly. I
hope to implement some drag and drop for this in the admin...but this
is trickier than it seems...and it might be a while unitll I get the
chance.

If you do the 'position' field trick, any query set will order by it...
and at any point you can change the ordering (in your views):
new_order = MyModel.objects.all().order_by('some_field')

cheers, 
arthur


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Specify order of content items

2006-07-07 Thread drakepad

Hello everybody,

Suppose I want to manually specify the order in which a number of
content items are displayed in a page (e.g. list of menu items).

I want to be able to control the ordering from the admin interface,
using for example an 'ordering' weight for each individual item.

- What would be a good way to implement this kind of behaviour from
the admin interface perspective? Any ideas?

- How do I implement this ordering process at views/template level? Suggestions?

Any help is appreciated. Thanks, gjiro.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---