I was following the [post](https://stackoverflow.com/questions/8364948/additional-field-in-django-form), when I try to solve my solution but it doesn't work for me.

My problem:

I have Django Model object with 4 attributes.

Let's say I have something like this

```
class MyModel(models.Model):
    user = models.ForeignKey('auth.User', on_delete=models.CASCADE)
    first_at = models.IntegerField()
    second_at = models.IntegerField()
    third = models.TextField()

```

Then I have some view in which I would like to present the form with this object. But, I would like the user to only insert 2 of them, `user` and the `third` parameter need to be filled automatically; `user` from current user and `third` from another HTML element (in which row the form was filled).

```
class HomePage(LoginRequiredMixin, generic.CreateView):
    template_name = 'index.html'
    model = MyModel
    fields = ('first', 'second')
    success_url = reverse_lazy('home')

def form_valid(self, form):
    self.object = form.save(commit=False)
    self.object.user = self.request.user
    self.object.save()
    return super().form_valid(form)

```

Then I have in HTML created

```
    <form action="." method="POST">
        {% csrf_token %}
        {{ form.as_p }}
        <input type="hidden" name="third" value="{{ item.third }}" />
        <input type="submit" value="submit" />
    </form>

```

Does anyone know why this is not working? And or how should I make it work? Is there is a better way?

Marko