Add fields Django admin

17 views
Skip to first unread message

Alexandr Bulgakov

unread,
Jan 22, 2019, 10:44:56 PM1/22/19
to Django users
Hello All!

I need help(


There is a class, it has 2 fields. I need to add an add button to display these fields again when required.
models.py:

class IPhone(models.Model):
iPhone_name = models.CharField(max_length=50)
iPhone_image = models.ImageField(upload_to='models', blank=True)

price_name = models.CharField(max_length=150, default=' ')
price_cell = models.IntegerField(default=0)

def __str__(self):
        return '{}'.format(self.iPhone_name)

django_add.png

 

Shashank Singh

unread,
Jan 22, 2019, 11:17:20 PM1/22/19
to django...@googlegroups.com
Take those fields out as a foreign key and use that foreign key as inline in this admin.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c79b62de-fc5c-4acd-917c-8068b3e2e370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian Hetmann

unread,
Jan 23, 2019, 12:17:26 AM1/23/19
to django...@googlegroups.com
Hi,

If I understand you right, you need to import your model (iPhone) in the admin.py file of your WebApp. And then register „admin.site.register(iPhone)“ (without the quotes).

Good luck,
Christian

<django_add.png>

 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c79b62de-fc5c-4acd-917c-8068b3e2e370%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<django_add.png>

RETAIL CYBER

unread,
Jan 23, 2019, 6:56:59 AM1/23/19
to django...@googlegroups.com
has anyone ever install the django on a live web hosting service? if so when it comes to using db is the db virtual just like djangoEnv or do i use the mysql thats on my host? i have a vsp??  

Reply all
Reply to author
Forward
0 new messages