DEV Community

Pavel6625
Pavel6625

Posted on

How to fetch a field class from a specific form in Django?

I'm trying to write a test for the username field and I want to use SimpleTestCase.assertFieldOutput(). The problem is that I cannot get the fieldclass from the field of my form:

import django
from django.test import TestCase
    class UserRegistrationTest(TestCase):
    """Tests for the user registration page."""

    def test_username_field(self):
        data =

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay