Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gallery Module #42

Closed
chrisdev opened this issue Jun 1, 2015 · 4 comments
Closed

Gallery Module #42

chrisdev opened this issue Jun 1, 2015 · 4 comments

Comments

@chrisdev
Copy link
Owner

chrisdev commented Jun 1, 2015

@Parbhat this was originally part of #23

Parbhat added a commit to Parbhat/wagtail-cookiecutter-foundation that referenced this issue Jun 24, 2015
chrisdev added a commit that referenced this issue Jun 24, 2015
photo_gallery start- issue #42
Parbhat added a commit to Parbhat/wagtail-cookiecutter-foundation that referenced this issue Jun 26, 2015
chrisdev added a commit that referenced this issue Jun 29, 2015
photo_gallery views, templates, urls- issue #42
@chrisdev
Copy link
Owner Author

@Parbhat Right now the photo gallery is just a text field it should be a snippet

   @register_snippet
   class PhotoAlbum(models.Model):
        name = models.CharField(max_length=255, blank= True, null=True)
        feed_image = models.ForeignKey(
                                Image,
                                help_text="An optional image to represent the gallery",
                               null=True,
                               blank=True,
                                on_delete=models.SET_NULL,
                               related_name='+') 

    panels = [
        FieldPanel('name')
        ImagePanel('feed_image`)

    ]

    def __unicode__(self):
        return self.name

@chrisdev
Copy link
Owner Author

    class CustomImage(AbstractImage):

            gallery_name = models.ForeignKey(
                  PhotoAlbum, blank=True,
                  null=True, related_name='+', on_delete=models.SET_NULL
           )

@chrisdev
Copy link
Owner Author

@Parbhat wagtail believes that the model should do all the work and the view should be as generic as possible
So the wagtail way on handling this custom image would be to build a GalleryIndex model.

      GalleryIndexPage(Page):
           intro = RichTextField(blank=True)

           @property
            def photo_albums(self):
                  albums = PhotoAlbums.objects.all()
                  return photo_albums

            def get_context(self, request):
                  photo_albums = self.photo_albums
                  context = Super(GalleryIndexPage, self).get_context(request)
                  context['photo_albums']  = photo_albums
                  return context

Of course you also have to Build a Page to handle when the user selects a Gallery for viewing
Here you get_context should filter for all the Images that match the gallery selected.

This suggest that you Gallery Snippet will require a slug
http:/localhost:8000/gallery?party-taylor-swift
The user will fill our the info on the Gallery independent of uploading the actually photo

@Parbhat
Copy link
Collaborator

Parbhat commented Jun 29, 2015

great now will be working on snippets :)

Parbhat added a commit to Parbhat/wagtail-cookiecutter-foundation that referenced this issue Jul 1, 2015
chrisdev added a commit that referenced this issue Jul 2, 2015
Restored to Default Image model - Issue #42, #90
Parbhat added a commit to Parbhat/wagtail-cookiecutter-foundation that referenced this issue Jul 7, 2015
Parbhat added a commit to Parbhat/wagtail-cookiecutter-foundation that referenced this issue Jul 7, 2015
chrisdev added a commit that referenced this issue Jul 8, 2015
Gallery module with tags - issue #42
@chrisdev chrisdev closed this as completed Jul 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants