MetaOptions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
### Example:
###
### from django.db import models
### from django.contrib.options import MetaOptions
###
### class ExampleNamedObject(models.Model):
###     class CSV(MetaOptions):
###             separator = ';'
###             format = (
###                     ('name', 'Name'),
###                     ('describe', 'Description'),
###             )
###     name = models.CharField(maxlength=32)
###     def describe(self):
###             return str(self)
###
### from django.contrib.options.csv import csv
### for row in csv(ExampleNamedObject):
###     print row

More like this

  1. Generate a CSV file for a model by mssnlayam 7 years ago
  2. Django Admin CSV Export Mixin by Ceran 1 year ago
  3. Non model specific CSV export of database content by sethtrain 6 years, 2 months ago
  4. export to csv, import from csv by peiwei 10 months, 1 week ago
  5. Admin action for a generic "CSV Export" (fix for unicode) by __alexander__ 4 months, 3 weeks ago

Comments

derivin (on July 13, 2007):

Please never install anything into the django tree like that. It means most of us can never use it.

Is there any reason why this is not just a third party app like everyone else writes?

#

(Forgotten your password?)