This is currently what I have done in my admin.py file:
class QuoteBulkUploadAdmin(admin.ModelAdmin):
list_display = ('fields',)
def save_model(self, request, obj, form, change):
contents = obj.fields
new_content = []
for line in contents.split('#'):
#print line
obj.name, obj.quote = line.split('<>')[0],line.split('<>')[1]
#print obj.name + '*' + obj.quote
# if IndexError:
# print 'Last correct line was: ' + obj.name + obj.quote
# else:
#slug = slugify('%s' % (obj.name))
name = obj.name
quote = obj.quote
slug = slugify(name)
s = Quotation(name=name, quote=quote, slug=slug)
It works except for the slugify part (it worked before in the models.py file when using self. not obj.)