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

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

Serving Software Downloads in 956 Categories, Downloaded 50.181.351 Times

django-logicaldelete 1.0

Company: Patrick Altman
Date Added: July 14, 2013  |  Visits: 296

django-logicaldelete

Report Broken Link
Printer Friendly Version


Product Homepage
Download (33 downloads)



Developer comments<br /><br />django-logicaldelete is a small and simple app that I threw together to get some reuse out of something I do in nearly every project and every model I create. It's too easy for good data to get deleted and it be unrecoverable. It's also too easy to fix this by overriding the model's delete() method and just flagging records as deleted and then leveraging Django's Managers to override default behavior so that logically deleted items are not returned in querysets.<br /><br />There are two exceptions however, that I have found useful to this rule.<br /><br /> 1. In the admin I like to see everything with an indicator of whether or not it has been deleted, with the ability to filter down to just active records, (or deleted for that matter).<br /> 2. I still think it is a valid request when an item is fetched for by it's primary key value, that the object should return, even if it is marked as deleted.<br /><br />Using django-logicaldelete<br /><br />Using the app is pretty simple:<br /><br /> 1. Put the logicaldelete sub-folder in your Python Path.<br /> 2. Inherit from logicaldelete.models.Model for all models that you wish to share in this functionality.<br /> 3. Create and/or Register admins for each of these models using logicaldelete.admin.ModelAdmin<br /><br />Additional<br /><br />Logical deletes are handled by date stamping a date_removed column. In addition, a date_created and date_modified columns will be populated as a convenience.<br /><br />Possible Extensions<br /><br />You can easily subclass these two classes to provide generic and useful functionality to your models.<br /><br />UUID Primary Key<br /><br />I typically using UUID fields for my primary keys because they enable me to shard my tables if and when I need to, in addition, they provide an obfuscated id to my data (people can't determine how many of a certain object I have in my database, if I don't want them to know, but simply looking an an integer id in the URL).<br /><br />Sequence Field<br /><br />Many times I find it useful to have an integer field on my models that allow for and explicitly controlled sequencing. I normally implement this as a sort descending implementation where the data is sorted from high to low by sequence value.<br /><br />In order to to implement this you'd subclass both the Model and ModelAdmin, where the Model would be an obvious simple addition of an IntegerField, the ModelAdmin, would override get_query_set, to do something like:<br /><br /><!--code1--><!--ecode1-->class SequencedModel(logicaldelete.models.Model):<br /> sequence = models.IntegerField()<br /><br />class MyLogicalDeletedManager(logicaldelete.models.LogicalDeletedManager):<br /> def get_query_set(self):<br /> if self.model:<br /> qs = super(MyLogicalDeletedManager, self).get_query_set().filter(date_removed__isnull=True)<br /> if SequencedModel in inspect.getmro(self.model):<br /> qs = qs.order_by('-sequence')<br /> return qs<!--code2--><!--ecode2-->

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Addition Deleted Functionality Implement Integer Model Modeladmin Models Object Override Primary Provide Return Sequence Simple Subclass
Users rating: 0/10

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


DJANGO-LOGICALDELETE RELATED
Development Tools  -  tanque de calentamiento con agitacidoDln continua (heating tank with continuous agitation) 1.0
process from the Book of Smith, Corripio - Automatic Process ControlContent:+ m-file linearization of nonlinear model+ m-file definition of the nonlinear model+ simulink models for the simulation of the process
30.72 KB  
Libraries  -  XLObject 2.0.2a
XLObject is a clone of basic services offered by the Qt object model, redesigned around modern features of the C++ language. Signals and slots are used for communication between objects. There are instances when we want some objects to know the...
46.08 KB  
Modules  -  Allow PHP in Posts and Pages 2.2.0:RC1
Allow PHP in posts and pages adds the functionality to include PHP in wordpress posts and pages by adding a simple shortcode [php].code.[/php]This plugin strips away the automatically generated wordpress and tags but still allows the addition of...
10 KB  
Libraries  -  Aranea framework 1.0.10
Aranea is an Open Source Java Hierarchical Model-View-Controller Web Framework that provides a common simple approach to building the web application components, reusing custom or general GUI logic and extending the framework. The framework...
19.7 MB  
Libraries  -  Cymbeline 1.3.1
Cymbeline is an application server framework, including functionality such as DB and arbitrary object pooling, web servers, persistant object repository, and a text console. Cymbeline library was originally designed as an administrative shell...
37.89 KB  
Programming  -  ORMLite 4.40
Object Relational Mapping Lite (ORMLite) provides simple yet powerful functionality for persisting Java objects to SQL databases while avoiding the overhead of other ORMs. Supports MySQL, Postgres, SQL Server, H2, Derby, HSQLDB, Sqlite, and others.
263.03 KB  
Mathematics  -  CM Lagrangian Pendulum Spring Model 1.0
The Lagrangian Pendulum Spring model asks students to solve the Lagrangian for a spring-pendulum and then develop a model of it. It is distributed as a ready-to-run (compiled) Java archive. Double-clicking the ejs_CM_Lagrangian_pendulum_spring.jar...
1.3 MB  
Education  -  Spring Pendulum Model 1.0
The Ejs Spring Pendulum model displays the model of a hollow mass that moves along a rigid rod that is also connected to a spring. The mass, therefore, undergoes a combination of spring and pendulum oscillations. The initial position and...
1.37 MB  
Education  -  Pendulum on an Accelerating Train Model 1.0
The Ejs Pendulum on an Accelerating Train model displays the model of a pendulum on an accelerating train. The problem assumes that the pendulum rod is rigid and massless and of length, L = 2, and the pendulum bob is of mass, m = 1. The initial...
1.44 MB  
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  
NEW DOWNLOADS IN LINUX SOFTWARE, NETWORK & INTERNET
Linux Software  -  EasyEDA PCB Designer for Linux 2.0.0
EasyEDA, a great web based EDA(Electronics Design Automation) tool, online PCB tool, online PCB software for electronics engineers, educators, students, makers and enthusiasts. Theres no need to install any software. Just open EasyEDA in any...
34.4 MB  
Linux Software  -  wpCache® WordPress HTTP Cache 1.9
wpCache® is a high-performance, distributed object, caching system application, generic in nature, but intended for use in speeding up dynamic web applications, by decreasing database load time. wpCache® decreases dramatically the page...
3.51 MB  
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  
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  -  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  
Network & Internet  -  SQL Inject Me 0.4.5
SQL Inject Me is a Firefox extension used to test for SQL Injection vulnerabilities. The tool works by submitting your HTML forms and substituting the form value with strings that are representative of an SQL Injection attack.
133.12 KB