Thanks for the time for helping me out.
I'm pretty new to django and python.
So I have a model, that I'm trying to pull some data from another model to build out a landing page of sorts. I was trying to make it completely customizatable in the admin but I discovered for what I wanted do I was going to have to involve AJAX. I've scrapped that, and resorted to mostly removing the admin customization because this is really just for my own personal site.
So to boil down the overall goal:
There are many "gallery" pages I want to pull the first image from
Each gallery on my "landing" page will be a single image from each gallery, title, and url to the gallery.
This is part of my model: class AggeragateImages(Orderable):
aggeragate = models.ForeignKey("AggeragatePage", related_name="thumbnails")
gallery_titles = models.CharField(editable=False, max_length=1000)
gallery_slug = models.CharField(editable=False, max_length=1000)
def getGallery():
"""
Returns PK of all Gallery content type pages
"""
galleryPK = []
for e in Page.objects.filter(content_model='gallery'):
galleryPK.append(e.pk)
return galleryPK
galleryPK = getGallery()
for e in galleryPK:
gallery_titles = Gallery.objects.get(pk=e).titles
gallery_titles.save()
gallery_slug = Gallery.objects.get(pk=e).slug
gallery_slug.save()
def __unicode__(self):
return self.name
However why I run a syncdb I get: AttributeError: 'unicode' object has no attribute 'save'
I've also trying doing this through the interactive shell to, and I get the same error when calling 'save()'
Am I really far off base? I really appreciate your help.