##// END OF EJS Templates
Allow choosing only active threads source admin
neko259 -
r1971:68b3f521 default
parent child Browse files
Show More
@@ -5,7 +5,7 b' from django.contrib import admin'
5 from django.utils.translation import ugettext_lazy as _
5 from django.utils.translation import ugettext_lazy as _
6 from django.core.urlresolvers import reverse
6 from django.core.urlresolvers import reverse
7 from boards.models import Post, Tag, Ban, Thread, Banner, Attachment, \
7 from boards.models import Post, Tag, Ban, Thread, Banner, Attachment, \
8 KeyPair, GlobalId, TagAlias
8 KeyPair, GlobalId, TagAlias, STATUS_ACTIVE
9 from boards.models.source import ThreadSource
9 from boards.models.source import ThreadSource
10
10
11
11
@@ -186,3 +186,8 b' class GlobalIdAdmin(admin.ModelAdmin):'
186 class ThreadSourceAdmin(admin.ModelAdmin):
186 class ThreadSourceAdmin(admin.ModelAdmin):
187 search_fields = ('name', 'source')
187 search_fields = ('name', 'source')
188
188
189 def formfield_for_foreignkey(self, db_field, request, **kwargs):
190 if db_field.name == 'thread':
191 kwargs['queryset'] = Thread.objects.filter(status=STATUS_ACTIVE)
192 return super().formfield_for_foreignkey(db_field, request, **kwargs)
193
General Comments 0
You need to be logged in to leave comments. Login now