Re: Using ModelForms

2015-08-31 Thread Florian Schweikert
On 25/08/15 01:25, Sait Maraşlıoğlu wrote: > default = timezone.now() Beware, timezone.now() will be evaluated once when the module is loaded, not on save if you might think. Use default = timezone.now without calling it to get the current value on save. -- You received this message because you

Re: Using ModelForms

2015-08-25 Thread Hugo Kitano
So the form should have action = '/stats/submit/' ? If I do this, whenever I click submit, it brings me back to the submission page, telling me that I didn't submit a file even if I did. On Tuesday, August 25, 2015 at 11:05:59 AM UTC-7, Hugo Osvaldo Barrera wrote: > > > On Tue, Aug 25, 2015,

Re: Using ModelForms

2015-08-25 Thread 'Hugo Osvaldo Barrera' via Django users
On Tue, Aug 25, 2015, at 14:16, Hugo Kitano wrote: > Noted.  "/stat/s" is an index page.  Here is what my urls.py looks > like.  Also, by using print statements, I've realized that the > request.method is always GET, not POST, which makes it so no model > instance is ever saved.  What does this GE

Re: Using ModelForms

2015-08-25 Thread Hugo Kitano
Noted. "/stat/s" is an index page. Here is what my urls.py looks like. Also, by using print statements, I've realized that the request.method is always GET, not POST, which makes it so no model instance is ever saved. What does this GET request refer to specifically? Thanks On Monday,

Re: Using ModelForms

2015-08-24 Thread Sait Maraşlıoğlu
instead of model_instance.sub_date = timezone.now() I suggest you to declare a default for that field in your model definition. default = timezone.now() On Thursday, 20 August 2015 23:41:05 UTC+3, Hugo Kitano wrote: > > Hi, I'm a beginner using Django, and I'm having trouble using model forms

Re: Using ModelForms

2015-08-24 Thread 'Hugo Osvaldo Barrera' via Django users
On Mon, Aug 24, 2015, at 16:41, Hugo Kitano wrote: > I'm actually now pretty certain that my html file is what's causing it > to not work > > Including your message as an inline image rather than simple text will reduce the amount of people that can actually read your message (and complicate foll

Re: Using ModelForms

2015-08-24 Thread Hugo Kitano
Also, it looks like the request.method is always 'GET', not 'POST', which means the form is never saved. How is this happening? On Monday, August 24, 2015 at 12:56:39 PM UTC-7, Hugo Kitano wrote: > > More specifically, what does the action="/stats/" field do and require? > > On Monday, August 24

Re: Using ModelForms

2015-08-24 Thread Hugo Kitano
More specifically, what does the action="/stats/" field do and require? On Monday, August 24, 2015 at 12:41:16 PM UTC-7, Hugo Kitano wrote: > > I'm actually now pretty certain that my html file is what's causing it to > not work > > > > On Monday, August 24, 2015 at 11:34:41 AM UTC-7, Hugo Kitano

Re: Using ModelForms

2015-08-24 Thread Hugo Kitano
I'm actually now pretty certain that my html file is what's causing it to not work On Monday, August 24, 2015 at 11:34:41 AM UTC-7, Hugo Kitano wrote: > > It always redirects to the stats page, though the model instance isn't > saved. > I suspect it has to do with the .save() function, but I c

Re: Using ModelForms

2015-08-24 Thread Hugo Kitano
It always redirects to the stats page, though the model instance isn't saved. I suspect it has to do with the .save() function, but I can't tell why, since I even create the modelform in the views.py file. Thanks, Hugo On Saturday, August 22, 2015 at 3:19:07 AM UTC-7, James Schneider wrote:

Re: Using ModelForms

2015-08-22 Thread James Schneider
On Aug 22, 2015 3:10 AM, "James Schneider" wrote: > > Hi, I'm a beginner using Django, and I'm having trouble using model forms to create instances of my model. > When a user submits a form, the database saves nothing. Here's my code for the view > > > So what exactly does happen?

Re: Using ModelForms

2015-08-22 Thread James Schneider
Hi, I'm a beginner using Django, and I'm having trouble using model forms to create instances of my model. When a user submits a form, the database saves nothing. Here's my code for the view So what exactly does happen? Based on the code you provided, you would either end up on the

Re: Using ModelForms

2015-08-21 Thread Hugo Kitano
Do you have any idea what could be causing the problem, then? On Friday, August 21, 2015 at 2:25:17 AM UTC-7, Hugo Osvaldo Barrera wrote: > > > > > On Thu, Aug 20, 2015, at 17:43, Edgar Gabaldi wrote: > > The code seems right. Probably your form has some error. Try print > {{form.errors}} i

Re: Using ModelForms

2015-08-21 Thread 'Hugo Osvaldo Barrera' via Django users
On Thu, Aug 20, 2015, at 17:43, Edgar Gabaldi wrote: > The code seems right. Probably your form has some error. Try print > {{form.errors}} in your template to check. Shouldn't {{ form.as_p }} include errors as well? This seems to be what the doc indicates: https://docs.djangoproject.com/en/1.

Re: Using ModelForms

2015-08-20 Thread Hugo Kitano
Could you elaborate on my form has some error? On Thursday, August 20, 2015 at 1:43:32 PM UTC-7, Edgar Gabaldi wrote: > > The code seems right. Probably your form has some error. Try print > {{form.errors}} in your template to check. > > On Thu, Aug 20, 2015 at 4:45 PM, Hugo Kitano > wrote: > >>

Re: Using ModelForms

2015-08-20 Thread Edgar Gabaldi
The code seems right. Probably your form has some error. Try print {{form.errors}} in your template to check. On Thu, Aug 20, 2015 at 4:45 PM, Hugo Kitano wrote: > Hi, I'm a beginner using Django, and I'm having trouble using model forms > to create instances of my model. > When a user submits a