# Django admin tips and tricks - Part 1

Here you go:

### How to m**ake a column editable in the Django admin change list view in a Model?**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670777694939/kMBhwactj.png align="center")

We can make a column editable in the Django admin using an attribute `list_editable` as given in the below example. This can be helpful if you want to bulk update rows quickly, without opening the details of rows one by one in the change list view.

```python
# app_name/admin.py

@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = ("username", "is_active", "email")
    list_editable = ("is_active",)  # `is_active` will be editable in all the rows
```

### How to a**dd custom JavaScript/CSS files in Django model admin form in a Model?**

If you want to run some `JavaScript`/`CSS` file in a Django model admin form, here is how you do it. The `JavaScript`/`CSS` file should be in the static files folder.

```python
# app_name/admin.py

@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    ...
    class Media:
        css = {"all": ("pretty.css",)} # Here "all" denotes the html media attribute
        js = (
            "animation.js",
            "action.js",
        )
```

### How to unregister a native or third party Model (`Group` etc.) in Django admin?

Sometimes you do not want to show Django's `Group` model or a model from a third party Django library which you have installed. Here is how you can unregister/hide it from the Django admin panel.

```python
# Unregister the django Group model
from django.contrib.auth.models import Group
admin.site.unregister(Group)

# Unregiser a third party model
from thirdparty.models import ThirdPartyModel
admin.site.unregister(ThirdPartyModel)
```

### How to reset the Django admin password through the command line?

We are humans, If you have forgotten the password of the Django admin panel, you can reset it by running this command.

```bash
python manage.py changepassword <username>
```

Note: `username` is the admin’s username.

### How to show extra columns in the Django admin change list view in a Model?

When you register a model in the Django admin, it will by default show a single column having the text of `__str__` the method defined in the model class, let's show some more fields of a Django model using the `list_display` class attribute.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1670777701717/-zotMP3mH.png align="center")

```python
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = (
        "username",
        "email",
        "first_name",
        "last_name",
        "is_active",
        "is_staff",
        "is_superuser",
    )
```

This is it for this blog, let's meet in the next one.

***Any thoughts? Write it down in the comments.***

> For more such crispy blogs daily, follow Dev.Junction, subscribe to our newsletter and get notified.

## **Social Links**

*   [**LinkedIn**](https://www.linkedin.com/in/mnamegaurav/)**:** [**https://www.linkedin.com/in/mnamegaurav/**](https://www.linkedin.com/in/mnamegaurav/)
    
*   [**YouTube**](https://www.youtube.com/devjunction)**:** [**https://www.youtube.com/devjunction**](https://www.youtube.com/devjunction)
    
*   [**Website**](https://gaurav.devjunction.in/)**:** [**https://gaurav.devjunction.in/**](https://gaurav.devjunction.in/)
    
*   [**GitHub**](https://github.com/mnamegaurav)**:** [**https://github.com/mnamegaurav**](https://github.com/mnamegaurav)
    
*   [**Instagram**](https://www.instagram.com/mnamegaurav/)**:** [**https://www.instagram.com/mnamegaurav/**](https://www.instagram.com/mnamegaurav/)
    
*   [**Twitter**](https://twitter.com/mnamegaurav)**:** [**https://twitter.com/mnamegaurav**](https://twitter.com/mnamegaurav)
