Re: Save, Signals and Models

2010-01-15 Thread Victor Loureiro Lima
I did exactelly that, instead of using id I used the slug, which is also unique, so I skipped it, but the problem still occurs. Either my logic is wrong, or some dumb mistake, but I think that wouldnt work either. Victor Lima 2010/1/15 Mike Ramirez > Add in an if

Re: Save, Signals and Models

2010-01-15 Thread Mike Ramirez
Add in an if statement, one that while cycling through the only_me=True list, ignores the current model you're saving. def save(self): if self.only_me: only_me_true = MyModel.objects.filter(only_me=True) for obj in only_me_true:

Re: Save, Signals and Models

2010-01-15 Thread Victor Loureiro Lima
I think that will not work,when I call the obj.save() I will inevitably step again into my own save() method and the only_me wont be set as False yet, thus the same problem would occur again and again until I get the maximum depth error. I dont think thats an option, ahev you tested this

Re: Save, Signals and Models

2010-01-15 Thread Gabriel Reis
Hey Victor, I can think that a trivial way (I am not sure if it is the best) to do that is to overwrite the save() method of your model: class MyModel(models.Model): title = models.CharField(max_length=100) only_me = models.Boolean(default=False) def save(self): if

Re: Save file object to FileField

2009-12-17 Thread Brian S
I found the answer in this discussion: http://groups.google.com/group/django-users/browse_frm/thread/184e5e09db1efce4/7816cbc650d8dc77 Pass in the filename and content to the FileField's save() method directly, rather than using the model instance's save() method. On Dec 14, 2:24 pm, Brian S

Re: Save as new and files

2009-11-29 Thread Pawel Pilitowski
Hi Tim, Thanks for the response. My Test model: class Test(models.Model): text = models.CharField(max_length=50) image = models.ImageField(upload_to="upload/test_images/", blank=True, null=True) #also tried with FileField def __unicode__(self): return self.text

Re: Save as new and files

2009-11-27 Thread Tim Valenta
Does the newly created model lack a path entirely, or does it have a path that points to a false location? In other words, is the right path making it to the database, yet not to the filesystem to copy the file? Also, since you didn't mention anything about it, I would remind you that a proper

Re: Save as new and files

2009-11-27 Thread Pawel Pilitowski
Hey, Mainly I would like to know what the intended behavior of "save as new" is supposed to be, if it is supposed to copy the files, I will look further into why its not working for me. I was assuming that it would, and didn't find anything in the documentation to the contrary. If it is

Re: Save model as new record in db

2009-09-07 Thread lzantal
Hi, On Sep 7, 3:14 am, Jarek Zgoda wrote: > Wiadomość napisana w dniu 2009-09-07, o godz. 11:11, przez lzantal: > > > I need to save_as in the model of my app So I can save existing > > records as new ones. > > I know there is an option in modeladmin but I don't have an

Re: Save model as new record in db

2009-09-07 Thread Jarek Zgoda
Wiadomość napisana w dniu 2009-09-07, o godz. 11:11, przez lzantal: > I need to save_as in the model of my app So I can save existing > records as new ones. > I know there is an option in modeladmin but I don't have an admin > interface for this app. > Tryed calling force_insert on the save

Re: Save model as new record in db

2009-09-07 Thread Maksymus007
save(force_insert=True) ? On Mon, Sep 7, 2009 at 11:11 AM, lzantal wrote: > > Hi, > > I need to save_as in the model of my app So I can save existing > records as new ones. > I know there is an option in modeladmin but I don't have an admin > interface for this app. > Tryed

Re: save a form

2009-08-20 Thread luca72
Thanks for you reply. But i have this problem i need to check a value from a field before the validation of the form. How i can do this. Sorry for my stupid question but i'm very newbie On 19 Ago, 19:44, Alex Gaynor wrote: > On Wed, Aug 19, 2009 at 11:22

Re: save a form

2009-08-19 Thread Alex Gaynor
On Wed, Aug 19, 2009 at 11:22 AM, luca72 wrote: > > how i can get the value of the fields? > > On 19 Ago, 17:45, Daniel Roseman wrote: >> On Aug 19, 3:40 pm, luca72 wrote: >> >> > Iis but form.save don't work >> >> That's true. >>

Re: save a form

