-2

In the django docs how do I know what options I can provide certain classes? For example in the model field reference guide what can I pass to instantiate PositiveSmallIntegerField()?

class PositiveSmallIntegerField([**options])

This seems more explicit but it still has that strange **options

class ImageField(upload_to=None[, height_field=None, width_field=None, max_length=100, **options])

Is there somewhere I can find a reference on what these values are for? For example with the ImageField I did not know how it used upload_to until after I tried it. Apparently it creates the directory if it does not exist yet. What about a discussion on MEDIA_URL in relation to this? Where can I find that in the docs?

EDIT: Here is the page I am referring to.

broinjc
  • 2,619
  • 4
  • 28
  • 44
  • likely because it's just a standard python thing. http://stackoverflow.com/questions/2921847/python-once-and-for-all-what-does-the-star-operator-mean-in-python – Paul Collingwood Jun 19 '14 at 16:13
  • So my question was two fold I guess. Why the two ** (duplicate post) and where are the possible options and explanations for options in the docs (valid question?)? – broinjc Jun 19 '14 at 16:16

1 Answers1

0

At the beginning of the page you have the Field options common to all fields, you can use them there.

If you'll read the ImageField docs, you'll see the text:

Inherits all attributes and methods from FileField, but also validates that the uploaded object is a valid image.

Click the FileField link and you'll see the docs of those options.

mkriheli
  • 1,788
  • 10
  • 18
  • So what's the difference between `class AutoField(**options)` and `class BigIntegerField([**options])` ? – broinjc Jun 19 '14 at 17:01
  • Usually square brackets mean those are optional, see for example the signature for FileField: `class FileField(upload_to=None[, max_length=100, **options])` `upload_to` is mandatory, all others are optional. – mkriheli Jun 20 '14 at 08:04
  • Cool. I get it now. So is there anywhere in the documentation that says what those options do? For example the upload_to – broinjc Jun 20 '14 at 16:15
  • Yeah, it's on the same page: https://docs.djangoproject.com/en/1.6/ref/models/fields/#django.db.models.FileField.upload_to – mkriheli Jun 21 '14 at 19:43