Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 29.612.785 Times

django-sortedm2m 0.3.0

Company: Gregor M?“N?llegger
Date Added: August 21, 2013  |  Visits: 171

django-sortedm2m

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 downloads)



django-sortedm2m is a drop in replacement for Django's own ManyToManyField. The provided SortedManyToManyField behaves like the original one but remembers the order of added relations.<br /><br />sortedm2m requires at least django 1.2. Django 1.1 or earlier is not supported.<br /><br />Usecases<br /><br />Imagine that you have a gallery model and a photo model. Usually you want a relation between these models so you can add multiple photos to one gallery but also want to be able to have the same photo on many galleries.<br /><br />This is where you usually can use many to many relation. The downside is that django's default implementation doesn't provide a way to order the photos in the gallery. So you only have a random ordering which is not suitable in most cases.<br /><br />You can work around this limitation by using the SortedManyToManyField provided by this package as drop in replacement for django's ManyToManyField.<br /><br />Usage<br /><br />Use SortedManyToManyField like ManyToManyField in your models:<br /><br />from django.db import models<br />from sortedm2m.fields import SortedManyToManyField<br /><br />class Photo(models.Model):<br /> name = models.CharField(max_length=50)<br /> image = models.ImageField(upload_to='...')<br /><br />class Gallery(models.Model):<br /> name = models.CharField(max_length=50)<br /> photos = SortedManyToManyField(Photo)<br /><br />If you use the relation in your code like the following, it will remember the order in which you have added photos to the gallery.<br /><br />gallery = Gallery.objects.create(name='Photos ordered by name')<br />for photo in Photo.objects.order_by('name'):<br /> gallery.photos.add(photo)<br /><br />Admin<br /><br />SortedManyToManyField provides a custom widget which can be used to sort the selected items. It renders a list of checkboxes that can be sorted by drag'n'drop.<br /><br />It's also possible to use the SortedManyToManyField with admin's raw_id_fields option in the ModelAdmin definition. Add the name of the SortedManyToManyField to this list to get a simple text input field. The order in which the ids are entered into the input box is used to sort the items of the sorted m2m relation.<br /><br />Example:<br /><br />from django.contrib import admin<br /><br />class GalleryAdmin(admin.ModelAdmin):<br /> raw_id_fields = ('photos',)<br /><br />#md5=cbbdcff4703eb425457adb7cc64af450

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Added Django Gallery Import Input Items Manytomanyfield Model Modelscharfieldmax Length Modelsfrom Order Photo Photos Provided Raw Fields Relation Replacement Sorted Sortedmanytomanyfield
Users rating: 0/10

License: Freeware Size: 20.48 KB
USER REVIEWS
More Reviews or Write Review