2009-08-19 Thread luca72
how i can get the value of the fields? On 19 Ago, 17:45, Daniel Roseman wrote: > On Aug 19, 3:40 pm, luca72 wrote: > > > Iis but form.save don't work > > That's true. > -- > DR. --~--~-~--~~~---~--~~ You received this

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:40 pm, luca72 wrote: > Iis but form.save don't work > That's true. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: save a form

2009-08-19 Thread luca72
Iis but form.save don't work On 19 Ago, 16:23, Daniel Roseman wrote: > On Aug 19, 3:21 pm, luca72 wrote: > > > Hello i have a POST form (not modelform) how i can save the data in > > the db, and if i need to change the data before the save how i can

Re: save a form

2009-08-19 Thread Daniel Roseman
On Aug 19, 3:21 pm, luca72 wrote: > Hello i have a POST form (not modelform) how i can save the data in > the db, and if i need to change the data before the save how i can do? > > Thanks If it's not a modelform, what does it mean to save it in the database? It's not

Re: save as a new entry

2009-08-12 Thread Ali Rıza Keleş
On Wed, 2009-08-12 at 15:55 -0700, Daniel Roseman wrote: > On Aug 12, 10:40 pm, Ali Rıza KELEŞ wrote: > > In admin interface, in editing section of a model, I need a button to > > save as a new entry. There are four button at the end of the editing > > form. > > - Delete,

Re: save as a new entry

2009-08-12 Thread Daniel Roseman
On Aug 12, 10:40 pm, Ali Rıza KELEŞ wrote: > In admin interface, in editing section of a model, I need a button to > save as a new entry. There are four button at the end of the editing > form. > - Delete, > - Save and Add New, > - Save And Continue Editing, > - Save. > >

Re: save message text with registered character

2009-04-15 Thread CrabbyPete
Karen, Sorry for the cryptic message.I just start using google groups and django. I was storing email that I received in a database. One of the characters was a mark that could not be coverted for some reason. I found the program decodeh.py and it fixed it for me. On Apr 7, 1:40 pm, Karen

Re: save message text with registered character

2009-04-07 Thread Karen Tracey
On Tue, Apr 7, 2009 at 1:29 PM, CrabbyPete wrote: > > I am trying to save a message that has a registered trademark > character in it, like Coke is a registered trademark. > I get a DjangoDecodeError. How do I prevent this from happening? Wild guess: a decode error

Re: save existing jpg to model

2008-10-17 Thread Ben Eliott
Hi Steve, Nope, Linux machine... ??? On 17 Oct 2008, at 01:30, Steve Holden wrote: > > [EMAIL PROTECTED] wrote: >> I have users dumping jpgs into a folder within the media root, the >> idea is to monitor this folder and programmatically add the jpgs to >> certain model instances based on a

Re: save existing jpg to model

2008-10-16 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I have users dumping jpgs into a folder within the media root, the > idea is to monitor this folder and programmatically add the jpgs to > certain model instances based on a naming convention. It all works > fine... except... every time i put a jpg in File object and

Re: Save raw data to an ImageField?

2008-08-22 Thread julianb
On Aug 22, 2:54 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > If, however, you mean that the file is already a StringIO, rather than > a file, and you'd like to save it to a file, I hope to have a fix up > for that this weekend. It's possible right now, but it's not very > easy, much less

Re: Save raw data to an ImageField?

2008-08-22 Thread Marty Alchin
On Fri, Aug 22, 2008 at 8:35 AM, julianb <[EMAIL PROTECTED]> wrote: > What if the file never has a path and exists just as StringIO? I can't > seem to get it to be a "Django file"... I'm a bit confused by that. Do you mean that you don't want to save it to a file, or that it's not a file

Re: Save raw data to an ImageField?

2008-08-22 Thread julianb
On Aug 14, 1:31 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > You'll want to skip StringIO now, because Django provides its own > file-like object you can use directly. When you want to save the file, > you can open up a new File and just use that instead. > > from django.core.files.storage

Re: save sometime cause duplicate data

2008-01-03 Thread Eratothene
This can happen of you multiple times price submit button on the page. That is why it is recommended to issue HttpRedirect after POST. Read carefully: http://www.djangoproject.com/documentation/tutorial04/ On Dec 21 2007, 10:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I start only

Re: save sometime cause duplicate data

