Ryan Herriman avatar Ryan Herriman committed 46207dd

Minor improvements to attachments, still not working locally.

Comments (0)

Files changed (2)

 from django.contrib.sites.models import Site
 from leaves.models import *
 
+class AttachmentInline (admin.TabularInline):
+	model = Attachment
+	extra = 1
 class MetaInline (admin.TabularInline):
 	model = LeafMeta
 	extra = 1
 	date_hierarchy = 'pub_date'
 	prepopulated_fields = {'slug': ('title',)}
 	search_fields = ('title', 'summary', 'content')
-	inlines = (MetaInline,)
+	inlines = (AttachmentInline, MetaInline,)
 
 	def formfield_for_dbfield(self, db_field, **kwargs):
 		if db_field.name == 'author_name' and 'request' in kwargs:
 	title = models.CharField(max_length=200)
 	md5_checksum = models.CharField(max_length=32, editable=False)
 	num_downloads = models.PositiveIntegerField(default=0, editable=False)
+	rank = models.IntegerField(default=0, help_text=_('Used for ordering attachments.'))
 
 	def __unicode__(self):
 		return self.filename
 
 	def save(self, **kwargs):
 		self.md5_checksum = attachment_checksum(self.attachment)
-		super(Leaf, self).save(**kwargs)
+		super(Attachment, self).save(**kwargs)
 
 	@models.permalink
 	def get_absolute_url(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.