BuildableModel doesn't work
xOceanFirex opened this issue · 1 comments
xOceanFirex commented
Hi,
Could you tell me what is wrong with my code? Unfortunately that what i can find on readthedocs.io doesn't working at all. On this page it is described that i should use Celery but when i use lastet version this isn't mentioned.
blog/models.py
class Album(BuildableModel):
detail_views = ('blog.views.AlbumDetails', 'blog.views.HomePageBake')
artist = models.ForeignKey(Musician, on_delete=models.CASCADE)
name = models.CharField(max_length=100)
release_date = models.DateField()
num_stars = models.IntegerField()
cover_src = models.CharField(max_length=255)
is_published = models.BooleanField(default=False)
def __str__(self):
return self.name
def get_absolute_url(self):
return '/blog/album/%s/' % self.id
blog/views.py
class HomePageBake(BuildableListView):
queryset = Album.objects.all()
build_path = 'blog/index.html'
template_name = 'blog/index.html'
def get_context_data(self, **kwargs):
return {'object_list': self.queryset}
class AlbumDetails(BuildableDetailView, DetailView):
model = Album
build_path = 'blog/album.html'
template_name = 'blog/album.html'
context_object_name = 'album'
Thanks for your help and please update your docs.
palewire commented
What bug are you seeing?