1
+ # encoding: utf-8
1
2
from django .db import models
2
3
3
- class Picture (models .Model ):
4
4
5
- # This is a small demo using just two fields. The slug field is really not
6
- # necessary, but makes the code simpler. ImageField depends on PIL or
7
- # pillow (where Pillow is easily installable in a virtualenv. If you have
8
- # problems installing pillow, use a more generic FileField instead.
5
+ class Picture (models .Model ):
6
+ """This is a small demo using just two fields. The slug field is really not
7
+ necessary, but makes the code simpler. ImageField depends on PIL or
8
+ pillow (where Pillow is easily installable in a virtualenv. If you have
9
+ problems installing pillow, use a more generic FileField instead.
9
10
10
- #file = models.FileField(upload_to="pictures")
11
+ """
11
12
file = models .ImageField (upload_to = "pictures" )
12
13
slug = models .SlugField (max_length = 50 , blank = True )
13
14
@@ -22,7 +23,7 @@ def save(self, *args, **kwargs):
22
23
self .slug = self .file .name
23
24
super (Picture , self ).save (* args , ** kwargs )
24
25
25
- # remove to leave file.
26
26
def delete (self , * args , ** kwargs ):
27
+ """delete -- Remove to leave file."""
27
28
self .file .delete (False )
28
29
super (Picture , self ).delete (* args , ** kwargs )
0 commit comments