Ticket #10573: tests.diff

File tests.diff, 1.7 KB (added by rduffield, 6 years ago)
  • tests/regressiontests/admin_views/tests.py

     
    199199        response = self.client.get('/test_admin/%s/my_view/' % self.urlbit)
    200200        self.assert_(response.content == "Django is a magical pony!", response.content)
    201201
     202class JavaScriptAdminTest(AdminViewBasicTest):
     203
     204    def testAdminSplitDateTimeFocus(self):
     205        request = self.client.get('/test_admin/%s/admin_views/reservation/add/' % self.urlbit)
     206        self.failUnless(
     207            '<script type="text/javascript">document.getElementById("id_start_date_0").focus();</script>' in request.content,
     208            "Date field did not correctly receive focus."
     209        )
     210
    202211def get_perm(Model, perm):
    203212    """Return the permission object, for the Model"""
    204213    ct = ContentType.objects.get_for_model(Model)
  • tests/regressiontests/admin_views/models.py

     
    199199        BarAccountAdmin
    200200    )
    201201
     202class Reservation(models.Model):
     203    start_date = models.DateTimeField()
    202204
    203205admin.site.register(Article, ArticleAdmin)
    204206admin.site.register(CustomArticle, CustomArticleAdmin)
     
    208210admin.site.register(Thing, ThingAdmin)
    209211admin.site.register(Person, PersonAdmin)
    210212admin.site.register(Persona, PersonaAdmin)
     213admin.site.register(Reservation)
    211214
    212215# We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2.
    213216# That way we cover all four cases:
Back to Top