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

django-generic-flatblocks 0.3.0

Company: Martin Mahner
Date Added: June 13, 2013  |  Visits: 697

django-generic-flatblocks

Report Broken Link
Printer Friendly Version


Product Homepage
Download (41 downloads)



django-generic-flatblocks is a Django plugin that solves this problem as it knows nothing about the content itself. You attach your hand made content node (a simple model) where you can define any fields you want.<br /><br />Installation<br /><br /> 1. Insert django_generic_flatblocks to your INSTALLED_APPS in your settings.<br /> 2. (optional) Define the url prefix to your contrib.admin installation in the setting ADMIN_URL_PREFIX. Most commonly this is /admin/. Beware the trailing slash.<br /> 3. Resync your database: ./manage.py syncdb<br /><br />Usage in templates<br /><br />First of all, in every template you want to use generic-flatblocks, load the templatetags library:<br /><br />{% load generic_flatblocks %}<br /><br />Then define a content node using the gblock templatetag:<br /><br />{% gblock "unique_slug" for "applabel.modelname" with "render/with/template.html" as "variable" %}<br /><br />The arguments in detail:<br /><br />* "unique_slug" (required): The slug argument defines under which key the content is stored in your database. You can define as many slugs as you want, just use a comma as separator. You can use context-variables as well. Examples:<br /><br /> "homepage headline" becomes "homepage_headline"<br /> "homepage","headline" becomes "homepage_headline"<br /> "homepage_title",LANGUAGE_CODE becomes "homepage_title_en" (depends on the users locale code)<br /><br />* for "applabel.modelname" (required): The for argument defines, what content-node (model) will be used to store and display the content. The format is appname.modelname. For some contributed content-nodes see Contributed content nodes below. This argument can be a context-variable.<br />* with "template_path" (optional): You can define a template that is used for rendering the content node. If you do not provide any template, the default template //flatblock.html is used. This argument can be a context-variable.<br />* as "variable name" (optional): If you provide a variable name, the rendered content node is stored in it. Otherwise it's displayed directly. This argument can be a context-variable.<br /><br />Create your own content node<br /><br />A content node is a simple django-model. No quirks. If you want to use a title and a textfield as your content-node, define a new model Entry in your application myproject:<br /><br />from django.db import models<br />from django.contrib import admin<br /><br />class Entry(models.Model):<br /> title = models.CharField(max_length=255, blank=True)<br /> content = models.TextField(blank=True)<br /><br /> def __unicode__(self):<br /> return self.title<br /><br />admin.site.register(Entry)<br /><br />Important<br /><br />django-generic-flatblocks creates an empty content-node upon first request, so make sure each field has either it's default value or allow blank=True. Don't forget to register your Model in the admin backend, if you want to edit it there.<br /><br />Then create a template myproject/entry/flatblock.html in your template directory. This template is the default template to render the content node, if you do not provide a unique template for it (with argument).<br /><br />In this template are all context-variables from the parent template available plus some extra variables:<br /><br /> * object: This variable is the model-instance for the generic block.<br /> * generic_object: This variable is the model-instance for the generic content object itself. Mostly you don't need this.<br /> * admin_url: A URL to the change view of the current object. This variable is None if the current user has no change permissions for the object.<br /><br />A common template source for the above content node would be:<br /><br />< h1 >{{ object.title }}< /h1 ><br />{{ object.content|safe }}<br /><br />{% if admin_url %}edit this{% endif %}<br /><br />In your templates, create a new content node using the templatetag:<br /><br />{% gblock "about_me" for "myproject.Entry" %}<br /><br />Contributed content nodes<br /><br />django-generic-flatblocks comes with some very commonly used content-nodes. They are not installed by default. To do so, insert django_generic_flatblocks.contrib.gblocks to your INSTALLED_APPS in your settings and resync your database: ./manage.py syncdb.<br /><br />The contributed content nodes are:<br /><br /> * gblocks.Title: A CharField rendered as a Tag.<br /> * gblocks.Text: A TextField rendered as html paragraphs. (This is what django-chunks provides)<br /> * gblocks.Image: A ImageField rendered as Tag.<br /> * gblocks.TitleAndText: A CharField and a TextField. (This is what django-flatblocks provides)<br /> * gblocks.TitleTextAndImage: A CharField, TextField and ImageField<br /><br />So if you want to display a title and textfield, use this templatetag for example:<br /><br />{% gblock "about_me" for "gblocks.TitleAndText" %}<br /><br />md5=c98c2c1d3dc8d74f635177ce438e70cc

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Argument Charfield Content Contentnode Database Default Define Django Generic Flatblocks 0 3 0 Gblock Model Object Optional Provide Rendered Template Templatetag Textfield Title Variable
Users rating: 0/10

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


