Comments (4)
@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
from wagtail-cookiecutter-foundation.
class CustomImage(AbstractImage):
gallery_name = models.ForeignKey(
PhotoAlbum, blank=True,
null=True, related_name='+', on_delete=models.SET_NULL
)
from wagtail-cookiecutter-foundation.
@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
from wagtail-cookiecutter-foundation.
great now will be working on snippets :)
from wagtail-cookiecutter-foundation.
Related Issues (20)
- Add sentry.io Celery and Redis integration
- Documentation on provisioning VPS via Ansible is inaccurate
- TemplateSyntaxError 'wagtailmarkdown' is not a registered tag
- User model crash when django-all-auth is not selected
- 'auth.User' has been swapped for 'users.User'
- Set the COMPRESS_ENABLED
- Make Provision Sticking at Generate CSR
- Command make static_site fails, documentation outdated
- cli.ini file contains invalid challenges
- wagtail updatemodulepaths needs to be added to deployment script
- Ansible deployment scripts need updating
- Support for Docker Containers
- Wagalytics Django ImportError HOT 3
- Photo Gallery should use Collections
- wagtail latest is not compatible with django latest HOT 1
- Sentry implementation refers to the deprecated client
- Redis not installed on Ubuntu release 18.0
- wrong crontab command for certbot renewal HOT 2
- Ansible cron task needs string escaping HOT 1
- make requirements raises incompatibilities HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wagtail-cookiecutter-foundation.