DJANGO-SORTEDM2M RELATED
Network & Internet  -  django-simple-ratings 0.2.0
a simple, extensible rating system. With a little bit more also, a playground for different stuff i've been reading about in programming collective intelligence, by toby segaran. this stuff lives in utils.py and is there...
10.24 KB  
Network & Internet  -  django-export 0.0.4
django-export allows you to export model objects in a wide range of serialized formats (JSON, CSV, XML, YAML). Exports can be filtered and ordered on any of the particular model's fields. django-export utilizes django-object-tools to...
10.24 KB  
Modules  -  zOOmCat RC3c 1.0
This plugin (mambot) creates a gallery inside content items by accessing all valid, unprotected, and published pictures inside a Zoom Media Gallery category that you designate. The Gallery created is tableless and based on Cascading Style Sheets (...
 
Modules  -  zOOmCat RC3c 1.0
This plugin (mambot) creates a gallery inside content items by accessing all valid, unprotected, and published pictures inside a Zoom Media Gallery category that you designate. The Gallery created is tableless and based on Cascading Style Sheets (...
 
Modules  -  zOOmCat RC3c 1.0
This plugin (mambot) creates a gallery inside content items by accessing all valid, unprotected, and published pictures inside a Zoom Media Gallery category that you designate. The Gallery created is tableless and based on Cascading Style Sheets (...
 
Graphics Cataloging Tools  -  JavaScript Photo Gallery Maker 1.0
JavaScript Photo Gallery Maker. Digital picture albums made with JavaScript Photo Gallery are high-end web applications that look and behave exactly like desktop apps! Use Windows or MAC version of the program. It is absolutely FREE! Creating a...
5.72 MB  
Modules  -  WP Mobileme Gallery 1.0
WP MobileMe Gallery is the so long waited plugin to include albums and photos hosted on Apple MobileMe service. Easy to use, it is fully customable.It is finally possible to display your photo and movie galleries directly on your website and to...
276.48 KB  
Programming  -  SwapList 0.1 Alpha
Java list implementation that swaps list items to a disk file in order to avoid out-of-memory error.
10.24 KB  
Programming  -  CwComplete 1.0
Features Easy to use, simply provide the input field and an Ajax-URL Values can also be provided via javascript Usable with keyboard and mouse
61.44 KB  
Development Editors  -  Gallery App Creator 1.0.3
Gallery App Creator simply lets you convert your images and photo galleries into native Android apps. You may brand the app with your own icon and app name. A text caption may be displayed along each image. You can play an audio file alongside...
31.26 MB  
NEW DOWNLOADS IN LINUX SOFTWARE, NETWORK & INTERNET
Linux Software  -  Polling Autodialer Software 3.4
ICTBroadcast Auto Dialer software has a survey campaign for telephone surveys and polls. This auto dialer software automatically dials a list of numbers and asks them a set of questions that they can respond to, by using their telephone keypad....
488 B  
Linux Software  -  Total Video Converter Mac Free 3.5.5
Total Video Converter Mac Free developed by EffectMatrix Ltd is the official legal version of Total Video Converter which was a globally recognized brand since 2006. Total Video Converter Mac Free is a free but powerful all-in-one video...
17.7 MB  
Linux Software  -  Skeith mod_log_sql Analyzer 2.10beta2
Skeith is a php based front end for analyzing logs for Apache using mod_log_sql.
47.5 KB  
Linux Software  -  SLAX 6.0+
Slax is a modern, portable, small and fast Linux operating system with a modular approach and outstanding design. Despite its small size, Slax provides a wide collection of pre-installed software for daily use, including a well organized graphical...
190 KB  
Linux Software  -  GTK+ 2.5
GTK+, which stands for the GIMP Toolkit, is a library for creating graphical user interfaces for the X Window System. It is designed to be small, efficient, and flexible. GTK+ is written in C with a very object-oriented approach. Language bindings...
60 MB  
Network & Internet  -  Free WiFi Hotspot 3.3.1
Free WiFi Hotspot is a super easy solution to turn your laptop or notebook into a portable Wi-Fi hotspot, wirelessly sharing your internet connections like DSL, Cable, Bluetooth, Mobile Broadband Card, Dial-Up, etc. through the built-in wireless...
1.04 MB  
Network & Internet  -  Easy Uploads 1.8
Easy uploads is a file storage media streaming application designed by Filestreamers that allows you to upload, store, and stream your files from their virtually unlimited file storage server. Easy Uploads can backup,share, and stream your files...
615.97 KB  
Network & Internet  -  IPv6 CARE 3.2b
IPv6 CARE, "IPv6 Compliant Automatic Runtime Environment", is a Linux tool able to patch ipv6-agnostic programs on-the-fly ('patch' mode). It can also generate a diagnosis about the IPv6 compliance of an application ('check' mode).
409.6 KB  
Network & Internet  -  PacketFence ZEN 3.1.0
PacketFence is a fully supported, trusted, Free and Open Source network access control (NAC) system. Boosting an impressive feature set including a captive-portal for registration and remediation, centralized wired and wireless management, 802.1X...
1024 MB  
Network & Internet  -  django-dbstorage 1.3
A Django file storage backend for files in the database.
10.24 KB