Hi,

I would like to know if it is mandatory to create an application and define
my model in the models.py file or if it is possible to define a model
locally in my test method (inside my TestCase class) and interact with it
and saving without creating an application and the models.py. In other
words, is it possible to force the creation of the table inside the test
method?
Example:

class MyTestCase(TestCase):

    def test_something(self):
        class MyModel(models.Model):
            foo = CharField(max_length=10)

        call_something_to_sync_db()

        m = MyModel(foo='something')
        m.save()


Thanks for your attention!

Kind regards,

Gabriel

--
Gabriel de Carvalho Nogueira Reis
Software Developer
+44 7907 823942

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to