Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
How can one replicate Django admins add new row functionality?

I am looking for a way to implement the "add new model_name" functionality from Django admin to normal form in templates, i.e; outside of Django admin, how could I use the same functionality.

enter image description here

How could I achieve it?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The first Step is to create Business Module inside models.py

class Business(models.Model):
        name = models.CharField(max_length=200, db_index=True)
        slug = models.SlugField(max_length=200, db_index=True, unique=True)

        class Meta:
            ordering = ('name',)
            verbose_name = 'business'
            verbose_name_plural = 'business'

        def __str__(self):
            return self.name

Then use python manage.py migrate to migrate module inside your database.

Now open admin.py file and register this Module,

from .models import Business

# Register your models here.
class BusinessAdmin(admin.ModelAdmin):
    list_display = ['name', 'slug']
    prepopulated_fields = {'slug': ('name',)}
admin.site.register(Business,BusinessAdmin)

Now check your Django admin panel. It will show you New Business Module there with Add, remove feature using Form.

I hope this will helpful for you.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!