background preloader

Django

Facebook Twitter

Welcome to django-braces’s documentation! — django-braces 1.4.0 documentation. Fields — django-model-utils 2.3a1 documentation. StatusField¶ A simple convenience for giving a model a set of “states.”

Fields — django-model-utils 2.3a1 documentation

StatusField is a CharField subclass that expects to find a class attribute called STATUS on its model or you can pass choices_name to use a different attribute name, and uses that as its choices. Also sets a default max_length of 100, and sets its default value to the first item in the STATUS choices: from model_utils.fields import StatusFieldfrom model_utils import Choices class Article(models.Model): STATUS = Choices('draft', 'published') # ... status = StatusField() (The STATUS class attribute does not have to be a Choices instance, it can be an ordinary list of two-tuples).

Using a different name for the model’s choices class attribute. Django-model-utils — django-model-utils 2.3a1 documentation. Ramblings on startups, NYC, advertising and hacking (mostly Python) The alpha of Django 1.7 was released recently and I’ve started to experiment with the new applications feature.

Ramblings on startups, NYC, advertising and hacking (mostly Python)

Applications include some combination of models, views, templates, template tags, static files, URLs, middleware, etc. They’re generally wired into projects with the INSTALLED_APPS setting and optionally with other mechanisms such as URLconfs, the MIDDLEWARE_CLASSES setting, or template inheritance. The power of this feature is that it allows you to create an application configuration class which has a ready method, allowing you to perform initialization tasks such as registering signals when the application first loads.

To get started with applications, set the default_app_config variable in your application’s __init__.py: Now create a new file called apps.py in the root of your application and create a class that inherits from AppConfig: Within this class you can define a variety of things including the application’s name, verbose name and the ready method. Like this: Using Waffle — django-waffle 0.10.1 documentation. Effective Django Forms — Effective Django. Form Basics Forms in Context Defining Forms Forms are composed of fields, which have a widget. from django.utils.translation import gettext_lazy as _from django import forms class ContactForm(forms.Form): name = forms.CharField(label=_("Your Name"), max_length=255, widget=forms.TextInput, ) email = forms.EmailField(label=_("Email address")) Instantiating a Form Unbound forms don’t have data associated with them, but they can be rendered: Bound forms have specific data associated, which can be validated: form = ContactForm(data=request.POST, files=request.FILES) Accessing Fields Two ways to access fields on a Form instance form.fields['name'] returns the Field objectform['name'] returns a BoundFieldBoundField wraps a field and value for HTML output Initial Data >>> form['name'].value()'First and Last Name' Rendering Forms Idiomatic Form Usage Form Output.

Effective Django Forms — Effective Django

Django Vanilla Views - Model Views. Model_views.py The model views provide a simple set of generic views for working with Django querysets and model instances.

Django Vanilla Views - Model Views

They replicate the functionality of Django's existing ListView, DetailView, CreateView, UpdateView and DeleteView, but present a simpler API and implementation. View -- GenericModelView --+-- ListView | +-- DetailView | +-- CreateView | +-- UpdateView | +-- DeleteView GenericModelView. Aaugustin/django-c10k-demo. Wunki/django-salted. Theospears/django-speedbar. Django-nonrel/djangotoolbox. Digging up Django class-based views - 3 - The Digital Cat. This post refers to Django 1.5.

Digging up Django class-based views - 3 - The Digital Cat

Please be warned that some of the matters discussed here, some solutions or the given code can be outdated by more recent Django versions In the first two issues of this short series we wandered around the basic concepts of class-based views in Django, and started understanding and using two of the basic generic views Django makes available to you: ListView and DetailView.

Both are views that read some data from the database and show them on a rendered template. Llazzaro/django-scheduler. Deepwalker/aldjemy. Mgrouchy/django-stronghold. Arteria/django-hijack. Django Class-Based-View Inspector. Re: Django ORM support for NoSql databases. Hi all, On Tue, 17 Dec 2013, Tom Evans wrote: > On Tue, Dec 17, 2013 at 3:35 PM, parisrocks ><saravanan....

Re: Django ORM support for NoSql databases

@gmail.com> wrote: >> Waiting for official Django ORM support for NoSql databases. Django-firebird/compiler.py at master · maxirobaina/django-firebird. Getting Started. Install Firebase.

Getting Started

Ready to use with one line of code. //Use YOUR Firebase URL (not the one below) var fb = new Firebase(" /* Remember to include firebase JS Library <script src=" */ Re: Must a Django Database Support Migrations? Quick Start — flask-admin 1.0.9 documentation. This page gives a quick introduction to the Flask-Admin library.

Quick Start — flask-admin 1.0.9 documentation

It is assumed that the reader has some prior knowledge of the Flask framework. If you’re a Django user, you might also find the Migrating from Django guide helpful. Introduction The library is intended to be as flexible as possible. And the developer should not need to monkey-patch anything to achieve desired functionality. The library uses one simple, but powerful concept - administrative pieces are built as classes with view methods. For example, here is an absolutely valid administrative piece: class MyView(BaseView): @expose('/') def index(self): return self.render('admin/myindex.html') @expose('/test/') def test(self): return self.render('admin/test.html') If the user visits the index view, the admin/myindex.html template will be rendered. So, how does this approach help in structuring an admin interface? Australia (au) — django-localflavor 1.1 documentation.