#26825: MultipleObjectMixin and DB don't work together
-------------------------------+--------------------
     Reporter:  gilmrjc        |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.9
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 I have the following CBV for my home page:


 {{{
 class HomeView(ListView):
     """Home view."""
     template_name = 'index.html'
     model = Post
     context_object_name = 'posts'
     posts_per_page, _ =
 Option.objects.get_or_create(name='posts_per_page',
                                                      defaults={'value':
 '5'}
                                                      )
     try:
         paginate_by = int(posts_per_page.value)
     except ValueError:
         paginate_by = 5

 }}}

 But Django fails with the following error:

 ''OperationalError: no such table: djangoapp_option
 ''

 I can't do database migrations so this is a circular problem: Django
 complains because there isn't a database -> Database can't be migrated
 because Django complains -> Django complains . . .
 The problem seems to be that Django "compiles" CVB before doing anything,
 before running commands. Is this  bug or is a feature? Should I use
 function defined views for views that use database configurations?

--
Ticket URL: <https://code.djangoproject.com/ticket/26825>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.7962d37d950bc55fff531d8fcf45f37d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to