Re: Form cleaned_data
On Tue, Nov 26, 2013 at 9:34 AM, Daniel Roseman wrote: > On Monday, 25 November 2013 21:42:51 UTC, Timothy W. Cook wrote: > > But that's just what form.save() does. In your original code, you called it > and a new Review object was saved in the database (it was also returned, but > you didn't use it). The only difference here is that you've added the > commit=False parameter, which does everything it did before except actually > saving to the database. > -- > DR. Apologies for being DENSE: Partial code from the post: def post(self, request, *args, **kwargs): form = self.form_class(request.POST) if form.is_valid(): # paper = get_object_or_404(Paper,pk=kwargs['pk']) reviewer = Reviewer.objects.filter(user=self.request.user).filter(prj_name=paper.project) f = form.save(commit=False) ... So are you saying what I called 'form' above is NOT an instance of a the form from the post? IT is actually an instance of the model? Thanks, Tim -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3V61-w5Uza4UU%2BVcGe4gB8dpiEWu5H1HVZVsTRyDPt0QA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Form cleaned_data
On Wed, Nov 27, 2013 at 9:50 AM, Timothy W. Cook wrote: > On Tue, Nov 26, 2013 at 9:34 AM, Daniel Roseman wrote: >> On Monday, 25 November 2013 21:42:51 UTC, Timothy W. Cook wrote: >> >> But that's just what form.save() does. In your original code, you called it >> and a new Review object was saved in the database (it was also returned, but >> you didn't use it). The only difference here is that you've added the >> commit=False parameter, which does everything it did before except actually >> saving to the database. >> -- >> DR. > > Apologies for being DENSE: > > Partial code from the post: > > def post(self, request, *args, **kwargs): > form = self.form_class(request.POST) > > if form.is_valid(): > # > paper = get_object_or_404(Paper,pk=kwargs['pk']) > reviewer = > Reviewer.objects.filter(user=self.request.user).filter(prj_name=paper.project) > f = form.save(commit=False) > ... > > So are you saying what I called 'form' above is NOT an instance of a > the form from the post? IT is actually an instance of the model? > No, "form" is an instance of your form. Model forms have a method called save(), when you call this method, the model form updates an instance of the model with the values from the form, saves the instance and then returns it to the caller. If a model instance is passed to the model form when it is constructed, then that instance is updated, otherwise a fresh model instance is created. So, "form" is a form, but "f" is not a form, it is a model instance. https://docs.djangoproject.com/en/1.5/topics/forms/modelforms/#the-save-method Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1%2Bh%2BfchPOAwVPU8F5t_C45O3gYMi%3DexhKgaZKOwXV9BaA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Form cleaned_data
Thanks Tom. On Wed, Nov 27, 2013 at 8:13 AM, Tom Evans wrote: > > No, "form" is an instance of your form. Model forms have a method > called save(), when you call this method, the model form updates an > instance of the model with the values from the form, saves the > instance and then returns it to the caller. Yep, this was the part that I wasn't 'getting'. Cheers, Tim -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Vw_hJxi7pqQ8%3D0-nTP_GKznYKboCrXWfnGguVTcxeuoQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
discution
je suis sur un projet qui utilise django mais j'ai encore peu d'idée sur le fonctionnement de django ( ses capacités, dans les script python, avec les sgbd, ses limite, ses failles) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1854e668-0a3d-4a55-ac98-bd9e978e124c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Django Developers wanted, junior and senior. Remote welcome, European timezones.
Hi, I’m Technical Director at FARM Digital. We’re a digital agency based in the UK. We’re currently looking for Django developers, both junior and senior. There are two job descriptions on our website, available at: Senior Developer - http://farmd.co.uk/1bhm1Cn Junior Developer - http://farmd.co.uk/1dvcBVw We’re made up of 15 people, split over two UK offices, with most of our delivery team working remotely. We’re committed to a strong engineering culture, and we do things the right way. We’re also keenly involved in community events, and we run the Django Weekly newsletter ( http://www.djangoweek.ly). If this is of interest, you can either apply directly (information is in the links above), or you can email me for more information. I’m also on Freenode as `JonA`. Thanks! --Jon -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ebf0589d-4e41-4d04-b075-10c6e3c89760%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: discution
Almost everyone on this group can read and write in English, i'll recomend you to write in English to have a really good answer. >From http://translate.google.com: Presque tout le monde sur ce groupe peut lire et écrire en anglais, je vous le recommande d'écrire en anglais pour avoir une très bonne réponse. start here: https://docs.djangoproject.com/fr/1.6/ 2013/11/27 Assane Ka > je suis sur un projet qui utilise django mais j'ai encore peu d'idée sur > le fonctionnement de django ( ses capacités, dans les script python, avec > les sgbd, ses limite, ses failles) > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/1854e668-0a3d-4a55-ac98-bd9e978e124c%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- Rafael E. Ferrero -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJJc_8XydFAS%3DG4jtOv%2Bof5FpVBxp8%2B2%2BzcuWqv3OifwdLHYyg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: lambda callable in foreignkey default
Probably not it, but try: ...(RestaurantType, default = lambda: (RestaurantType.objects.all()[0])) And note that your alternate will fail if RestaurantType object with id==1 is ever deleted. On Tue, Nov 26, 2013 at 7:31 AM, Philippe Raoult wrote: > > I ran into a strange issue today when trying to use a lambda function for > the default value of a ForeignKey. > > my original code was this, and I expected it would look for RestaurantType > instances whenever I would try to create a Restaurant: > type_of_restaurant = models.ForeignKey(RestaurantType, default = lambda: > RestaurantType.objects.all()[0]) > > but to my surprise it would run the query when the models where loaded! > > I changed to this and it behaved as I expected: > type_of_restaurant = models.ForeignKey(RestaurantType, default = lambda: > RestaurantType.objects.get(id = 1)) > > Anyone could explain me why ? Is there something counter-intuitive with > the evaluation order of the brackets or something ? > > Regards, > Philippe > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/ec6651fc-c822-4143-98de-f1adc6639e0e%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAB%2BAj0sSwQJiPx6xw7J8K77UWKoOMJ9E6qXcXjtsxVqBJdSq%3Dw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Virtualenv and Hudson/Jenkins
Yes, I would like to know to also. This has been typical of my Django/Python experience. The OP asked how and that they could not find good documentation and got several responses of why and "google it, lots of good info". Maybe good info if you already mostly know what you are doing and code Python all the time. You can find all the little bits and pieces but nobody ever seems to put it together in a way beginners/intermediates who are not necessarily professional coders can work with. Django/Python has a LOOONg way to go in this respect in order to catch up with more mature technologies like PHP imho. There is still no good consise, simple, organized info for this sort of deployment even though this thread was stared 2 years ago. So things don't seem to have improved. On Tuesday, September 20, 2011 12:30:41 PM UTC-7, Tim Sawyer wrote: > > Has anyone any instructions for using VirtualEnv with Hudson/Jenkins? > > Thanks, > > Tim. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/25528fbd-1e42-4bc5-9301-56a549d71ee9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Trying to run jobs in the background using multiprocessing
Hi there! I am trying to run jobs in the background using the following (minimal) code: Under views.py: def submit(request): model = MyModel() model.RunInAThread(ReferenceSeparator, MutationSeparator) Under models.py: class MyModel(models.Model): def RunInAThread(self, ReferenceSeparator, MutationSeparator): print 1 Thread = multiprocessing.Process(target = self.Run, args=(self, ReferenceSeparator, MutationSeparator)) print 2 Thread.daemon = True print 3 Thread.start() print 4 def Run(self, ReferenceSeparator, MutationSeparator): print 5 But I get the error below and it only print 1, 2, 3 and 4, but not 5: TypeError at /submit 'str' object is not callable ... Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in __init__, line 98 ... I have tried in many different ways (e.g. Daemon = False, without "self" as an "args"), but don't really understand why this would not work, unless Django doesn't permit multiprocessing (which some people seem to suggest online). Any help will be highly appreciated. Best wishes, Pau -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Virtualenv and Hudson/Jenkins
Interesting in how you think that PHP is more mature and better documented than Python. Anyway, the OP asked about virtualenv with Hudson and Jenkins, not about Django. So maybe they asked in the wrong place. Django running virtualenv is quite well documented. But any Python app runs the same under virtualenv. That is kind of the point. So the first step is to learn about virtualenv. Then install Django inside a virtualenv. Yes using Google is a valid answer when you want to get opinions about two pieces of software working together. The Django docs can't (and shouldn't) cover all the possible combinations. If you google those two combinations there are tutorials for them. When I ask specific Django questions here; as a VERY much newbie. I get great answers and even followups when I don't understand how something is working. So your evaluation of the community is flawed. Yes the docs are a little confusing at first. But the tutorial is awesome and you just have to keep looking or ask a specific question. Cheers, Tim On Wed, Nov 27, 2013 at 4:48 PM, shadowy m wrote: > Yes, I would like to know to also. This has been typical of my > Django/Python experience. The OP asked how and that they could not find > good documentation and got several responses of why and "google it, lots of > good info". > > Maybe good info if you already mostly know what you are doing and code > Python all the time. You can find all the little bits and pieces but nobody > ever seems to put it together in a way beginners/intermediates who are not > necessarily professional coders can work with. Django/Python has a LOOONg > way to go in this respect in order to catch up with more mature technologies > like PHP imho. > > There is still no good consise, simple, organized info for this sort of > deployment even though this thread was stared 2 years ago. So things don't > seem to have improved. > > On Tuesday, September 20, 2011 12:30:41 PM UTC-7, Tim Sawyer wrote: >> >> Has anyone any instructions for using VirtualEnv with Hudson/Jenkins? >> >> Thanks, >> >> Tim. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/25528fbd-1e42-4bc5-9301-56a549d71ee9%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- MLHIM VIP Signup: http://goo.gl/22B0U Timothy Cook, MSc +55 21 94711995 MLHIM http://www.mlhim.org Like Us on FB: https://www.facebook.com/mlhim2 Circle us on G+: http://goo.gl/44EV5 Google Scholar: http://goo.gl/MMZ1o LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3UrKL6cFxc4bQFGfvcirfDANfSBvJjKJAmTLaYSEE-L1w%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trying to run jobs in the background using multiprocessing
When I asked about this it seems that the best solution is to use Celery in combination with Django. There seems to be quite a bit of good experience here using them together. HTH, Tim On Wed, Nov 27, 2013 at 5:58 PM, Pau Creixell wrote: > Hi there! > > I am trying to run jobs in the background using the following (minimal) > code: > > Under views.py: > > def submit(request): >model = MyModel() >model.RunInAThread(ReferenceSeparator, MutationSeparator) > > Under models.py: > > class MyModel(models.Model): >def RunInAThread(self, ReferenceSeparator, MutationSeparator): >print 1 >Thread = multiprocessing.Process(target = self.Run, args=(self, > ReferenceSeparator, MutationSeparator)) >print 2 >Thread.daemon = True >print 3 >Thread.start() >print 4 > >def Run(self, ReferenceSeparator, MutationSeparator): >print 5 > > > But I get the error below and it only print 1, 2, 3 and 4, but not 5: > > TypeError at /submit > 'str' object is not callable > ... > Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in > __init__, line 98 > ... > > I have tried in many different ways (e.g. Daemon = False, without "self" as > an "args"), but don't really understand why this would not work, unless > Django doesn't permit multiprocessing (which some people seem to suggest > online). > Any help will be highly appreciated. > > Best wishes, > Pau > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- MLHIM VIP Signup: http://goo.gl/22B0U Timothy Cook, MSc +55 21 94711995 MLHIM http://www.mlhim.org Like Us on FB: https://www.facebook.com/mlhim2 Circle us on G+: http://goo.gl/44EV5 Google Scholar: http://goo.gl/MMZ1o LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3W-SM3-tUq2-hhAh6zoAbAr_HuYCrq6gHwHdkHyj4Go0Q%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: DjangoProject.com community feeds
Could you please confirm the URL that's in the system? That way I can double check that everything works. Much appreciated, Silvio On Tue, Nov 26, 2013 at 6:22 PM, tim wrote: > Your feed was approved on Oct. 14. I'm not sure why your recent entries > haven't appeared. > > > On Tuesday, November 26, 2013 4:14:48 PM UTC-5, Silvio wrote: >> >> Hi there, >> >> I used the form here: https://www.djangoproject.com/community/add/blogs/to >> add my blog feed a while ago. But it was never added. Does anyone still >> check those feed submissions? >> >> The actual blog: >> >> Name: Silvio on Django >> Feed URL: https://www.silviogutierrez.com/blog/tags/django/feed/ >> Home Page: https://www.silviogutierrez.com/ >> >> I'd appreciate if my admin could please add the above. If I should post >> somewhere else, like Django Developers group, let me know. >> >> Thanks in advance, >> >> Silvio >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Django users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/django-users/_mAXEb-1aHw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/6c3c5dd5-0b61-4e46-878f-4f0e2371a3d3%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANfEt_ae6F8f4p929PmLBxoH%2Bc0WpoDiyuaEG%3DLcPyGyO5qQUQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: DjangoProject.com community feeds
Hi Silvio, I've just checked the record for the feed in our database, and it worked as expected -- it's a valid RSS feed, currently showing 4 articles. Unfortunately, I can't offer any advice as to why this isn't being picked up by the community aggregator. I know the feed aggregator has been a little twitchy in the past; we'll need someone to get onto the server and take a closer look. Yours, Russ Magee %-) On Thu, Nov 28, 2013 at 6:53 AM, Silvio J. Gutierrez < silviogutier...@gmail.com> wrote: > Could you please confirm the URL that's in the system? That way I can > double check that everything works. > > Much appreciated, > > Silvio > > > On Tue, Nov 26, 2013 at 6:22 PM, tim wrote: > >> Your feed was approved on Oct. 14. I'm not sure why your recent entries >> haven't appeared. >> >> >> On Tuesday, November 26, 2013 4:14:48 PM UTC-5, Silvio wrote: >>> >>> Hi there, >>> >>> I used the form here: https://www.djangoproject.com/community/add/blogs/to >>> add my blog feed a while ago. But it was never added. Does anyone still >>> check those feed submissions? >>> >>> The actual blog: >>> >>> Name: Silvio on Django >>> Feed URL: https://www.silviogutierrez.com/blog/tags/django/feed/ >>> Home Page: https://www.silviogutierrez.com/ >>> >>> I'd appreciate if my admin could please add the above. If I should post >>> somewhere else, like Django Developers group, let me know. >>> >>> Thanks in advance, >>> >>> Silvio >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Django users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/django-users/_mAXEb-1aHw/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> django-users+unsubscr...@googlegroups.com. >> >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/6c3c5dd5-0b61-4e46-878f-4f0e2371a3d3%40googlegroups.com >> . >> >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CANfEt_ae6F8f4p929PmLBxoH%2Bc0WpoDiyuaEG%3DLcPyGyO5qQUQ%40mail.gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq849GevMv0Lg%3D3PmFJnkO1crxWrLzrDCs93H-UiSGbmw4Ww%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trying to run jobs in the background using multiprocessing
maybe your webserver won't permit multiprocessing, it depends on how you are running django. In any case I would also recommend celery, in this case you have control on how many workers are running, having a webrequest open yet another process means you won't have control on how many processes are running, easily taking your server down. with celery you just add a task to the queue, and you can have that on a different server if you would like success avraham On Wed, Nov 27, 2013 at 10:11 PM, Timothy W. Cook wrote: > When I asked about this it seems that the best solution is to use > Celery in combination with Django. There seems to be quite a bit of > good experience here using them together. > > HTH, > Tim > > > On Wed, Nov 27, 2013 at 5:58 PM, Pau Creixell > wrote: > > Hi there! > > > > I am trying to run jobs in the background using the following (minimal) > > code: > > > > Under views.py: > > > > def submit(request): > >model = MyModel() > >model.RunInAThread(ReferenceSeparator, MutationSeparator) > > > > Under models.py: > > > > class MyModel(models.Model): > >def RunInAThread(self, ReferenceSeparator, MutationSeparator): > >print 1 > >Thread = multiprocessing.Process(target = self.Run, > args=(self, > > ReferenceSeparator, MutationSeparator)) > >print 2 > >Thread.daemon = True > >print 3 > >Thread.start() > >print 4 > > > >def Run(self, ReferenceSeparator, MutationSeparator): > >print 5 > > > > > > But I get the error below and it only print 1, 2, 3 and 4, but not 5: > > > > TypeError at /submit > > 'str' object is not callable > > ... > > Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in > > __init__, line 98 > > ... > > > > I have tried in many different ways (e.g. Daemon = False, without "self" > as > > an "args"), but don't really understand why this would not work, unless > > Django doesn't permit multiprocessing (which some people seem to suggest > > online). > > Any help will be highly appreciated. > > > > Best wishes, > > Pau > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to django-users+unsubscr...@googlegroups.com. > > To post to this group, send email to django-users@googlegroups.com. > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > MLHIM VIP Signup: http://goo.gl/22B0U > > Timothy Cook, MSc +55 21 94711995 > MLHIM http://www.mlhim.org > Like Us on FB: https://www.facebook.com/mlhim2 > Circle us on G+: http://goo.gl/44EV5 > Google Scholar: http://goo.gl/MMZ1o > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3W-SM3-tUq2-hhAh6zoAbAr_HuYCrq6gHwHdkHyj4Go0Q%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6t%2BJZufMPXQhR0pkRYifpco%2BjsQu9%3DqbBMG7rrbrkpPzTQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: discution
Not everybody can express their problems in english, there are many django communities in each language, if not at least regional python communities exists around the globe. I'm almost certain that there is at least one french django list, maybe some french speaking soul here can direct him On Wed, Nov 27, 2013 at 3:37 PM, Rafael E. Ferrero wrote: > Almost everyone on this group can read and write in English, i'll recomend > you to write in English to have a really good answer. > > From http://translate.google.com: > Presque tout le monde sur ce groupe peut lire et écrire en anglais, je > vous le recommande d'écrire en anglais pour avoir une très bonne réponse. > > > start here: https://docs.djangoproject.com/fr/1.6/ > > > 2013/11/27 Assane Ka > >> je suis sur un projet qui utilise django mais j'ai encore peu d'idée sur >> le fonctionnement de django ( ses capacités, dans les script python, avec >> les sgbd, ses limite, ses failles) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/1854e668-0a3d-4a55-ac98-bd9e978e124c%40googlegroups.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > Rafael E. Ferrero > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAJJc_8XydFAS%3DG4jtOv%2Bof5FpVBxp8%2B2%2BzcuWqv3OifwdLHYyg%40mail.gmail.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tJpkn5RdYpdfA7CC%3DpAtAgR3dLAt1TX3YNpb_dFaO1tmA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Why is RequestContext used in this way?
Thanks guys this was very helpful On Friday, 15 November 2013 14:12:50 UTC, Tom Evans wrote: > > On Fri, Nov 15, 2013 at 12:59 PM, Andrew Taylor > > > wrote: > > > > > > Hi, > > > > I've followed some example code which is is follows: > > > > def index(request): > > context = RequestContext(request) > > context_dict = {'boldmessage': "I am from the context"} > > return render_to_response('rango/index.html',context_dict, context) > > > > Here RequestContext only has the first argument filled i.e. request. > > > > My questions are: > > > > 1. Is RequestContext(request) being used in a kind of dummy way to suck > up the context processors for render_to_response? > > 2. What would render_to_response be doing if has both context_dict AND > RequestContext had a second argument? > > > > Sorry if these are stupid questions. I'm new to everything python and > Dango, and the kind of person who forgets everything they have ever known > when trying to decide which pack of toilet paper to buy in the supermarket. > > > > This is explained in the docs: > > If you do not pass in a context, a Context will be created from the > dictionary passed in. > If you do pass in a context, the contents of the dictionary passed in > will be merged in to the context. > > > https://docs.djangoproject.com/en/1.6/topics/http/shortcuts/#django.shortcuts.render_to_response > > > Cheers > > Tom > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ffe2be8c-310a-4d9d-80d2-61a56930f159%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trying to run jobs in the background using multiprocessing
On Wed, Nov 27, 2013 at 2:58 PM, Pau Creixell wrote: > Hi there! > > I am trying to run jobs in the background using the following (minimal) > code: > > Under views.py: > > def submit(request): >model = MyModel() >model.RunInAThread(ReferenceSeparator, MutationSeparator) > > Under models.py: > > class MyModel(models.Model): >def RunInAThread(self, ReferenceSeparator, MutationSeparator): >print 1 >Thread = multiprocessing.Process(target = self.Run, args=(self, > ReferenceSeparator, MutationSeparator)) I suspect that if you are setting the target to be self.Run, then the args should not include self: Thread = multiprocessing.Process(target = self.Run, args=(ReferenceSeparator, MutationSeparator)) -Doug >print 2 >Thread.daemon = True >print 3 >Thread.start() >print 4 > >def Run(self, ReferenceSeparator, MutationSeparator): >print 5 > > > But I get the error below and it only print 1, 2, 3 and 4, but not 5: > > TypeError at /submit > 'str' object is not callable > ... > Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in > __init__, line 98 > ... > > I have tried in many different ways (e.g. Daemon = False, without "self" as > an "args"), but don't really understand why this would not work, unless > Django doesn't permit multiprocessing (which some people seem to suggest > online). > Any help will be highly appreciated. > > Best wishes, > Pau > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAusYCiekn%2BSzJ91puNKJk75HuGjWwiTph-svERB7Be_gxoisw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
GET and POST in forms. Please help me understand the logic!
Hi, I'm struggling with the concepts of get and post and where these status come from in the workflow. I have worked my way through the official pages on forms but I have not quite understood this to my satisfaction. I get the gist that: - get is for requesting data and - the query string parameters are visible - Running multiple get operations with say a bookmarked link has no negative effect whereas with post - post is for making database changes Beyond this I am a little clueless. - When does a request method get assigned? - In other words, with this code below, what would have made the request method become post (or get)? Is this related to a preceding view? - Does a request object have to have a get or a post dictionary in it? Could it have neither? - Does a request object going to a form have to have a get or a post dictionary in it? - Is it the case that with "add_category.html" the page could open with neither a get or post in the request, and while the "add_category" view is running the request method POST could be assigned? - Does a POST method invoke form validation? Example: def add_category(request, category_name_url=""): context = RequestContext(request) if request.method == 'POST': form = CategoryForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print form.errors else: form = CategoryForm return render_to_response('rango/add_category.html', {'form': form}, context) Thanks, Andy -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6367ae1d-fc71-4137-9140-3573a8a5dedc%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: GET and POST in forms. Please help me understand the logic!
I understand the confusion. Part of it is probably that GET and POST, is not part of Django per se, but part of the HTTP standard. Also confusing is that Django, especially in that code you pasted below, a lot is abstracted away. Sorry for the lack of detail, typing from iMe, just wanted to knock out a response. > On Nov 27, 2013, at 10:24 PM, Andrew Taylor wrote: > > Hi, > > I'm struggling with the concepts of get and post and where these status come > from in the workflow. I have worked my way through the official pages on > forms but I have not quite understood this to my satisfaction. > > I get the gist that: > get is for requesting data and > the query string parameters are visible > Running multiple get operations with say a bookmarked link has no negative > effect > whereas with post > post is for making database changes > Beyond this I am a little clueless. > When does a request method get assigned? > In other words, with this code below, what would have made the request method > become post (or get)? Is this related to a preceding view? > Does a request object have to have a get or a post dictionary in it? Could it > have neither? > Does a request object going to a form have to have a get or a post dictionary > in it? > Is it the case that with "add_category.html" the page could open with neither > a get or post in the request, and while the "add_category" view is running > the request method POST could be assigned? > Does a POST method invoke form validation? > > Example: > > def add_category(request, category_name_url=""): > context = RequestContext(request) > > if request.method == 'POST': > form = CategoryForm(request.POST) > > if form.is_valid(): > form.save(commit=True) > return index(request) > else: > print form.errors > > else: > form = CategoryForm > > > return render_to_response('rango/add_category.html', {'form': form}, > context) > > > Thanks, > > > Andy > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/6367ae1d-fc71-4137-9140-3573a8a5dedc%40googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CB93835C-3AC1-465D-8995-6762067CFD19%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Render User Selected Communities (as Checkboxes) in Multiple Choice Form
So I guess no one knows what to do? No one has ever dealt with the multiple choice field or multiple choice selections and the UX for it? On Tuesday, November 26, 2013 9:48:03 AM UTC-5, JJ Zolper wrote: > > > I know it's sort of a need by case basis but has anyone tried to do this > before? Has anyone tried to render the choices a user has selected > previously by rendering checked check boxes on a multiple choice field? > > Thanks, > > JJ > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d65f102f-e185-4a48-bd68-1204ea3f5dba%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Admin permissions for proxy ModelAdmins?
Hello all, I want to have multiple admin interfaces for editing the same model under different circumstances. The way I've been doing this is to register multiple proxy models, each with their own ModelAdmins. However, the proxy models don't seem to generate permissions, so they don't show up in the admin interface for non-superusers. The fact that they do show up for superusers suggests that there's a way to make them available to others, but I'm having trouble figuring out how. Based on things I've read since I came up with this plan, it's sounding like a better way to do what I'm trying to do would be to override change_view() on a single ModelAdmin anyway, but I'm still curious about the above, in case it ever becomes relevant again (and, while I'm at it, a sanity-check on my suspicion that the change_view approach is indeed the more appropriate solution would be nice!). Thanks! --Brad -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4c82321c-c4a1-4738-9bdb-277b07ebbefb%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trying to run jobs in the background using multiprocessing
Hi again, Thanks for all your answers. Yes, I also found out many recommend Celery, but I was hoping for a "simpler" solution, if there is one... Doug, I already tried without the self in arguments, but got the same error, unfortunately. I guess if there isn't another simpler way, I'll have to dig into Celery. Cheers, Pau On Thursday, November 28, 2013 4:01:25 AM UTC+1, Doug Blank wrote: > > On Wed, Nov 27, 2013 at 2:58 PM, Pau Creixell > > > wrote: > > Hi there! > > > > I am trying to run jobs in the background using the following (minimal) > > code: > > > > Under views.py: > > > > def submit(request): > >model = MyModel() > >model.RunInAThread(ReferenceSeparator, MutationSeparator) > > > > Under models.py: > > > > class MyModel(models.Model): > >def RunInAThread(self, ReferenceSeparator, MutationSeparator): > >print 1 > >Thread = multiprocessing.Process(target = self.Run, > args=(self, > > ReferenceSeparator, MutationSeparator)) > > I suspect that if you are setting the target to be self.Run, then the > args should not include self: > > Thread = multiprocessing.Process(target = self.Run, > args=(ReferenceSeparator, MutationSeparator)) > > -Doug > > >print 2 > >Thread.daemon = True > >print 3 > >Thread.start() > >print 4 > > > >def Run(self, ReferenceSeparator, MutationSeparator): > >print 5 > > > > > > But I get the error below and it only print 1, 2, 3 and 4, but not 5: > > > > TypeError at /submit > > 'str' object is not callable > > ... > > Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in > > __init__, line 98 > > ... > > > > I have tried in many different ways (e.g. Daemon = False, without "self" > as > > an "args"), but don't really understand why this would not work, unless > > Django doesn't permit multiprocessing (which some people seem to suggest > > online). > > Any help will be highly appreciated. > > > > Best wishes, > > Pau > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to django-users...@googlegroups.com . > > To post to this group, send email to > > django...@googlegroups.com. > > > Visit this group at http://groups.google.com/group/django-users. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com. > > > > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5f2c1e2d-2833-4d81-8fda-bbf11a473fae%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.