Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate and insert in django
    primarykey
    data
    text
    <p>I know there is a lot question and to many answer I try to get my answer to my problem but I can't find it or maybe is there but I can't understand it.</p> <p>I have this <code>models.py</code></p> <pre><code>class Clientspin(models.Model): id_client = models.AutoField(primary_key=True) login = models.CharField(max_length=20L, unique=True) account_state = models.DecimalField(max_digits=14, decimal_places=4) class Meta: db_table = 'clientspin' def __unicode__(self): return self.login, self.id_client </code></pre> <p>I have a simple <code>forms.py</code></p> <pre><code>from django import forms class ClientspinForm(forms.Form): login = forms.CharField(widget=forms.TextInput()) money = forms.CharField(widget=forms.TextInput()) def clean(self): return self.cleaned_data </code></pre> <p>This is my <code>views.py</code></p> <pre><code>from django.shortcuts import render_to_response from django.template import RequestContext from ceropin.forms import ClientspinForm from ceropin.models import Clientspin def index_register(request): if request.method == "POST": form = ClientspinForm(request.POST) info = "inicializando" if form.is_valid(): login = form.cleaned_data['login'] dinero = form.cleaned_data['dinero'] client = Clientspin() client.login = login client.account_state = dinero client.password = ('crp'+login) client.save() info = "Se guardo satisfactoriamente" else: info = "Datos incorrectos" form = ClientspinForm() ctx = {'form': form, 'informacion': info} else: form = ClientspinForm() ctx = {'form': form} return render_to_response('registro/registro.html',ctx,context_instance=RequestContext(request)) </code></pre> <p>How to update a money field for the record that have the same login?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload