Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 805979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:10:20+00:00 2026-05-15T00:10:20+00:00

I have a Django site in which the site admin inputs their Twitter Username/Password

  • 0

I have a Django site in which the site admin inputs their Twitter Username/Password in order to use the Twitter API. The Model is set up like this:

class TwitterUser(models.Model):
screen_name = models.CharField(max_length=100)
password = models.CharField(max_length=255)
def __unicode__(self):
    return self.screen_name

I need the Admin site to display the password field as a password input, but can’t seem to figure out how to do it. I have tried using a ModelAdmin class, a ModelAdmin with a ModelForm, but can’t seem to figure out how to make django display that form as a password input…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:10:21+00:00Added an answer on May 15, 2026 at 12:10 am

    From the docs, you can build your own form, something like this:

    from django.forms import ModelForm, PasswordInput
    
    class TwitterUserForm(ModelForm):
        class Meta:
            model = TwitterUser
            widgets = {
                'password': PasswordInput(),
            }
    

    Or you can do it like this:

    from django.forms import ModelForm, PasswordInput
    
    class TwitterUserForm(ModelForm):
        password = forms.CharField(widget=PasswordInput())
        class Meta:
            model = TwitterUser
    

    I’ve no idea which one is better – I slightly prefer the first one, since it means you’ll still get any help_text and verbose_name from your model.

    Regardless of which of those two approaches you take, you can then make the admin use your form like this (in your app’s admin.py):

    from django.contrib import admin
    
    class TwitterUserAdmin(admin.ModelAdmin):
        form = TwitterUserForm
    
    admin.site.register(TwitterUser, TwitterUserAdmin)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have django model which consist of parent child relationship filed I want to
I have a Django application which includes a custom model field (and accompanying form
I have a Django website in which I want site administrators to be able
I have flatpage attached to multiple sites. Its admin preview chooses arbitrary site, which
So I've set up my django site with the following admin.py: import models from
1) When I add new item in django admin site, all checkboxes are set
I have a django site using the basic django registration framework. I have my
I currently have a django site, and it's kind of slow, so I want
I have a django server that serves the basic site with user, auth etc
I have a similar question than django cross-site reverse . But i think I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.