path.py FilePathField

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from path import path
from django.db import models

class PathFilePathField(models.FilePathField):
    """ 
    A FilePathField that deals with path.py objects.
    """
    __metaclass__ = models.SubfieldBase
    
    def get_prep_value(self, value):
        return str(value)
    
    def to_python(self, value):
        return path(value)

More like this

  1. . by jeremydw 3 years, 8 months ago
  2. madslug by catellar 2 years, 8 months ago
  3. watermark by dingdongquan 3 years, 3 months ago
  4. convert youtube url for iframe, js api by ivanff 1 year, 1 month ago
  5. default url routing and shortcut by vicalloy 4 years, 10 months ago

Comments

(Forgotten your password?)