Re: Issues saving a formset form with multiple forms.

2013-11-11 Thread Jason S
Hi, 
The first form saves fine but the second still dosn't.
I can't seem to pass the poll object to the save method of the form 
properly.

Since i'm using nonrel once i've passed the poll object I can append the 
comment using something like poll.comments.append(comment) but I just don't 
seem to be able to get it going. 

I've re-written the form quite a few times without any luck and have looked 
at a few similar examples but can't quite piece it together. Any chance you 
could show me how its done? 

On Thursday, 7 November 2013 23:02:48 UTC-10, Jason S wrote:
>
> Hi Paul,
> After a bit more playing around I got it going, there was another 
> unrelated issue with my code.
> Learnt to use the debugging info more effectively in the process which is 
> great.
>
> Thanks again for your help, very much appreciated.
> Kind regards,
> Jason
>
> On Thursday, 7 November 2013 04:56:14 UTC-10, pnich...@gmail.com wrote:
>>
>> Hey Jason--
>>
>> You defined the save method as needing the user parameter, but you don't 
>> pass that in.  Try that (assuming user should equal request.user).  Good 
>> luck!
>>
>> -Paul
>>
>> On Thursday, November 7, 2013 5:25:18 AM UTC-5, Jason S wrote:
>>>
>>> Hi, 
>>> Disclaimer - I'm new to django and python, so please bear with me.
>>>
>>> Note: My django instance uses a nosql database.
>>>
>>> I'm trying to create a formset which has multiple forms based on models.
>>> The formset will have one form "post", then 1-3 "comment" forms. 
>>> Eventually i'd like to be able to add/remove the comment fields but i'll 
>>> work that out later once the form saves with manually set number of comment 
>>> fields. 
>>> For now the formset just has the two forms "post" and "comment" to make 
>>> it easy, but if i can save one it should work for more.
>>> The form displays as expected but I get "save() takes at least 2 
>>> arguments (1 given)".
>>>
>>> I think thats because i'm supplying the "post" data, but not the object 
>>> itself? I've tried referencing it but without success.
>>> I may need to set the form up as a class with methods and then use 
>>> something like the following which is how another tut does it, but my first 
>>> attempt to do it this way failed.
>>>  21 def post(self, request, *args, **kwargs):
>>>  22 self.object = self.get_object()
>>>  23 form = CommentForm(object=self.object, data=request.POST)
>>>  24
>>>  25 if form.is_valid():
>>>  26 form.save()
>>>  27 return 
>>> HttpResponseRedirect(self.object.get_absolute_url())
>>>
>>>
>>> *Models:*
>>>   7 class Object_Post(models.Model):
>>>   8 # Defines the post model
>>>   9 def __unicode__(self):
>>>  10 return self.name
>>>  11
>>>  12 name = models.CharField(max_length=70)
>>>  13 desc = models.TextField()
>>>  14 Comments = ListField(EmbeddedModelField('Comment), 
>>> editable=False)
>>>  15
>>>  16
>>>  17 class Comment(models.Model):
>>>  18 # Comments.
>>>  19 def __unicode__(self):
>>>  20return self.name
>>>  21
>>>  22 name = models.CharField(max_length=70)
>>>  23 desc = models.TextField()
>>>
>>> *Forms:*
>>>  39 class PostForm(forms.ModelForm):
>>>  40 class Meta:
>>>  41 model = Object_Post
>>>  42
>>>  43 def save(self, user, commit = True):
>>>  44 Object_Post = super(PostForm, self).save(commit = False)
>>>  45 Object_Post.user = user
>>>  46
>>>  47 if commit:
>>>  48 Object_Post.save()
>>>  49
>>>  50 return Object_Post
>>>  51
>>>  52 class CommentForm(forms.ModelForm):
>>>  53 class Meta:
>>>  54 model = Comment
>>>  55
>>>  56 def save(self, user, commit = True):
>>>  57 Comment = super(CommentForm, self).save(commit = False)
>>>  58 Comment.user = user
>>>  59
>>>  60 if commit:
>>>  61 Comment.save()
>>>  62
>>>  63 return Comment
>>>
>>> *View:*
>>>  65 def create_post(request):
>>>  66 
>>>  67 #   
>>>  68 #   Manually set number of comment fields for now
>>>  69 commentfields = 1
>>>  70
>>>  71 if request.method == "POST":
>>>  72 pform = PostForm(request.POST, instance=Object_Post())
>>>  73 #
>>>  74 cforms = [CommentForm(request.POST, prefix=str(x), 
>>> instance=Comment()) for x in range(0,Commentfields)]
>>>  75 if pform.is_valid() and all([cf.is_valid() for cf in 
>>> cforms]):
>>>  76 #
>>>  77 new_post = pform.save()
>>>  78 for cf in cforms:
>>>  79 new_Comment = cf.save(commit=False)
>>>  80 new_Comment.Object_Post = new_post
>>>  81 new_Comment.save()
>>>  82 return 
>>> HttpResponseRedirect(reverse('blogtut.views.dashboard'))
>>>  83 else:
>>>  84 pform = PostForm(instance=Object_Post())
>>>  85 cforms = [CommentForm(prefix=str(x), instance=Comment()) for 
>>> x in range(0,Commentfields)]
>>>  86 ret

Re: Issues saving a formset form with multiple forms.

2013-11-11 Thread Jason S
It looks like i'm passing the right objects but get told there isn't a 
comments field
Exception Type:AttributeErrorException Value:

'PollForm' object has no attribute 'comments'



The debug info says:
poll.comments.append(self) ...
▼ Local vars
Variable Value
self 

user 

poll 





On Sunday, 10 November 2013 23:05:49 UTC-10, Jason S wrote:
>
> Hi, 
> The first form saves fine but the second still dosn't.
> I can't seem to pass the poll object to the save method of the form 
> properly.
>
> Since i'm using nonrel once i've passed the poll object I can append the 
> comment using something like poll.comments.append(comment) but I just don't 
> seem to be able to get it going. 
>
> I've re-written the form quite a few times without any luck and have 
> looked at a few similar examples but can't quite piece it together. Any 
> chance you could show me how its done? 
>
> On Thursday, 7 November 2013 23:02:48 UTC-10, Jason S wrote:
>>
>> Hi Paul,
>> After a bit more playing around I got it going, there was another 
>> unrelated issue with my code.
>> Learnt to use the debugging info more effectively in the process which is 
>> great.
>>
>> Thanks again for your help, very much appreciated.
>> Kind regards,
>> Jason
>>
>> On Thursday, 7 November 2013 04:56:14 UTC-10, pnich...@gmail.com wrote:
>>>
>>> Hey Jason--
>>>
>>> You defined the save method as needing the user parameter, but you don't 
>>> pass that in.  Try that (assuming user should equal request.user).  Good 
>>> luck!
>>>
>>> -Paul
>>>
>>> On Thursday, November 7, 2013 5:25:18 AM UTC-5, Jason S wrote:

 Hi, 
 Disclaimer - I'm new to django and python, so please bear with me.

 Note: My django instance uses a nosql database.

 I'm trying to create a formset which has multiple forms based on models.
 The formset will have one form "post", then 1-3 "comment" forms. 
 Eventually i'd like to be able to add/remove the comment fields but i'll 
 work that out later once the form saves with manually set number of 
 comment 
 fields. 
 For now the formset just has the two forms "post" and "comment" to make 
 it easy, but if i can save one it should work for more.
 The form displays as expected but I get "save() takes at least 2 
 arguments (1 given)".

 I think thats because i'm supplying the "post" data, but not the object 
 itself? I've tried referencing it but without success.
 I may need to set the form up as a class with methods and then use 
 something like the following which is how another tut does it, but my 
 first 
 attempt to do it this way failed.
  21 def post(self, request, *args, **kwargs):
  22 self.object = self.get_object()
  23 form = CommentForm(object=self.object, data=request.POST)
  24
  25 if form.is_valid():
  26 form.save()
  27 return 
 HttpResponseRedirect(self.object.get_absolute_url())


 *Models:*
   7 class Object_Post(models.Model):
   8 # Defines the post model
   9 def __unicode__(self):
  10 return self.name
  11
  12 name = models.CharField(max_length=70)
  13 desc = models.TextField()
  14 Comments = ListField(EmbeddedModelField('Comment), 
 editable=False)
  15
  16
  17 class Comment(models.Model):
  18 # Comments.
  19 def __unicode__(self):
  20return self.name
  21
  22 name = models.CharField(max_length=70)
  23 desc = models.TextField()

 *Forms:*
  39 class PostForm(forms.ModelForm):
  40 class Meta:
  41 model = Object_Post
  42
  43 def save(self, user, commit = True):
  44 Object_Post = super(PostForm, self).save(commit = False)
  45 Object_Post.user = user
  46
  47 if commit:
  48 Object_Post.save()
  49
  50 return Object_Post
  51
  52 class CommentForm(forms.ModelForm):
  53 class Meta:
  54 model = Comment
  55
  56 def save(self, user, commit = True):
  57 Comment = super(CommentForm, self).save(commit = False)
  58 Comment.user = user
  59
  60 if commit:
  61 Comment.save()
  62
  63 return Comment

 *View:*
  65 def create_post(request):
  66 
  67 #   
  68 #   Manually set number of comment fields for now
  69 commentfields = 1
  70
  71 if request.method == "POST":
  72 pform = PostForm(request.POST, instance=Object_Post())
  73 #
  74 cforms = [CommentForm(request.POST, prefix=str(x), 
 instance=Comment()) for x in range(0,Commentfields)]
  75 if pform.is_valid() and all([cf.is_valid() for cf in 
 cforms]):
  76 #
  77 new_pos

Is this what you would expect from this Q query?

2013-11-11 Thread Phoebe Bright
I have this line in my code where the functions return an ID and what I 
wanted was to select all records that did not belong to one of these users.

Carbon.objects.filter(~Q(user__in = [limbo_user(), system_user(), 
retire_user()]))

What I expected to get was 

*SELECT* •••  *FROM* "web_carbon" *WHERE* 
*NOT*(("web_carbon"."user_id" *IN* (5, 2, 4))

but what I actually got was

*SELECT* •••  *FROM* "web_carbon" *WHERE* 
*NOT*(("web_carbon"."user_id" *IN* (5, 2, 4) *AND* "web_carbon"."user_id" 
*IS**NOT NULL*)) 

So it always returns a null set.  Is this correct behaviour and if so, does 
anyone know what the correct syntax is?

-- 
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/012666c4-3fba-4fef-b8e8-55d27f06a895%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django website migration from live server to localhost

2013-11-11 Thread IR. T
Thanks , i have used easy_install command to install all the packages which
were essencial to run my django app and i am glad my app is running now but
unfortunately it is running without the website template may be i need to
fix urls which are point to website template.
Regards,
IR.T


On Sun, Nov 10, 2013 at 2:58 AM, CLIFFORD ILKAY
wrote:

> On 11/09/2013 02:17 PM, IR. T wrote:
> > Thanks Klifford for quick response , i have installed pip already and
> > also installed parse from pip but i am still geting the same error,
> > any other suggestions?
>
> "pip install yolk" and then "yolk -l" to see if parse is indeed
> installed in your virtualenv. That package might not be available to
> your virtual environment, assuming you're using virtualenv. (If you're
> not, you should be.)
>
> --
> Regards,
>
> Clifford Ilkay
>
> 647-778-8696
>
> Dinamis
>
> 
>
> --
> 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/ozVts5lpHuc/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/527EB011.60107%40dinamis.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/CAO3i3OphhHtO6VzYhzer7-LWM42Hygbh1LmEd-5Cic3eYNYiOg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Invalid control character char 30262

2013-11-11 Thread Chi Tak Lam
Is there anyone can help?

I think i should do a str.replace(old, new)?
but i not sure what i should i set for 'old' and 'new' argument...

something like this?
"my text".replace(char 30262, '???')

On Saturday, November 9, 2013 11:44:53 PM UTC+8, Chi Tak Lam wrote:
>
> Hi,
>
> I have a django-celery task to retrieve data from a third party service 
> and store into my database.
> But I found an error in my log file, which is
> None: Invalid control character at: line 1134 column 14 (char 30262)
>
> Not sure what is char 30262, maybe this?
> http://www.fileformat.info/info/unicode/char/30262/index.htm
>
> My question is, how can i solve this problem without skip this records?
>
> Thanks.
>

-- 
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/cc611f7e-ea7a-4ac6-827e-da1bef990387%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Invalid control character char 30262

2013-11-11 Thread Sandro Dutra
Try to write on top of this file:

# -*- coding: utf-8 -*-

Maybe help.


2013/11/11 Chi Tak Lam 

> Is there anyone can help?
>
> I think i should do a str.replace(old, new)?
> but i not sure what i should i set for 'old' and 'new' argument...
>
> something like this?
> "my text".replace(char 30262, '???')
>
>
> On Saturday, November 9, 2013 11:44:53 PM UTC+8, Chi Tak Lam wrote:
>>
>> Hi,
>>
>> I have a django-celery task to retrieve data from a third party service
>> and store into my database.
>> But I found an error in my log file, which is
>> None: Invalid control character at: line 1134 column 14 (char 30262)
>>
>> Not sure what is char 30262, maybe this?
>> http://www.fileformat.info/info/unicode/char/30262/index.htm
>>
>> My question is, how can i solve this problem without skip this records?
>>
>> Thanks.
>>
>  --
> 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/cc611f7e-ea7a-4ac6-827e-da1bef990387%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/CAH%2Bpf9mDaLDDbWBV9kH0H7AY-nhe3DnQOk%2BK-ah9ZOTyhvKCcA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Trouble with (unwanted) field validation

2013-11-11 Thread DJ-Tom

This is really weird - I just tried again and *can't* reproduce it at all 
... everything is suddenly working as expected.

Thanks anyways ;-)

Am Freitag, 8. November 2013 13:41:49 UTC+1 schrieb Sergiy Khohlov:
>
> answer is  simple .  Validator would like to check field which is 
> used for Key.  Look like this field is not set   before validation. 
>  I would like take a look at model  form  and part of code before 
> form.is_valid 
> Many thanks, 
>
> Serge 
>
>
> +380 636150445 
> skype: skhohlov 
>
>
> On Fri, Nov 8, 2013 at 2:29 PM, DJ-Tom > 
> wrote: 
> > I still didn't get this to work... isn't there anybody that is able to 
> help? 
> > 
> > Am Mittwoch, 30. Oktober 2013 10:47:34 UTC+1 schrieb DJ-Tom: 
> >> 
> >> Hi, 
> >> 
> >> given the following model field: 
> >> 
> >> room_setup = models.ForeignKey("roomsetup", verbose_name='Default room 
> >> setup', blank=True, null=True, default='') 
> >> 
> >> In the modelform __init__ method I'm setting the choices for this field 
> >> like this: 
> >> 
> >> self.fields['room_setup'].choices = 
> roomsetups_as_choices(subevt) 
> >> 
> >> def roomsetups_as_choices(subevt): 
> >> rs = [['', '-']] 
> >> for setup in roomsetup.objects.filter(Q(subevent__isnull=True) | 
> >> Q(subevent=subevt)): 
> >> rs.append([setup.id, setup.name]) 
> >> 
> >> return rs 
> >> 
> >> When adding a new record I keep getting the following validation 
> message, 
> >> but only for the first try to submit of the form: 
> >> 
> >> "Select a valid choice. That choice is not one of the available 
> choices." 
> >> 
> >> It passes without error on the second try... I really don't understand 
> >> why? 
> >> 
> >> IMHO it should not complain at all... 
> >> 
> >> Any ideas? 
> >> 
> >> Thomas 
> > 
> > -- 
> > 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/d6ff282b-aafa-411a-a5f6-00f6b6687e7a%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/21ee3080-05b9-4364-9c40-015912abb899%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Fabric for dependency management, testing strategy

2013-11-11 Thread Kannan
Hi Guys,
I am new to Fabric. Please send me  your thoughts of using Fabric for
dependency management and also about the testing strategy.


Additionally, Please send me tutorials or links or something that can start
with.




With regards,
Kannan

-- 
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/CAL4xV_B_vxCBop5AgEjcyCzj6RiPHVW3cV0PxfgDEuRHzM3ifQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fabric for dependency management, testing strategy

2013-11-11 Thread Avraham Serour
for dependency management you should use pip, first step is to go through
the docs for fabric (and pip)
also you should google for best practices


On Mon, Nov 11, 2013 at 4:40 PM, Kannan  wrote:

> Hi Guys,
> I am new to Fabric. Please send me  your thoughts of using Fabric for
> dependency management and also about the testing strategy.
>
>
> Additionally, Please send me tutorials or links or something that can
> start with.
>
>
>
>
> With regards,
> Kannan
>
>  --
> 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/CAL4xV_B_vxCBop5AgEjcyCzj6RiPHVW3cV0PxfgDEuRHzM3ifQ%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/CAFWa6tLB9FOhVrVvr7ydAkojmPTp8s_20%2BFO1N22cTnLXJcW_A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Invalid control character char 30262

2013-11-11 Thread Timothy W. Cook
The replace was my thought as well.  I would just replace it with an
empty string. Especially since it is a control character and apprently
doesn't carry human readable information.

?


On Mon, Nov 11, 2013 at 11:38 AM, Chi Tak Lam  wrote:
> Is there anyone can help?
>
> I think i should do a str.replace(old, new)?
> but i not sure what i should i set for 'old' and 'new' argument...
>
> something like this?
> "my text".replace(char 30262, '???')
>
> On Saturday, November 9, 2013 11:44:53 PM UTC+8, Chi Tak Lam wrote:
>>
>> Hi,
>>
>> I have a django-celery task to retrieve data from a third party service
>> and store into my database.
>> But I found an error in my log file, which is
>> None: Invalid control character at: line 1134 column 14 (char 30262)
>>
>> Not sure what is char 30262, maybe this?
>> http://www.fileformat.info/info/unicode/char/30262/index.htm
>>
>> My question is, how can i solve this problem without skip this records?
>>
>> Thanks.
>
> --
> 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/cc611f7e-ea7a-4ac6-827e-da1bef990387%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%3DOU3V%3DKyde8XPLZ0qbThDoc86HQ65Zao2Ad-X4__1Zx5%3DqJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fabric for dependency management, testing strategy

2013-11-11 Thread John DeRosa
Agree with Avraham. Some other considerations:

I use Linux package managers (e.g., apt-get on Debian) for non-critical 
technology. This usually (but not always) means all non-Python technology, plus 
Python technology that we don’t push to its limits.

But, OTOH, at least in Ubuntu, it can sometimes be a hassle to locate the 
Ubuntu package containing the Python package I want to install. OTTH, it *is* 
quite nice to let apt-get to take care of all the dependencies, and install the 
big technologies (e.g., postgres). 

When using pip, make sure you lock your versions in your dependency file. 
(e.g., celery==3.0.1) BUT don’t blindly trust it. I’ve had instances where I 
asked for version x and pip installed a different version and my life turned 
into hell for half a day. I partly blame pip (if I ask for version 3.0.1, then 
I want 3.0.1 dammit, and if you can’t install 3.0.1 then you should throw an 
exception!) and partly blame lazy package maintainers who assert that, e.g., 
3.0.4 is a drop in replacement for 3.0.1 when in fact it is not.

Our systems are smallish (~ 25 nodes or so) and I find managing them with 
fabric is satisfactory. I have fabric tasks for updating nodes, provisioning 
new nodes, etc., and it works for me. But I have been thinking about adding 
Ansible to the mix. YMMV.

John


On Nov 11, 2013, at 6:47 AM, Avraham Serour  wrote:

> for dependency management you should use pip, first step is to go through the 
> docs for fabric (and pip)
> also you should google for best practices
> 
> 
> On Mon, Nov 11, 2013 at 4:40 PM, Kannan  wrote:
> Hi Guys, 
> I am new to Fabric. Please send me  your thoughts of using Fabric for 
> dependency management and also about the testing strategy. 
> 
> 
> Additionally, Please send me tutorials or links or something that can start 
> with.
> 
> 
> 
> 
> With regards, 
> Kannan
> 
> 
> -- 
> 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/CAL4xV_B_vxCBop5AgEjcyCzj6RiPHVW3cV0PxfgDEuRHzM3ifQ%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/CAFWa6tLB9FOhVrVvr7ydAkojmPTp8s_20%2BFO1N22cTnLXJcW_A%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/CD172942-461A-4B7E-AD84-52AF60A4AB70%40ipstreet.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Invalid control character char 30262

2013-11-11 Thread m1chael
I use ignore in unicode(...) to solve annoying things like this
On Nov 11, 2013 10:48 AM, "Timothy W. Cook"  wrote:

> The replace was my thought as well.  I would just replace it with an
> empty string. Especially since it is a control character and apprently
> doesn't carry human readable information.
>
> ?
>
>
> On Mon, Nov 11, 2013 at 11:38 AM, Chi Tak Lam  wrote:
> > Is there anyone can help?
> >
> > I think i should do a str.replace(old, new)?
> > but i not sure what i should i set for 'old' and 'new' argument...
> >
> > something like this?
> > "my text".replace(char 30262, '???')
> >
> > On Saturday, November 9, 2013 11:44:53 PM UTC+8, Chi Tak Lam wrote:
> >>
> >> Hi,
> >>
> >> I have a django-celery task to retrieve data from a third party service
> >> and store into my database.
> >> But I found an error in my log file, which is
> >> None: Invalid control character at: line 1134 column 14 (char 30262)
> >>
> >> Not sure what is char 30262, maybe this?
> >> http://www.fileformat.info/info/unicode/char/30262/index.htm
> >>
> >> My question is, how can i solve this problem without skip this records?
> >>
> >> Thanks.
> >
> > --
> > 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/cc611f7e-ea7a-4ac6-827e-da1bef990387%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%3DOU3V%3DKyde8XPLZ0qbThDoc86HQ65Zao2Ad-X4__1Zx5%3DqJQ%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/CAAuoY6PTkzaANMX3ZKztWZDCYei1OneSJW-eQ2NkTWyAFSFE8w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problem with syncdb and multiple databases

2013-11-11 Thread Sells, Fred
I'm using Django 1.5 and Mysql 5.1 and am in the early stages of a multiple app 
development and the schema is changing frequently as "hidden" requirements 
emerge.  I cannot get syncdb to sync anything other than my default db, and 
when I change my default, it still seems to see the old one.   Here is 
settings.py, with some junk removed for brevity.  Routers.py is attached and is 
in the same directory as settings.  I cannot figure out what's going wrong with 
syncdb, but the normal application seems to work correctly.I had commented 
out the "allow_syncdb" in the routers because I could not get it to work, it 
seems to have some impact but not sure what.

settings.py=
DATABASES = {
'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'accstaff'...
},
'wnr': {   'ENGINE': 'django.db.backends.mysql', NAME': 'wnr'...},
'accstaff': {'ENGINE': 'django.db.backends.mysql', 'NAME': 
'accstaff'...},
'inserv': {  'ENGINE': 'django.db.backends.mysql', 'NAME': 'inserv'...}
}

DATABASE_ROUTERS = ['AccWeeklyNursingReport.routers.WnrRouter',
'AccWeeklyNursingReport.routers.AccStaffRouter',
'AccWeeklyNursingReport.routers.AccInservRouter']

=end settings.py===

The following is the output example

C:\all\django\AccWeeklyNursingReport>mysqladmin -f drop  accstaff
Database "accstaff" dropped

C:\all\django\AccWeeklyNursingReport>mysqladmin -f create  accstaff

C:\all\django\AccWeeklyNursingReport>python manage.py  syncdb 
--database=accstaff
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff sessions
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff sessions
allow syncdb for WnrRouter accstaff wnrapp
allow syncdb for WnrRouter accstaff wnrapp
Creating tables ...
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
allow syncdb for WnrRouter accstaff contenttypes
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

C:\all\django\AccWeeklyNursingReport>echo DONE
DONE

-- 
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/DCD75728F460F14586086EA606E83082E71E861F%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


routers.py
Description: routers.py


Re: Auth backends don't work with HttpResponseRedirect and Django 1.4+?

2013-11-11 Thread Hanne Moa
The fix that worked for 1.4.x did not work for 1.5.x.

Only thing that worked for 1.5.x was changing how apache called django, by
setting WSGIDaemonProcess to "processes=1" or removing "processes" entirely
("threads" can be lots more than one). Something has obviously changed in
how django does wsgi but I won't be spending more time trying to find out
why.

-- 
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/CACQ%3DrrcXYdKFJ50V4VJsR%3DbpO1pFUfX5xmOXs_zzd5j4DVC%3DgA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Crispy Forms css_classes

2013-11-11 Thread sbrandt
Hello,

I'm using crispy forms with zurb foundation. Since crispy-forms-foundation 
isn't that advanced, I need to develop it further by myself. So I've 
encountered a problem. I need to change the CSS classes of the surrounding 
div dynamically:








The template (django_crispy_forms/templates/***/field.html) says: 

field.css_classes is always empty. The above HTML has been created with the 
following crispy forms layout:

self.helper.add_layout(Layout(Row(Field('title', css_class='large-12 
columns')), [...] ))

As you can see, the css_class is present in the input, but I need it in the 
div_id_title.

Any ideas?

-- 
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/07f2fbe6-cb74-41cb-b06b-b41e2e8ecf02%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problems with turning on the Admin

2013-11-11 Thread Keith Edmiston
UPDATE: this problem was caused by latent .pyc files on my localhost
machine. Deletion of those removed this issue.

Thanks for the help.

Keith

On Saturday, November 9, 2013, Vincenzo Prignano wrote:

> Sorry but I still can’t see the problem here. You are by the way using an
> old Django version and an old Python version. That’s the only thing I can
> think about right now.
>
> --
> Vincenzo Prignano
> Sent with Sparrow 
>
> On Saturday, November 9, 2013 at 6:53 PM, Keith Edmiston wrote:
>
> Bumping this up once more just in case someone may have any
> thoughts...still a problem that has me stumped. Thanks, in advance, for
> ideas.
>
> Keith
>
> On Friday, November 8, 2013, Keith Edmiston wrote:
>
> bus/certs/urls.py:
>
> from django.conf.urls import patterns, url, include
> from django.conf import settings
> from bus.certs.views import index
>
> from django.contrib import admin
> admin.autodiscover()
> urlpatterns = patterns('',
>(r'^apps/bus/certs/$', index),
>(r'^apps/bus/certs/index$', index),
>(r'^apps/bus/certs/listing/',
> include('bus.certs.listing.urls')),
>(r'^apps/bus/certs/application/',
> include('bus.certs.application.urls')),
>(r'^apps/bus/certs/admin/',
> include(admin.site.urls)),
>)
>
> bus/certs/listing/urls.py:
>
> from django.conf.urls import patterns, url, include
> from django.conf import settings
> from listing.views import listing
>
> # Uncomment the next two lines to enable the admin:
> # from django.contrib import admin
> # admin.autodiscover()
> urlpatterns = patterns('bus.certs.listing.views',
>(r'^$', listing, {}, 'listing'),
>)
>
> bus/certs/application/urls.py:
>
> from django.conf.urls import patterns, url, include
> from django.conf import settings
> from application.views import application_view, application_submit,
> application_update
>
> # Uncomment the next two lines to enable the admin:
> #from django.contrib import admin
> #admin.autodiscover()
>
> urlpatterns = patterns('bus.certs.application.views',
>(r'^(?P\d+)/$', application_view, {},
> 'application_view'),
>(r'^update/(?P\d+)/$', application_update,
> {}, 'application_update'),
>(r'^submit/$', application_submit, {},
> 'application_submit'),
>#(r'^admin/', include(admin.site.urls)),
>)
>
>
> On Fri, Nov 8, 2013 at 12:20 PM, Vincenzo Prignano <
> vincenzo.prign...@gmail.com> wrote:
>
> Can you post the line in urls.py that is calling the view function?
>
>
> On Friday, November 8, 2013 6:48:28 PM UTC+1, Keith Edmiston wrote:
>
> Sorry...I was trying to be careful of not putting so much info in the
> email that it became too much.
>
> My project structure is (in part):
> --bus/certs
> |_ application
>   |_ __init__
>   |_ models.py --> empty, using common/models.py & bus_models/models.py
>   |_ urls.py
>   |_ views.py
>
> |_ bus_models (svn: externals)
>   |_ __init__
>   |_ models.py --> Person
>
> |_ bus_shared_common (svn: externals)
>   |_ __init__
>   |_ static (css, js, etc.)
>   |_ templates
>
> |_ common
>   |_ __init__
>   |_ models.py --> Program, Status, Application, Notes, Action,
> Correspondence
>
> |_ listing
>   |_ __init__
>   |_ models.py --> empty, using common/models.py & bus_models/models.py
>   |_ urls.py --> only one regex so far..."listing", which calls
> "listing" in views.py
>   |_ views.py --> "listing" function
>
> So, in answer to your question Vincenzo, bus.certs.listing does not make a
> call to any model just yet.  Thanks for suggesting I look though.
>
> Keith
>
>
> On Fri, Nov 8, 2013 at 10:39 AM, Vincenzo Prignano 
> wrote:
>
> 'bus.certs.listing' is this entry in your installed apps referring to the
> "Listing" models perhaps? We can't really help you with much more info btw.
>
>
> On Friday, November 8, 2013 4:55:04 PM UTC+1, Keith Edmiston wrote:
>
>  --
> 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/kP88FP75liE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com  'django-users+unsubscr...@googlegroups.com');>.
> To post to this group, send email to 
> django-users@googlegroups.com '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/CAP_gv7Kw0ZO95QyOgP6ucoYrbYoWbzQ-Krj0Pzn35e71AyXzUw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> Yo