Commits

Anonymous committed 3e7c2af

Minor formatting changes, updated ForeignKey field to Django 1.0 style

  • Participants
  • Parent commits b23bd91

Comments (0)

Files changed (3)

licenses/admin.py

-from django.contrib import admin
+from django.contrib.admin import ModelAdmin, site, HORIZONTAL
 from django.utils.translation import ugettext_lazy as _
 from licenses.models import Organization, License
 
 
-class OrganizationAdmin(admin.ModelAdmin):
+class OrganizationAdmin(ModelAdmin):
 	prepopulated_fields = {'slug': ('name', )}
 	list_display = ('name', 'abbreviation', 'website')
 	search_fields = ('name', 'slug', 'abbreviation', 'website', 'description')
+site.register(Organization, OrganizationAdmin)
 
 
-class LicenseAdmin(admin.ModelAdmin):
+class LicenseAdmin(ModelAdmin):
 	prepopulated_fields = {'slug': ('name', )}
 	list_display = ('name', 'abbreviation', 'organization', 'is_active')
 	list_filter = ('is_active', )
 	search_fields = ('name', 'slug', 'abbreviation', 'url', 'description')
-	radio_fields = {'organization': admin.HORIZONTAL}
+	radio_fields = {'organization': HORIZONTAL}
 	fieldsets = (
 		(None, {
 			'fields': ('name', 'slug', 'url', 'abbreviation', 'organization'),
 			'fields': ('logo', 'description', 'is_active'),
 		}),
 	)
-
-
-admin.site.register(Organization, OrganizationAdmin)
-admin.site.register(License, LicenseAdmin)
+site.register(License, LicenseAdmin)

licenses/fields.py

-from django.db.models import *
+from django.db.models import ForeignKey
 from django.utils.translation import ugettext_lazy as _
-from licenses.models import License
 
 
 class LicenseField(ForeignKey):
 		if kwargs.pop('required', None) == False:
 			kwargs['blank'] = True
 			kwargs['null'] = True
-		ForeignKey.__init__(self, License, **kwargs)
+		ForeignKey.__init__(self, 'licenses.License', **kwargs)

licenses/models.py

 	logo = URLField(_('logo'), verify_exists = True, blank = True,
 		help_text = _('A logo/icon/badge that is clearly associated with the license.'))
 	description = TextField(_('description'), blank = True)
-	is_active = BooleanField(_('active'), default=True,
+	is_active = BooleanField(_('active'), default = True,
 		help_text = _('Disable, if license shouldn\'t be available to users any more.'))
 
 	def __unicode__(self):