I have a user form ... I would like to automatically save the author (authenticated user) for the form data. I use ModelForm to create a form.
models.py
class Tracker(models.Model):
client = models.ForeignKey(Clients)
user = models.ForeignKey(User)
description = models.TextField()
...
I also linked the custom profile to the django user table ... also auth works fine ... I can read the user and id ...
forms.py
class TrackerForm(ModelForm):
def __init__(self, *args, **kwargs):
super(TrackerForm, self).__init__(*args, **kwargs)
self.fields.keyOrder = ['date_job_start','date_job_end','description','onsite','billable','client']
class Meta:
model = Tracker
widgets = {
'client': HiddenInput(),
}
, ... ( ). , , ? , , ... ... , auth... - ...
P.S.: initial... ?
!
BR