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

Using ModelForms

2015-08-20 Thread Hugo Kitano
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 def submit(request): SubmissionForm = modelform_factory(Submission, fields=('sub_name', 'sub_file'))

Re: Strange behavior using ModelForms

2012-12-18 Thread Karen Tracey
On Tue, Dec 18, 2012 at 4:11 PM, Francisco Vianna < francisco.v.via...@gmail.com> wrote: > After some debugging, I realized they become the same after calling > "is_valid" to the bound form. Now, I'm not sure if I am missing something > conceptually about ModelForms binding. > Its very ackward to

Re: Strange behavior using ModelForms

2012-12-18 Thread Chris Cogdon
The binding allows the modelform to read the current values of an instance, and also to write them back to the same instance when the values are changed. If you're only ever creating new instances, then you don't need to bind it. On Tuesday, December 18, 2012 6:19:45 PM UTC-8, fvianna wrote: >

Re: Strange behavior using ModelForms

2012-12-18 Thread Francisco Vianna
Because unless I'm getting some real debbuging issues, request.user is also changed during the process. It happens as if all references were pointing to the same object, when i believe thet, as far as I understand these Django machanisms and functionalities, this should not happen. The basic issu

Re: Strange behavior using ModelForms

2012-12-18 Thread Chris Cogdon
Rather than comparing to instance, why not compare to request.user ? On Tuesday, December 18, 2012 1:11:21 PM UTC-8, fvianna wrote: > > Hello everyone, > > I want to apologize if I came to the wrong place to talk about this, but > I've been using Django for a while now, and crossed to a very stra

Strange behavior using ModelForms

2012-12-18 Thread Francisco Vianna
Hello everyone, I want to apologize if I came to the wrong place to talk about this, but I've been using Django for a while now, and crossed to a very strange behavior that hits me as bug, but I'm not quite sure. First time trying to get a little deeper and maybe report something to help the co

Saving multiple variables using ModelForms

2008-09-18 Thread garces.85
Hello everyone, I am new in django and python programming. I have a problem, i want to save for each activity an amount of money that goes with an item. Example: i want to store the activity1 - $100 - item1, activity2 - $200 - item2, activity2 - $100 - item1. How can i use this please? Until now

Re: Making a Form from a model using ModelForms, but dont want to include the ForeignKey variable in the form

2008-07-21 Thread Django_newbie
Hi James, That was a quick replyExcluding the field helped. Thank you soo much On Jul 21, 5:49 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Mon, Jul 21, 2008 at 4:09 PM, Django_newbie <[EMAIL PROTECTED]> wrote: > > This save() fails because the form.is_valid() is not true, and the >

Re: Making a Form from a model using ModelForms, but dont want to include the ForeignKey variable in the form

2008-07-21 Thread James Bennett
On Mon, Jul 21, 2008 at 4:09 PM, Django_newbie <[EMAIL PROTECTED]> wrote: > This save() fails because the form.is_valid() is not true, and the > Blog(foreignkey) field is missing from the post data, how can i make > this save without letting user choose this blog field? Or is it > necessary that t