我已经研究了一个星期,我想做的是我的视频播放器的ID为“ stream”,而我在db中的列名也为“ stream”, vid播放器将根据db表中的值自动播放。这是抽搐API。这是播放器的代码:
from .models import title, album, Asset_type
class AlbumForm(forms.ModelForm):
class Meta:
model = Product
fields = ('album_name', 'music_track', )
def __init__(self, user, *args, **kwargs):
super(AlbumForm, self).__init__(*args, **kwargs)
type = Asset_type.objects.get(type='track')
self.fields['music_track'].queryset = Title.objects.filter(type=type)
class MyModelAdmin(admin.ModelAdmin):
form = AlbumForm
admin.site.register(album, MyModelAdmin)
这是针对JS的:
Select * from
(
select a.* from tbl a join tbl b
on a.ID = b.ID
where
a.Type = 'Name' and b.Type = 'Text'
) tb
where tb.Type = 'Name'