def add_to_db(self, entry): new_map = Map() new_map.base_folder = '/static/maps/' + entry[0][:4] + '/' new_map.title = entry[1] new_map.author = entry[2] new_map.published = entry[3] new_map.start_year = entry[4] new_map.end_year = entry[5] new_map.save() self.stdout.write("Created %s\n" % (new_map.title))
def test_map_clean(self): map_object = Map() map_object.start_year = 2013 map_object.end_year = 2012 with self.assertRaises(ValidationError): map_object.clean()