models.py
from django.db import models
class editupdaterecord(models.Model):
id = models.IntegerField(primary_key=1)
Itemname = models.CharField(max_length=100)
quantity = models.IntegerField(blank=True, null=True, default=0)
basicamount = models.IntegerField(blank=True, null=True, default=0)
rate = models.IntegerField(blank=True, null=True, default=20)
userquantity = models.IntegerField(blank=True, null=True, default=0)
amount2 = models.IntegerField(blank=True, null=True, default=0)
class Meta:
db_table ='bill3'
On Tue, Jun 22, 2021 at 3:57 PM mayank sandikar <
[email protected]> wrote:
> view.py
> def displaydata(request):
> results = editupdaterecord.objects.all()
>
>
> if request.method=='POST':
> if request.POST.get('userquantity') :
> quantity = request.POST.get('userquantity')
> a = editupdaterecord.objects.all()
> print(a)
> # if results in a < quantity:
> saverecord = editupdaterecord(userquantity = quantity)
> saverecord.save()
>
> return render(request , 'index.html' ,{"editupdaterecord":results})
>
>
> On Tue, Jun 22, 2021 at 3:55 PM mayank sandikar <
> [email protected]> wrote:
>
>> my index.html is
>>
>> <html>
>> <head>
>> <title> Edit </title>
>> <style>
>> .button {
>> border: none;
>> color: black;
>> padding: 15px 32px;
>> text-align: center;
>> text-decoration: none;
>> display: inline-block;
>> font-size: 16px;
>> margin: 4px 2px;
>> cursor: pointer;
>>
>> }
>>
>> .button2 {background-color: #008CBA;}
>>
>> </style>
>>
>>
>> </head>
>> <body>
>>
>>
>> <center>
>> <h1> </h1>
>> </center>
>> <table border=1>
>> <tr>
>> <th>ID</th>
>> <th>Itemname</th>
>> <th>Quantity</th>
>>
>> <th>rate</th>
>> <th>amount</th>
>> </tr>
>>
>> {% for displayemp in editupdaterecord%}
>> <tr>
>> <td>{{displayemp.id}}</td>
>> <td>{{displayemp.Itemname}}</td>
>> <td>{{displayemp.quantity}} </td>
>> <td>{{displayemp.rate}} </td>
>> <td>{{displayemp.basicamount}} </td>
>>
>> </tr>
>> {% endfor %}
>> </table><br><br><br>
>>
>> <form method="POST" action="/">
>> {% csrf_token %}
>>
>> <table border=1>
>> <tr>
>> <th>ID</th>
>> <th>Itemname</th>
>> <th>Quantity</th>
>>
>> <th>userquantity</th>
>> <th>amount</th>
>> </tr>
>>
>> {% for displayemp in editupdaterecord%}
>> <tr>
>> <td>{{displayemp.id}}</td>
>> <td>{{displayemp.Itemname}}</td>
>> <td>{{displayemp.quantity}} </td>
>>
>>
>> <form method="POST" >
>>
>> {% csrf_token %}
>> <td><input type="text" name="userquantity" value="
>> {{editupdaterecord.userquantity}}" ></td>
>> <td>{{displayemp.amount2}} </td>
>> </tr>
>> {% endfor %}
>>
>>
>> </table>
>> <br><br><br>
>>
>> <button class="button .button2">Add</button>
>>
>>
>> </form>
>> </body>
>> </html>
>>
>>
>>
>>
>> On Tue, Jun 22, 2021 at 3:49 PM mayank sandikar <
>> [email protected]> wrote:
>>
>>> Hello sir,
>>> I'm trying to insert the data in the table. For example in database
>>> Itemname quantity price user-quantity amount
>>> pen 20 5 0 0
>>> book 20 10 0 0
>>>
>>> in my database I'm getting this result
>>> pen 20 5 0 0
>>> book 20 10 0 0
>>> 2 0
>>>
>>> I want to take the itemname, quantity, and price in the last row as well.
>>> In my html front view (screenshot 50) only the last text box is active
>>> in the user quantity column.
>>>
>>> please help me.
>>> thank you
>>>
>>>
>>>
>>> On Tue, Jun 22, 2021 at 2:58 PM DJANGO DEVELOPER <
>>> [email protected]> wrote:
>>>
>>>> according to your code, you're trying to update the product record.
>>>> right?
>>>> If so, then you're doing things the right way.
>>>>
>>>> On Tue, Jun 22, 2021 at 9:50 AM mayank sandikar <
>>>> [email protected]> wrote:
>>>>
>>>>> hello , sir your mobile no. is not on whatsapp. please assist me
>>>>> with this
>>>>>
>>>>> On Mon, Jun 21, 2021 at 10:09 PM Onyemordi Daniel <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hello, have your problem been solved if no kindly contact me on
>>>>>> WhatsApp 08167997730 to assist you better.
>>>>>>
>>>>>> On Mon, 21 Jun 2021, 07:07 mayank sandikar, <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> https://github.com/Mayanksandikar/3-database
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Jun 20, 2021 at 4:08 PM Luciano Martins <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Post your code on github and provide the link here
>>>>>>>>
>>>>>>>> Em sábado, 19 de junho de 2021 às 22:00:24 UTC-3,
>>>>>>>> [email protected] escreveu:
>>>>>>>>
>>>>>>>>> I have a few errors in my program.
>>>>>>>>> 1. HTML
>>>>>>>>> In my front view only my last text box is working and all the
>>>>>>>>> upper text boxes are unassessable.
>>>>>>>>> 2. Database
>>>>>>>>> I am getting only the user quantity in the database but not
>>>>>>>>> getting the itemname, price and total amount in it.
>>>>>>>>>
>>>>>>>>> I don't know where it is going wrong, I've been stuck here for the
>>>>>>>>> last 4 days. I'm a beginner in django and python. Which logic is used
>>>>>>>>> for
>>>>>>>>> this program?
>>>>>>>>> Please, please help me.
>>>>>>>>>
>>>>>>>>> PFA
>>>>>>>>>
>>>>>>>> --
>>>>>>>> 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 [email protected].
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/django-users/9feed719-8ab5-4523-80a1-ad062fe1999en%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/django-users/9feed719-8ab5-4523-80a1-ad062fe1999en%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>>> 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 [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/django-users/CAOS5mPyWASHhqgx947GwftVcmMq9PD9D6PLyHA5Kgv9DqY5GHQ%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/django-users/CAOS5mPyWASHhqgx947GwftVcmMq9PD9D6PLyHA5Kgv9DqY5GHQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> 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 [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/django-users/CA%2B-W-o66GbpFyKAbGCmeawjndTBUk%3DwqJaV%2B5Nf27siQmnA8Hw%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/django-users/CA%2B-W-o66GbpFyKAbGCmeawjndTBUk%3DwqJaV%2B5Nf27siQmnA8Hw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/CAOS5mPxJXuV8vBvtFMYGkiiGqm5%3DZxhyuFBaxF_Q2COhZYWnBw%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/django-users/CAOS5mPxJXuV8vBvtFMYGkiiGqm5%3DZxhyuFBaxF_Q2COhZYWnBw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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 [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CAKPY9pmTCn0i63Yb3VLfjpuK6aqyvkg4o2TGKv_rzGwOLiwh3A%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CAKPY9pmTCn0i63Yb3VLfjpuK6aqyvkg4o2TGKv_rzGwOLiwh3A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CAOS5mPxEN6jikZJtSVESZm4qO9XJtKq7%2Bo42Ozg7L95sudx-RA%40mail.gmail.com.