def create(request): photograph = hmod.Photograph() photograph.dateTaken = None photograph.placeTaken = '' photograph.image = '' photograph.photographer_id = '' ''' OTHER FIELDS ''' photograph.save() return HttpResponseRedirect('/homepage/photograph.edit/{}'.format(photograph.id))
}, { 'date_taken': '2004-4-4', 'place_taken': 'Mexico', 'description': 'photo4', 'image': 'photo4.jpg' }, { 'date_taken': '2005-5-5', 'place_taken': 'Germany', 'description': 'photo5', 'image': 'photo5.jpg' }, ]: d = hmod.Photograph() for k, v in data.items(): setattr(d, k, v) d.save() # Create Super Group, Permissions, and User permission = Permission() permission.codename = 'super' permission.content_type = ContentType.objects.get(id=7) permission.name = 'Super Privileges' permission.save() group = Group() group.name = "super" group.save() group.permissions.add(permission)
user4.first_name = "Anakin" user4.last_name = "Skywalker" user4.username = "******" user4.email = "*****@*****.**" user4.set_password('padme') user4.save() ## Products and Photographs: p1 = hmod.Product() p1.name = "Minted Coin" p1.description = "Metal coin replica of olonial money. Has Colonial Heritage Foundation logo on it." p1.category = "Mass Produced" p1.current_price = 3.99 p1.save() photo = hmod.Photograph() photo.object_pictured = p1 photo.image = "https://www.regalassets.com/images/indian-head-coins-F.jpg" photo.save() p1 = hmod.Product() p1.name = "Photo of George Washington" p1.description = "One of our founding fathers." p1.category = "Mass Produced" p1.current_price = 3.99 p1.save() photo = hmod.Photograph() photo.object_pictured = p1 photo.image = "http://www.nndb.com/people/107/000024035/1pres.jpg" photo.save()