attachments Package¶
admin
Module¶
-
class
kawaz.apps.attachments.admin.
MaterialAdmin
(model, admin_site)[ソース]¶ ベースクラス:
django.contrib.admin.options.ModelAdmin
-
list_display
= ('filename', 'slug', 'author_nickname', 'created_at')¶
-
media
¶
-
readonly_fields
= ('slug', 'author', 'ip_address', 'created_at')¶
-
search_fields
= ('author__username', 'author__nickname')¶
-
models
Module¶
-
class
kawaz.apps.attachments.models.
Material
(*args, **kwargs)[ソース]¶ ベースクラス:
django.db.models.base.Model
添付素材用のモデルです
-
exception
DoesNotExist
¶ ベースクラス:
django.core.exceptions.ObjectDoesNotExist
-
exception
Material.
MultipleObjectsReturned
¶ ベースクラス:
django.core.exceptions.MultipleObjectsReturned
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
Material.
content_file
¶ The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assigns a file object on assignment so you can do:
>>> with open('/path/to/hello.world', 'r') as f: ... instance.file = File(f)
-
Material.
created_at
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
Material.
ext
¶ アップされたファイルから拡張子を返します 拡張子は小文字になります。2つ以上拡張子がついている場合は最後の物のみが返却されます。
hoge.mp3 -> mp3 hoge.tar.gz -> gz hoge.WAV -> wav README ->
-
Material.
filename
¶ ファイル名を返します
-
Material.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Material.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Material.
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
Material.
ip_address
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
Material.
is_audio
¶ 音声ファイルかどうかを返します
-
Material.
is_image
¶ 画像ファイルかどうかを返します
-
Material.
is_movie
¶ 動画ファイルかどうかを返します
-
Material.
is_pdf
¶ PDFかどうかを返します
-
Material.
mimetype
¶ Mimetypeを返します
-
Material.
objects
= <django.db.models.manager.Manager object>¶
-
Material.
slug
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception