Reputation: 120
I tried searching for suggestions on how to solve my problem, but wasn't finding exactly what I was looking for. So, sorry if this has been covered before.
I need to create a new class within existing models.py file to add a new table to an existing database, add code to the existing views.py file to render to a form, and use the existing view.html file to be able to display a dropdown menu that shows all the values in the model and allows the user to select one of those values.
So, I created the table within models.py and need to figure out where to go from here. It looks similar to this:
models.py
class PhoneTable(models.Model):
phone_number = PhoneNumberField(primary_key=True, max_length=20)
call_type = models.CharField(choices=CALL_TYPES, max_length=10)
profile = models.CharField(null=True, blank=True, max_length=4)
extension = models.ForeignKey(Profile, related_name='extension', max_length=4)
Any advice or direction would be greatly appreciated. If I missed information that would be helpful that I should provide please let me know.
Thank you.
Upvotes: 1
Views: 3359
Reputation: 7631
If you don't know how to do these things read Django app tutorial
Upvotes: 1