2007-12-30 Thread Jeff Anderson
[EMAIL PROTECTED] wrote: > I start only one post request,but the db save two duplicate data in > sometimes. > this just occur sometime,why? > How are you trying to save the data? The admin interface? your own code? If it is your own code, please paste an example so we can look at the problem.

Re: save method and many to many

2007-12-26 Thread grassoalvaro
Unfortunately this solutions dosen't work. Even if i do something (stupid) like that: def post_save_gallery(instance): dispatcher.disconnect(post_save_gallery, signal=signals.post_save, sender=Gallery) gallery = Gallery.objects.get(slug=instance.slug) photos = Photo.objects.all()

Re: save method and many to many

2007-12-25 Thread Malcolm Tredinnick
On Tue, 2007-12-25 at 14:34 -0800, grassoalvaro wrote: > I was searching for solutions but i didnt find anything. > So, here is my problem. > > I have models, for example: > > class Photo(models.Model, helpers.AdminOptions): > name = models.CharField(default="", null=True, blank=True, >

Re: save() doesn't save a removed parent-child relationship to self?

2007-11-19 Thread RajeshD
> > The print self.parents.all() line does print a [] line with self > removed from the parents. Apparently this just does not get saved. Right. The admin always calls the save on the primary object first, followed later by saving the ManyToMany "parents". So, whatever you are doing in your

Re: save() datefield

2007-10-31 Thread äL
No, I do not get any traceback. If any statement fails the exeption will redirect me back to the edit form. How can I force a traceback? It would be more helpfully if an error message will be returned. I will check soon if I can solve the problem with your hints. On 26 Okt., 14:01, Thomas

Re: save() datefield

2007-10-26 Thread Thomas Guettler
Am Freitag, 26. Oktober 2007 10:53 schrieb äL: > I use Django to manage addresses. To publish the data I have a list > and a detailed view. In the detail view I can change the name, > address, phone, etc. of the person. To do that I created an edit > form. > > Now, everythin is fine. Only if I

Re: save() extension works in shell, not in admin interface?

2007-05-18 Thread Ben Jones
Jeremy -- thanks a ton for the help on this. I was really quite frustrated by the end of the day. > The short version is that Admin uses > db.models.manipulators.AutomaticManipulator, which calls your model's > save prior to traversing all the m2m fields for the object. It stomps > on the

Re: save() extension works in shell, not in admin interface?

2007-05-18 Thread Jeremy Dunck
On 5/18/07, Ben Jones <[EMAIL PROTECTED]> wrote: ... > As you can see below, I have extended the save() method for Item so > that Item.default_container is always added to Item.containers. > > Both of the ways I've tried to do this (below) seem to work as > expected in the shell (python manage.py

Re: save many to many data

2007-02-08 Thread Antonio
* giovedì 08 febbraio 2007, alle 07:17, Russell Keith-Magee wrote : > Ok - this is saving a form created from a model. Since your model > contains a m2m field, the form representing that model will have an > m2m widget, and when you save() the form, the m2m relation on the > object will be

Re: save many to many data

2007-02-07 Thread Russell Keith-Magee
On 2/7/07, Antonio <[EMAIL PROTECTED]> wrote: > > * mercoledì 07 febbraio 2007, alle 11:27, Russell Keith-Magee wrote : > > > but the data are added also when I update the Previsione ... > > > searching on group archive, I think I must implement a 'save' method > > > into the Previsione class ...

Re: save many to many data

2007-02-07 Thread Antonio
* mercoledì 07 febbraio 2007, alle 11:27, Russell Keith-Magee wrote : > > but the data are added also when I update the Previsione ... > > searching on group archive, I think I must implement a 'save' method > > into the Previsione class ... is correct ? > > I'm not sure I understand what you're

Re: save many to many data

2007-02-06 Thread Russell Keith-Magee
On 2/7/07, Antonio <[EMAIL PROTECTED]> wrote: > > * martedì 06 febbraio 2007, alle 20:10, Russell Keith-Magee wrote : > > data.rims.add(req.POST.getlist('rims')) Oops - sorry - missed a small, but very important bit - You need to roll out the list as arguments. Ordinarily, the usage of add()

Re: save many to many data

2007-02-06 Thread Antonio
* martedì 06 febbraio 2007, alle 20:10, Russell Keith-Magee wrote : for the moment, I've resolved this way: if req.method == 'POST': myform = nf.models.form_for_model(Previsione)(req.POST) if myform.is_valid(): dati = myform.save(commit=False)

Re: save many to many data

2007-02-06 Thread Russell Keith-Magee
On 2/6/07, Antonio <[EMAIL PROTECTED]> wrote: > Hi all, > I have a class with a many2many field: ... > but when I update the data the old rims are deleted and the new inserted ... > is > possible to UPDATE the rims data ? cioe', is possible to leave unchanged the > rims data if are the same ?

Re: save an object to the session and call back the object in another page

2006-07-04 Thread bernadet
thx jay, recalling the saved objects from session can be from any function. the second point is solved, dont worry.thx again --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: save an object to the session and call back the object in another page

2006-07-04 Thread Jay Parlar
On 7/4/06, bernadet <[EMAIL PROTECTED]> wrote: > > hii, > > now i have another question related to the session: > if i save an object to the session from a certain view > (request.session['myperson']=new_person), can i recall it from another > view by request.session['myperson']. ( i mean from 2

Re: save an object to the session and call back the object in another page

2006-07-04 Thread bernadet
hii, now i have another question related to the session: if i save an object to the session from a certain view (request.session['myperson']=new_person), can i recall it from another view by request.session['myperson']. ( i mean from 2 different functions) and please according to link the user

Re: save an object to the session and call back the object in another page

2006-07-03 Thread Guillermo Fernandez Castellanos
Hi, As far as i know, you can use the "sessions" framework for that: http://www.djangoproject.com/documentation/sessions/ As it says: """The session dictionary should accept any pickleable Python object.""" So you should be able to save your User in the session and call it back afterwards.

Re: Save method called twice on override?

2006-06-05 Thread arthur debert
Hi Alloy. Yes, it's a bug. more details here: http://code.djangoproject.com/ticket/639 basically you have to check for self.imatge != '' before doing anything with the file. cheers, arthur --~--~-~--~~~---~--~~ You received this message because you are

Re: save() called 2 times.

2006-05-05 Thread Max Battcher
Jeremy Dunck wrote: > On 5/5/06, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: > ... > #Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc. You can thank Trac for that. Apparently somebody forgot to tell them that it might be a good idea to truncate after so

Re: save() called 2 times.

2006-05-05 Thread Davide Bertola
Victor : in that post it says that _post_save() is called twice, I tryed to create that _post_save() but I see nobody calls it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: save() called 2 times.

2006-05-05 Thread Jeremy Dunck
On 5/5/06, Joseph Kocherhans <[EMAIL PROTECTED]> wrote: ... #Addedamorepowerfulwayofoverridingmodelmethodsremovedhardcoded_pre_save_post_saveetc. Does the Guinness book of records have an entry for "longest anchor"? ;-) --~--~-~--~~~---~--~~ You received this

Re: save() called 2 times.

2006-05-05 Thread Joseph Kocherhans
On 5/5/06, Davide Bertola <[EMAIL PROTECTED]> wrote: > > Victor : in that post it says that _post_save() is called twice, I > tryed to create that _post_save() but I see nobody calls it. _post_save is a hook method that was used before the magic-removal branch was merged. Now you just override

Re: save() called 2 times.

2006-05-05 Thread Victor Kropp
dade wrote: > In my model I have something like this : > > def Image(modes.Model): > ... > > def save(self): > print "I've been called" > ... > super(Image, self).save() > > I see in the console the print is executed 2 times when I upload the > image from the

Re: save() called 2 times.

2006-05-05 Thread arthur debert
yes this is a known bug. see ticket 639 http://code.djangoproject.com/ticket/639 currently I'm using an ugly work around such as def save(self): if self.imagefield : #do whetever, files does exist... also this seems to cause problems withe DateFields with auto_now...

Re: save() and null/blank character fields

2006-03-13 Thread Zanchey
Malcom: Sure thing. I'll see if I can whip up a testcase (be nice if it's disappeared). David Adam [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: save and session

2005-12-12 Thread plisk
Dody Suria Wijaya wrote: Is it possible in djanggo to access current request's session variables inside _pre_save or _post_save function? I need to save current login userid into a "last_update_userid" field automatically by simply calling .save() Try hack in this thread

<    1   2