Login

Snippets by dhke

Snippet List

geodjango Metric Buffer

GEOSGeometry.buffer() accepts a distance argument which is in the unit of the coordinate reference system of the geometry. It is often necessary, however, to specify the buffer size in a more down-to-earth coordinate system, for example meters. with_metric_buffer(geom, buf_size) implements this functionality.

Read More

Another Multiform

MultiForm and MultiModelForm Based on a PrefixDict class I wrote and thus very lean. Lacks a little documentation, though class MyMultiForm(ModelMultiForm): class Meta: localized_fields = '__all__' form_classes = OrderedDict(( ('form1', Form1), ('form2', Form2), )) Subfields are named `form-name` `prefix_sep` `subfield-name`. `prefix_sep` defaults to `-`. For access in templates, use `form.varfields`, which uses `var_prefix_sep` (default: `_`), instead. multiform.varfields()['form1_field1']

  • models
  • forms
  • multiform
Read More

dhke has posted 4 snippets.