Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:19:08+00:00 2026-06-10T06:19:08+00:00

I have a model.py: class usercommand(models.Model): user = models.ForeignKey(User, blank=False) a_field = models.PositiveIntegerField(null=True, blank=True)

  • 0

I have a model.py:

class usercommand(models.Model):
user = models.ForeignKey(User, blank=False)
a_field = models.PositiveIntegerField(null=True, blank=True)
timestamp = models.DateTimeField(blank=True, null=True)

Related to i use create Django model form with user Input hidden field. forms.py:

class ApplicationForm(forms.ModelForm):
class Meta:
    model = userCommand
    widgets = {
        'user': forms.HiddenInput()
    }

As you can see that there are three fields available for take the input. But i filled the user field in views.py:

def views_method(request, object_id):
if request.method == 'POST':
    form = ApplicationForm(request.POST)
    if form.is_valid():
        form_inst = form.save(commit=False)
        form_inst.user = request.user
        form_inst.save();
        return HttpResponseRedirect(reverse('user_list'))
else:
    form = ApplicationForm()

extra_context = {
    'form':ApplicaitonForm(initial={'user': request.user.pk})
}   
return direct_to_template(request, 'template/remote.html',
                          extra_context=extra_context)

Now i used in my remote.html:

<form action="" method="POST">
{{ form.as_p }}
<input type="submit" value="{% trans "Add " %}" /> 
</form>

What i need to fill the timestamp field from template level by using the following picker written in Jquery:

<input class="time" type="text" name="start" id="start" />
$('input.time').timepicker();

But i am not able to understand, How should i do it? because i am using {{form.as_p}}. How will i populate the froms timestamp fields with this Jquery code.

If i am not wrong then we can do this by following code :

$('#id_timestamp').val($('#time').val())

where id_timestamp is the id of timestamp field in ApplicationForm. But how should i write the code, So that can i can also fill the rest field in ApplicationForm at template level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:19:10+00:00Added an answer on June 10, 2026 at 6:19 am
    <form action="" method="POST">
    {{ form.as_p }}
    <input type="submit" value="{% trans "Add " %}" /> 
    </form>
    <script>
    $(document).ready(function(){
        $('#id_timestamp').timepicker();
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model class tournaments(models.Model): # .... total_rounds = models.IntegerField(max_length=11, blank=True, null=True) #
I have a model: class picture(models.Model): name = models.CharField(null=False, blank=False, max_length=128) collections = models.ManyToManyField('collection',
I have a model: class Example(models.Model): unique_hash = models.CharField(max_length=32,unique=True) content = models.FileField(upload_to='source',blank=True,verbose_name=HTML Content File)
I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content
I have 2 model: class Sideshow_manager(models.Model): url_id = models.CharField(max_length=250,editable=False,unique=True) title = models.CharField(max_length=250) date =
I have a model: class Article(models.Model): text = models.CharField() author = models.ForeignKey(User) How do
I have this model: class Category(models.Model): name = models.CharField() description = models.CharField(blank=True) parent =
I have this model: class UserProfile(models.Model): (UserProfile description) user = models.ForeignKey(User) image = models.ImageField(upload_to=upload_to)
I have a model: class Zone(models.Model): name = models.CharField(max_length=128) users = models.ManyToManyField(User, related_name='zones', null=True,
I have a model: class MyModel(models.Model): id = models.IntegerField(primary_key=True) recorded_on = models.DateField() precipitation =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.