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.541.184 Times

django-publicmanager for Linux 0.9.2

Company: Gregor M??N—?…llegger
Date Added: July 02, 2013  |  Visits: 212

django-publicmanager for Linux

Report Broken Link
Printer Friendly Version


Product Homepage
Download (16 downloads)



django-publicmanager is a Django app that provides a custom queryset class and managers that handle the public availability of database objects. The classes provide a public method that filters by boolean is_public and date based pub_date fields.<br /><br />Installation:<br /><br />All you need to install the django-publicmanager package is a simple sudo easy_install dango-publicmanager.<br /><br />Usage:<br /><br />The package contains just two managers. The manager GenericPublicManager works exactly like django's default manager except that it provides a public() method that returns only public available objects. The athor manager, PublicOnlyManager, returns public objects by default without calling any extra method.<br /><br />It should be obvious that you will at least need a model to use one or both of these managers. The managers will use one or more of the following fields to determine if an object is public or not.<br /><br /> * is_public: This must be a models.BooleanField and if it is set to True, it will be treated as public.<br /> * pub_date must be a models.DateTimeField or models.DateField. The date must be either in the past or equal to the current time to make the object public.<br /> * You can use a status field which holds information about the public availability of the object. To use it you must provide the status_attr and status_values attributes to the manager. The status_attr specifies the field name. If the field's value is found in list status_values the object will be public. The most common use of this feature is to use it with choices. See the examples below.<br /><br />An object is only public if all of these fields, if existent in the model, are evaluated to be public. This means if is_public is set to True but pub_date points to a date in the future the whole objects will be treated as not public.<br /><br />Examples:<br /><br />Here is a pretty simple example using only the is_public and pub_date fields:<br /><br />from django.db import models<br />from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager<br /><br />class Example(models.Model):<br /> title = models.CharField(max_length=50)<br /> is_public = models.BooleanField(default=True)<br /> pub_date = models.DateTimeField()<br /><br /> objects = GenericPublicManager()<br /> public = PublicOnlyManager()<br /><br />Now you can access the objects like this:<br /><br />>>> Example.objects.create(title='A', is_public=True, pub_date=datetime.now())<br />>>> Example.objects.create(title='B', is_public=True, pub_date=datetime.now() + timedelta(1))<br />>>> Example.objects.create(title='C', is_public=False, pub_date=datetime.now())<br />>>> Example.objects.create(title='D', is_public=True, pub_date=datetime.now() - timedelta(1))<br />>>> Example.objects.all()<br />[< Example: A >, < Example: B >, < Example: C >, < Example: D >]<br />>>> Example.objects.public()<br />[< Example: A >, < Example: D >]<br />>>> Example.public.all()<br />[< Example: A >, < Example: D >]<br />>>> Example.objects.public()<br />[< Example: A >, < Example: D >]<br />>>> Example.objects.filter(title='A').public()<br />[< Example: A >]<br /><br />You don't have to name the fields exactly like above. But if you use athor names, you have to tell the managers the new names:<br /><br />from django.db import models<br />from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager<br /><br />class Example(models.Model):<br /> title = models.CharField(max_length=50)<br /> online = models.BooleanField(default=True)<br /> available_from = models.DateTimeField()<br /><br /> objects = GenericPublicManager(<br /> is_public_attr='online',<br /> pub_date_attr='available_from')<br /> public = PublicOnlyManager(<br /> is_public_attr='online',<br /> pub_date_attr='available_from')<br /><br />Last but not least, an example with the status field:<br /><br />from django.db import models<br />from django_publicmanager.managers import GenericPublicManager, PublicOnlyManager<br /><br />class Example(models.Model):<br /> STATUS_CHOICES = (<br /> (1, 'draft'),<br /> (2, 'review'),<br /> (3, 'public'),<br /> (4, 'featured'),<br /> )<br /><br /> title = models.CharField(max_length=50)<br /> status = models.PositiveIntegerField(choices=STATUS_CHOICES)<br /><br /> objects = GenericPublicManager(<br /> status_attr='status',<br /> status_values=(3,4))<br /> public = PublicOnlyManager(<br /> status_attr='status',<br /> status_values=(3,4))<br /><br />#md5=f69a346c1b17120342397d7da4fc64b9

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Django Publicmanagermanagers Djangodb Fields Genericpublicmanager Gtgtgtgt Import Manager Managers Modelsdatetimefield Modelsfrom Object Objects Pub Date Public Public Dtrue Publiconlymanagerclass Status Title
Users rating: 0/10

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


DJANGO-PUBLICMANAGER FOR LINUX RELATED
Programming  -  littletable 0.3
littletable is a lightweight in-memory data manager of collections of Python objects, providing ORM-like access for querying and joining data using object attributes as pseudo-columns.
65.33 KB  
Network & Internet  -  zope.mimetype 1.3.1
This package provides a way to work with MIME content types. There are several interfaces defined here, many of which are used primarily to look things up based on different bits of information. The basic idea behind this is that...
61.44 KB  
Productivity  -  TextPlate 1.0.0.0
Developed by : Patrick Jason Lim TextPlate is a simple text template manager. You can add, edit and use templates for SMS and also status update for social networks linked to your Windows Phone, and you can even copy the template message...
1024 KB  
HTML Utilities  -  django-secretballot 0.2.3
django-secretballot Django voting application that allows voting without a logged in user. Provides abstract base model for types that the user wishes to allow voting on as well as related utilities including generic views to...
10.24 KB  
Network & Internet  -  django-inplaceedit-extra-fields 0.0.4
Inplace Edit Form Extra Field is a Django application that adds other useful fields. It is distributed under the terms of the GNU Lesser General Public License
10.24 KB  
Database Tools  -  EMS SQL Manager 2007 Lite for Oracle 1.2
EMS SQL Manager for Oracle is a high performance tool for Oracle Database Server administration and development. SQL Manager for Oracle works with any Oracle versions from 8.1.7 to 10g and supports all Oracle objects and all Oracle data types...
13.82 MB  
Network & Internet  -  django-postal 0.8
The motivation behind this project is that most countries have different forms of postal addresses e.g. http://www.bitboost.com/ref/international-address-formats.html , http://en.wikipedia.org/wiki/Address_%28geography%29 This...
10.24 KB  
Programming  -  django-yama 0.1
`django-yama' (Yet Another Menuing App) is a fairly generic menuing application for Django 1.0 (and up). It supports hierarchical (tree-structure) menus of arbitrary depth, and enables you to create menus linking to models and views from other...
61.44 KB  
HTML Utilities  -  django-picklefield 0.2.1
**django-picklefield** provides an implementation of a pickled object field. Such fields can contain any picklable objects. The implementation is taken and adopted from `Django snippet #1694 `_ by Taavi Taijala, which is in
10.24 KB  
Network & Internet  -  django-smart-slug 0.1.0
There are exhausting examples in the tests, but here's the quick rundown: from django.db import models from smart_slug.fields import SmartSlugField class Simple(models.Model): slug = SmartSlugField(max_length=5,...
10.24 KB  
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