0

以下のようなモデル間の継承があります。

class Media(models.Model):          
    title = models.CharField(unique = True, max_length=200)
    descr  = models.TextField(blank=True, null=True)
    excerpt = models.CharField(max_length=250, blank=True, null=True)   
    slug = models.SlugField(editable=False)  
    pub_date = models.DateTimeField('date published', auto_now_add=True)  
    media_tags = TagAutocompleteTagItField(max_tags=False, verbose_name=_('Tags'))    
    position = models.PositiveSmallIntegerField("Position")

    class Meta:
        abstract = True
        ordering = ['position'] 

#register with tagging application    
tagging.register(Media)  

class ModelVideo(Media):
    album = models.ForeignKey(MediaAlbum, null=True, blank=True, limit_choices_to = {'media_type': 'video'})
    file = models.FileField(upload_to=get_path, blank=True, null=True)
    embedCode = models.CharField(unique = True, max_length=250, blank=True, null=True)
    poster = ImageField(upload_to=get_path, blank=True, null=True )
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id') 

ModelVideo のオブジェクトを取得しようとすると -- ModelVideo.objects.all() --- 取得 --- type object 'ModelVideo' has no attribute 'objects' ---- ModelVideo のすべてのオブジェクトを取得するにはどうすればよいですか?

Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Django-1.5-py2.7.egg/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/burakk/BurakWorks/Web/Django_Amber/Development/Eclipse/amber/amber/web/views.py" in home
  15.     videos = ModelVideo.objects.all()

Exception Type: AttributeError at /en/
Exception Value: type object 'ModelVideo' has no attribute 'objects'
4

0 に答える 0