Re: Seeking reviewers for a "Guide to Idiomatic Django Deployment"

2013-11-06 Thread pnichols104
This sounds great!  I'm still learning myself (coming up on 2 years 
experience) so I'm a little hesitant to volunteer to offer opinions on 
content, but I'm an excellent proofreader and would love to help out.  I 
talk English much good and spel grate.

Best,
Paul

On Tuesday, November 5, 2013 7:34:05 PM UTC-5, George London wrote:
>
> Hi All!
>
> As a fairly recently self-taught Djangonaut, I was a bit dissatisfied with 
> the existing resources for learning to deploy Django in a production 
> setting. There are lots of blog posts about how to configure specific 
> services but really not much that recommends which services to use or how 
> to bring everything together (except for guides like 
> http://www.deploydjango.com/ that recommend just using Heroku.)
>
> I think it would be really helpful for new-comers to have a clear, 
> opinionated guide to "commonly accepted (i.e. idiomatic)" deployment best 
> practices. Or at least I know it would have really helped me.
>
> So I decided to write such a guide. I'm painfully aware that it's 
> presumptuous for someone with my limited experience to make "best 
> practices" recommendations. So to avoid recommending things that are dumb,
> * I'm hoping some of our community's heavy weights could heavy-weigh in 
> and verify that my recommendations make sense.*
>
> I've got a full draft prepared. *If you'd be interested in reviewing it 
> (or can recommend someone I should ask directly), please email me directly.
> *
>
> -George
>
>
> -- 
> ---
> George London
> E: george@gmail.com 
> T: @rogueleaderr 
> B: rogueleaderr.com
> --- 
>

-- 
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/11287e95-a251-481d-a761-0457aa32f8a0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Issues saving a formset form with multiple forms.

2013-11-07 Thread pnichols104
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 return render_to_response('create_object.html', {'Post_Form': 
> pform, 'Comment_Form': cforms},
>  87 context_instance=RequestContext(request)
>  88 )
>
> *Template:*
>   1 {% extends "base.html" %}
>   2
>   3 {% block content %}
>   4 
>   5
> # Irrelevent to the form.
>  11
>  12 
>  13
>  14  accept-ch>
>  15 {% csrf_token %}
>  16 {{ form.as_p }}
>  17
>  18 Enter a name and description for the post: 
>  19 {{ Post_Form }} 
>  20 Enter one or more Comments:
>  21 {% for mform in Comment_Form %}
>  22 Comment: {{ cform }}
>  23 {% endfor %}
>  24 
>  25 
>  26 
>  27
>  28 {% endblock %}
> ~
>
> I'd really appreciate any help here as i've been hitting my head against 
> this for a week or so now, would particularly appreciate examples as my 
> python/django skills are novice and it'll help me understand.
>
> Thanks for your time/help!
> Jason
>

-- 
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, s

Django tables 2 with django-autocomplete-light

2013-11-15 Thread pnichols104
I'm trying to populate a django table with autocomplete light so that the 
user can fill in data in the table, which would then be saved (the whole 
table is in a form tag).  I have the table working to display the existing 
data and I have the autocomplete working in model forms (well, a team 
member got that part working), but I don't know how to combine the two. 
 The docs are a bit of a mystery to me, but maybe if someone could at least 
point me in the right direction I'd greatly appreciate it.

-- 
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/8f04a2a7-d511-4533-b0e9-9177c5437349%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django tables 2 with django-autocomplete-light

2013-11-19 Thread pnichols104
I'll check it out--thanks!

On Friday, November 15, 2013 5:47:29 PM UTC-5, somecallitblues wrote:
>
> I have used datatables js for editable tables. Look up datatables jQuery 
> and you'll find a nice demo and a code example of how to implement them. 
> They also provide Ajax post when you press enter key, so all you have to do 
> is to hook it into your django view. Writing on phone so can't supply links 
> and examples. Sorry
> M
> On 16/11/2013 8:26 AM, > wrote:
>
>> I'm trying to populate a django table with autocomplete light so that the 
>> user can fill in data in the table, which would then be saved (the whole 
>> table is in a form tag).  I have the table working to display the existing 
>> data and I have the autocomplete working in model forms (well, a team 
>> member got that part working), but I don't know how to combine the two. 
>>  The docs are a bit of a mystery to me, but maybe if someone could at least 
>> point me in the right direction I'd greatly appreciate it.
>>
>> -- 
>> 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/8f04a2a7-d511-4533-b0e9-9177c5437349%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/a2118b0b-2504-4971-b0fd-672be8e7f656%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.