DJANGO-GENERIC-FLATBLOCKS RELATED
Programming  -  django-generic-images 0.36
django-generic-images is a Django plugin that provides image model (with useful managers etc) that can be attached to any other Django model using generic relations. md5=a99a15c994543cfad18e19a1a572d4c2
368.64 KB  
Network & Internet  -  django-generic-confirmation 0.3.0
Every time a user enters data and you only want to accept it after it was verified (think of: email addresses, (mobile) phone numbers, postal addresses, bank accounts ...) django-generic-confirmation will allow you to implement the confirmation...
10.24 KB  
Network & Internet  -  django-nani 0.0.2
django-nani provides a high level API to maintain multilingual content in your database using the Django ORM.
30.72 KB  
Network & Internet  -  lfc-theme 1.0 Beta 3
The lfc-theme package contains the default theme for LFC. LFC is a Content Manangement System based on Django. #md5=fc48e8cf32f991cd397d9a01e5acd825
102.4 KB  
Network & Internet  -  django-versions 1.0.1
django-versions allows you to version the data stored in django models seamlessly. To get started all you need to do is to set VERSIONS_REPOSITORIES variable in your settings and configure the repositories you would like to use, then just subclass...
20.48 KB  
Network & Internet  -  django-mptt 0.5.2
Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances. For installation instructions, see the file "INSTALL" in this directory; for instructions on how to use...
71.68 KB  
Network & Internet  -  django-cachepurge 0.3
This package allows Django to purge HTTP cache when a model instance is changed or deleted. It does this by sending "PURGE" requests to one or more upstream HTTP cache (such as Squid or Varnish). This is inspired by Plone CacheFu...
10.24 KB  
Web Authoring  -  PublicPIM Website Database App 0.5.3
Has 3 Part Process instructions to automatically provide our Database application created with Javeline Framework over an open MySQL db to your website. Free ppContact widget available for interacting with database from web page. Upload to a...
841 KB  
Communication Tools  -  ActiveBoard b
A fully featured bulletin board system that uses flat files to store content (no database system required).
323.11 KB  
Science  -  NMRShiftDB rc.1.1
NMRShiftDB is an open-source, open-access, open-submission, open-content web database for chemical structures and their nuclear magnetic resonance data.
7.73 MB  
NEW DOWNLOADS IN PROGRAMMING, SPECIALIZED TOOLS
Programming  -  Cedalion for Linux 0.2.6
Cedalion is a programming language that allows its users to add new abstractions and define (and use) internal DSLs. Its innovation is in the fact that it uses projectional editing to allow the new abstractions to have no syntactic limitations.
471.04 KB  
Programming  -  Math::GMPf 0.29
Math::GMPf - perl interface to the GMP library's floating point (mpf) functions.
30.72 KB  
Programming  -  Net::Wire10 1.08
Net::Wire10 is a Pure Perl connector that talks to Sphinx, MySQL and Drizzle servers. Net::Wire10 implements the low-level network protocol, alias the MySQL wire protocol version 10, necessary for talking to one of the aforementioned...
30.72 KB  
Programming  -  logilab-common 0.56.2
a bunch of modules providing low level functionnalities shared among some python projects devel Please note that some of the modules have some extra dependencies. For instance, logilab.common.db will require a db-api 2.0 compliant...
174.08 KB  
Programming  -  OpenSSL for linux 1.0.0a
The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a...
3.83 MB  
Specialized Tools  -  SIMRI 2.0
SIMRI: a versatile and interactive Magnetic Resonance Imaging (MRI) simulator.Such a simulator is a command line software written in C that reproduces the physical phenomenas encountered during an MRI acquisition to produce a realistic MRI image.
6.39 MB  
Specialized Tools  -  Java Web Start Plugin for Eclipse 1.2.1
Java Web Start Plugin for Eclipse (WS4E) helps you to deploy your Java application through Java Web Start. With WS4E, Developers with very little knowledge can deploy their applications with just a few clicks. For advanced developers, WS4E is...
204.8 KB  
Specialized Tools  -  TUGGO for Linux 1.0.0
TUGGO is a website management system allowing anyone to easily create their own website without any code knowledge.
942.08 KB  
Specialized Tools  -  Parcels for Linux 1.0
Web documents that look similar often use different HTML tags to achieve their layout effect. These tags often make it difficult for a machine to find text or images of interest. PARCELS is a backend system [Java] designed to...
1.14 MB  
Specialized Tools  -  django-test-extensions 0.10
PyUnit provides a basic set of assertions which can get you started with unit testing python, but it???*a*?s always useful to have more. Django also has a few specific requirements and common patterns when it comes to testing. This set of classes...
20.48 KB