Django storage engine

2013-11-07 Thread Harjot Mann
Is using the InnoDb storage engine as default as per my knowledge in
MySql MyISAM is the default storage engine.

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

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


Saving an inline view and executing an aggregating function only once

2013-11-07 Thread Victor
I made an effort to simplify my app and translate it into English.
Here it is
=
models.py 
.
class Items(models.Model):
code = models.CharField(primary_key=True,max_length=15,db_column='code')
description = models.CharField(max_length=255, db_column='Description', 
db_index=True)
category = models.IntegerField(choices=categoria, 
db_column='Category',default=2)

total_quantity_in_store=models.IntegerField(db_column='total_quantity_in_store',
 default=0)
def __unicode__(self):
return self.description
class Meta:
db_table = u'Items'
 
class Order(models.Model):
id_order = models.IntegerField(primary_key=True,db_column='id_order')
patient = models.ForeignKey(Patients, db_column='patient')
def __unicode__(self):
return u"Ord.%s per %s" % (self.id_order, self.paziente)
class Meta:
db_table = u'Order'

post_save.connect(TotalInStore, sender=Order)

class OrderDetail(models.Model):
   id_order = models.ForeignKey(Order,db_column='id_order')
   item_code = models.ForeignKey(Items,verbose_name='Items')
   quantity = models.IntegerField(db_column='quantity',blank=True,default=0)
class Meta:
db_table = u'OrderDetail'
==
admin.py
..
class OrderDetailInline(admin.TabularInline):
model=OrderDetail
raw_id_fields = ['item_code',]
fields=('item_code', 'quantity',)

class OrderOption(admin.ModelAdmin):
readonly_fields = ['order_id', 'patient']
list_display = ( 'patient','order_id')
fields=( 'order_id', 'patient')
inlines=[OrderDetailInline,]

admin.site.register(Order,OrderOption)

=
signals.py
def ExecuteQuery(query):
from django.db import connection
cursor=None
cursor= connection.cursor()
cursor.execute(query, [])
return cursor.fetchall()

def TotalInStore(sender,**kwargs):

ItemsInOrder = """SELECT item_code_id as code,SUM(quantity) as total
FROM OrderDetail
GROUP BY item_code_id
ORDER BY item_code_id"""
SUMS = ExecuteQuery(ItemsInOrder)
if SUMS:
   [Items.objects.filter(pk=t[0]).update(total_quantity_in_store=int(t[1])) 
for t in SUMS]
.
return

To put it in a nutshell my Django 1.5.5 app 1):records the quantities of 
medical items given to patients of a medical center by means of  an inline view 
that connects 'OrderDetail' to 'Order', 2):  then input in the field 
total_quantity_in_store of the model 'Items' the sum of the field quantity 
('OrderDetail') aggregated by item code via a post_save signal calling the 
TotalInStore function.
It works happily BUT  unfortunately with the increasing numbers of record 
in 'OrderDetail' it is (and will be obviously) becoming slower and slower.  
This is due to the fact that the post_save signal - aggregating the quantities 
- by code is called for EACH OrderDetail record I have input in the inline view 
while it will be more logical to execute it ***after*** all records of the 
inline view have been saved.
 
Please help me modify my app so that the TotalInStore function is called only 
once after the inline view Order-OrderDetail has been saved.

Ciao
Vittorio

-- 
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/ED9F8BF6-24E4-49F2-9721-5FAECDFBABA6%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django storage engine

2013-11-07 Thread François Schiettecatte
Hi

InnoDB is the default storage engine in MySQL from version 5.5 onwards.

I would not recommend using MyISAM for anything other than archive tables, the 
table level locking on any update is a serious bottleneck.

Cheers

François



On Nov 7, 2013, at 3:15 AM, Harjot Mann  wrote:

> Is using the InnoDb storage engine as default as per my knowledge in
> MySql MyISAM is the default storage engine.
> 
> -- 
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.com/
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/
> 
> -- 
> 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/CAB0GQhDfLpAKO6FzHzhFFgFG3v%2BsGmrYPj8YEaGtKy8DJrm-iw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Django storage engine

2013-11-07 Thread Roberto López López

Which is the question?

On 07. nov. 2013 09:15, Harjot Mann wrote:

Is using the InnoDb storage engine as default as per my knowledge in
MySql MyISAM is the default storage engine.



--
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/527B6400.70705%40uni.no.
For more options, visit https://groups.google.com/groups/opt_out.


Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Robert Jonathan Šimon
I search for how can i do this, but i didnt find anything. Can you help me? 
It would be great if it can be on IIS 7.5

-- 
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/715d021d-77a5-4d2c-b99d-7d9efc72e304%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Timothy W. Cook
Did you see this:
https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/#

On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Šimon
 wrote:
> I search for how can i do this, but i didnt find anything. Can you help me?
> It would be great if it can be on IIS 7.5
>
> --
> 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/715d021d-77a5-4d2c-b99d-7d9efc72e304%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%3DOU3Uj29zDW-%3D2Q3ib7zn44spOaJ29Q7A7WiAk_4BmqAn9Kw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Issues saving a formset form with multiple forms.

2013-11-07 Thread Jason S
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 
 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, 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/ea275b34-81d6-4a05-9c7c-18620b1b892c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Robert Jonathan Šimon
I still dont now how i can install Django into IIS.


On Thu, Nov 7, 2013 at 11:21 AM, Timothy W. Cook  wrote:

> Did you see this:
> https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/#
>
> On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Šimon
>  wrote:
> > I search for how can i do this, but i didnt find anything. Can you help
> me?
> > It would be great if it can be on IIS 7.5
> >
> > --
> > 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/715d021d-77a5-4d2c-b99d-7d9efc72e304%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 a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/9SzSCZWYwOk/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/CA%2B%3DOU3Uj29zDW-%3D2Q3ib7zn44spOaJ29Q7A7WiAk_4BmqAn9Kw%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/CALsvuc%2BoGv-7rS7gr5jj8C_ZGvYihPHg_famEdY8F3S9z%2B-j%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANNOUNCE] Django 1.6 and Django 1.4.10 released

2013-11-07 Thread Mário Neto
Thanks for all! =)


2013/11/6 wudiweb 

> Thanks for all contributors
>
> 在 2013年11月6日星期三UTC+8下午11时09分45秒,James Bennett写道:
>
>> Django 1.6 and Django 1.4.10 are out today; the latter is a bugfix
>> release to restore Python 2.5 compatibility in the 1.4 series.
>>
>> Full details are in the blog post:
>>
>> https://www.djangoproject.com/weblog/2013/nov/06/django-16-released/
>>
>  --
> 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/b1715b43-ca4c-4c17-8863-beca7501fcdd%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Att. *Mário Araújo Chaves Neto*
*Programmer, Designer and U.I. Engineer*

*MBA in Design Digital* - 2008 - FIC
*Analysis and Systems Development* - 2011 - Estácio
*D**esign and Implementation of Internet Environments* - 2003 - FIC

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


Re: [ANNOUNCE] Django 1.6 and Django 1.4.10 released

2013-11-07 Thread Sithembewena Lloyd Dube
Thank you to everyone who's making this framework better :)


On Thu, Nov 7, 2013 at 1:30 PM, Mário Neto  wrote:

> Thanks for all! =)
>
>
> 2013/11/6 wudiweb 
>
>> Thanks for all contributors
>>
>> 在 2013年11月6日星期三UTC+8下午11时09分45秒,James Bennett写道:
>>
>>> Django 1.6 and Django 1.4.10 are out today; the latter is a bugfix
>>> release to restore Python 2.5 compatibility in the 1.4 series.
>>>
>>> Full details are in the blog post:
>>>
>>> https://www.djangoproject.com/weblog/2013/nov/06/django-16-released/
>>>
>>  --
>> 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/b1715b43-ca4c-4c17-8863-beca7501fcdd%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Att. *Mário Araújo Chaves Neto*
> *Programmer, Designer and U.I. Engineer*
>
> *MBA in Design Digital* - 2008 - FIC
> *Analysis and Systems Development* - 2011 - Estácio
> *D**esign and Implementation of Internet Environments* - 2003 - FIC
>
> --
> 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/CAJthOzDVtAct8gwa1g92f_865kycAnY7eBPtTerQ%3DAROpab93w%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Regards,
Sithu Lloyd Dube

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


Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Mike Dewhirst

On 7/11/2013 9:34pm, Robert Jonathan Šimon wrote:

I still dont now how i can install Django into IIS.


If you decide to use IIS you will find very few people able to help you 
if things go wrong. From a practical perspective, it would be safer to 
use Apache in your Django stack.


However, you don't need either IIS or Apache during development. Django 
comes with its own server for development purposes. This lets you 
sensibly postpone your production webserver decision until you are ready 
to deploy.


Your question in the subject line is easy to answer. Django 1.6 has just 
been released so go with that. Python 3.3 is better than 2.7 unless you 
need libraries which are only available for 2.7. Happily, things are 
changing fast in favour of 3.3.


Good luck

Mike




On Thu, Nov 7, 2013 at 11:21 AM, Timothy W. Cook mailto:t...@mlhim.org>> wrote:

Did you see this:
https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/#

On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Å imon
mailto:bertiks...@gmail.com>> wrote:
 > I search for how can i do this, but i didnt find anything. Can
you help me?
 > It would be great if it can be on IIS 7.5
 >
 > --
 > 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/715d021d-77a5-4d2c-b99d-7d9efc72e304%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 a topic in
the Google Groups "Django users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/django-users/9SzSCZWYwOk/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/CA%2B%3DOU3Uj29zDW-%3D2Q3ib7zn44spOaJ29Q7A7WiAk_4BmqAn9Kw%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/CALsvuc%2BoGv-7rS7gr5jj8C_ZGvYihPHg_famEdY8F3S9z%2B-j%2BQ%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/527B8A31.8040905%40dewhirst.com.au.
For more options, visit https://groups.google.com/groups/opt_out.


Django (cache?) make some mistake with formset generated class

2013-11-07 Thread Bastien Sevajol
Hello, i don't know if it's a django or python problem. But i correct a 
strange bug and would know why my code was bugging and if it was django, 
python, or me. The situation (and solution) is exposed 
herebut
 i reproduce it here:

I've two page, each of one display a form and a formset. They have same 
code logic:

*views*

> from django.forms.models import inlineformset_factoryfrom 
> djStock.stock.models import MyAModelfrom djStock.stock.forms.MyAModelForm 
> import MyAModelFormfrom djStock.stock.models import MyBModelfrom 
> djStock.stock.forms.MyBModelForm import MyBModelForm
> def a_create(request):
>
>   form = MyAModelForm()
>   formset_factory = inlineformset_factory(MyAModel, MyAModel.things.through)
>   formset = formset_factory()
>   [...]
> def b_create(request):
>
>   form = MyBModelForm()
>   formset_factory = inlineformset_factory(MyBModel, MyBModel.things.through)
>   formset = formset_factory()
>   [...]
>
> (With this code, all work fine) So i made refactoring and write some class 
(i removed unecessary code for exemple):

*ModelFormsetManager*

> from django.forms.models import inlineformset_factory
> class ModelFormsetManager(object):
>
>   form = None
>   formsets = {}
>
>   def initialize_formset(self, name, entity, related_entity):
> self.formsets[name] = inlineformset_factory(entity, related_entity)
>
> # for debug at the end of question
> print self.formsets[name]
>
>   def __init__(self, request, form_class):
> if request.method == 'POST':
>   [...]
> else:
>   self.form = form_class()
>   for formset_name, formset in self.formsets.iteritems():
>
> # for debug at the end of question
> print formset
>
> self.formsets[formset_name] = formset()
>
> *
*

*MyAModelManager*

> from ..models import MyAModelfrom ..forms.MyAModelForm import 
> MyAModelFormfrom djStock.stock.managers.ModelFormsetManager import 
> ModelFormsetManager
> class MyAModelManager(ModelFormsetManager):
>
>   def __init__(self, request):
> self.initialize_formset('things', MyAModel, MyAModel.things.through)
> super(MyAModelManager, self).__init__(request, MyAModelForm)
>
> *MyBModelManager*

> from ..models import MyBModelfrom ..forms.MyBModelForm import 
> MyBModelFormfrom djStock.stock.managers.ModelFormsetManager import 
> ModelFormsetManager
> class MyBModelManager(ModelFormsetManager):
>
>   def __init__(self, request):
> self.initialize_formset('things', MyBModel, MyBModel.references.through
> super(MyBModelManager, self).__init__(request, MyBModelForm)
>
>
With this refactoring my views look like:

> def a_create(request):
>   a_manager = MyAModelManager(request=request)
>   [...]
> def b_create(request):
>   b_manager = MyBModelManager(request=request)
>   [...]
>
>  

Okay, now the strange bug (keep in mind one thing: actions order is 
important): 

   - When i load *a_create* view, all is displayed correctly (reloading 
   page to). 

Prints displays that:

>  'django.forms.formsets.MyAModelThingFormFormSet'>
>
>
   - I load *b_create* view, an error raised.

Prints displays that:

>  'django.forms.formsets.MyBModelThingFormFormSet'>
>
>
And error is:

> File 
> "/home/bux/.python/envs/djStock/local/lib/python2.7/site-packages/django/core/handlers/base.py",
>  line 115, in get_response
> response = callback(request, *callback_args, **callback_kwargs)
>   File "/home/bux/Private/projets/djStock/stock/views/b.py", line 28, in 
> b_create
> b_manager = MyBModelManager(request=request)
>   File 
> "/home/bux/Private/projets/djStock/../djStock/stock/managers/MyBModelManager.py",
>  line 9, in __init__
> super(MyBModelManager, self).__init__(request, MyBModelForm)
>   File 
> "/home/bux/Private/projets/djStock/../djStock/stock/managers/ModelFormsetManager.py",
>  line 31, in __init__
> self.formsets[formset_name] = formset()TypeError: 
> 'MyAModelThingFormFormSet' object is not callable
>
> *Important note*: At "formset()" django is trying to call My 
> *A*ModelThingFormFormSet whereas My 
*B* ModelThingFormFormSet (print confirm it showing 
MyBModelThingFormFormSet). That's one of strange point.

   - 
   
   If i reload *b_create* view, same error. If i reload *a_create* view 
   it's always working.
   - 
   
   I turn off *python manage.py runserver |...]* and run it again
   - 
   
   I load *b_create* view (previously rasing error), now it's *working*.
   
Prints displays that:

>  'django.forms.formsets.MyBModelThingFormFormSet'>
>
>
   - I load *a_create* view (previously working), now it is *not* working.

Prints displays that:

>  'django.forms.formsets.MyAModelThingFormFormSet'>
>
> And error is:

> Traceback (most recent call last):
>   File 
> "/home/bux/.python/envs/djStock/local/lib/python2.7/site-packages/django/core/handlers/base.py",
>  line 115, in get_response
> response = callback(request, *call

Invitations Apps

2013-11-07 Thread Rafael E. Ferrero
Has someone used some invitation app for django like django-invitation
[1]... and more, has someone integrated something like that with AllAuth
[2] ??

In a project I need visitors to register on the site with their social
accounts. Once registered the system will create a group which will own. Then
the owner of the group may invite people to integrate this group.
Those who respond
to the invitation may log in with their social accounts too. Guests can not
create groups, because they are guests.

Someon has some tips for me?

Thanks a lot!


[1] https://bitbucket.org/david/django-invitation/wiki/Home
[2] https://github.com/pennersr/django-allauth


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


Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Robert Jonathan Šimon
OK thank you, i need a real server, because a already created aplication (a
part) and i want to deliver to the internet. So best solution is Apache.
How can i install it with django 1.5 and python 3.3?


On Thu, Nov 7, 2013 at 1:40 PM, Mike Dewhirst  wrote:

> On 7/11/2013 9:34pm, Robert Jonathan Šimon wrote:
>
>> I still dont now how i can install Django into IIS.
>>
>
> If you decide to use IIS you will find very few people able to help you if
> things go wrong. From a practical perspective, it would be safer to use
> Apache in your Django stack.
>
> However, you don't need either IIS or Apache during development. Django
> comes with its own server for development purposes. This lets you sensibly
> postpone your production webserver decision until you are ready to deploy.
>
> Your question in the subject line is easy to answer. Django 1.6 has just
> been released so go with that. Python 3.3 is better than 2.7 unless you
> need libraries which are only available for 2.7. Happily, things are
> changing fast in favour of 3.3.
>
> Good luck
>
> Mike
>
>
>>
>> On Thu, Nov 7, 2013 at 11:21 AM, Timothy W. Cook > > wrote:
>>
>> Did you see this:
>> https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/#
>>
>> On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Å imon
>>
>> mailto:bertiks...@gmail.com>> wrote:
>>  > I search for how can i do this, but i didnt find anything. Can
>> you help me?
>>  > It would be great if it can be on IIS 7.5
>>  >
>>  > --
>>  > 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/715d021d-
>> 77a5-4d2c-b99d-7d9efc72e304%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 a topic in
>> the Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/
>> 9SzSCZWYwOk/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/CA%2B%3DOU3Uj29zDW-%
>> 3D2Q3ib7zn44spOaJ29Q7A7WiAk_4BmqAn9Kw%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/CALsvuc%
>> 2BoGv-7rS7gr5jj8C_ZGvYihPHg_famEdY8F3S9z%2B-j%2BQ%40mail.gmail.com.
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
> --
> 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/9SzSCZWYwOk/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/527B8A31.8040905%40dewhirst.com.au.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this me

Django 1.6 transactions witn multiple databases

2013-11-07 Thread Vaal
Hi
How to be in 1.6 with queries that involve multiple databases?
Previously recommended to create custom TransactionMiddleware. It was 
convenient. Now TransactionMiddleware is deprecated.

-- 
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/b01608ac-2eff-4409-ad69-eae35b8cf59a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django 1.6 transactions witn multiple databases

2013-11-07 Thread Vaal
err
queries = requests

-- 
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/4cd3f9fe-c4a5-4e7d-a77f-b781b06410f7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


foreign key within a manytomany within a model in admin

2013-11-07 Thread MikeKJ
Sorry didnt know how else to describe what I am trying to do

I have 3 models

Advice

AdviceLevel

Organisation

So the idea is:

An organisation can dispense more than 1 advice:

class Organsiation(models.Model):
title = models.CharField(max_length=150)
advice = models.ManyToManyField(Advice)

Ok BUT each advice subject within an organsiation needs to be graded as to 
a level capability 1 to 4
So in the model how can I effectively tie a foreign key to each advice 
selected in the ManyToMany field call?

Cheers for any enlightement



-- 
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/a17d0371-7dea-4863-9326-894b35ccffb5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django (cache?) make some mistake with formset generated class

2013-11-07 Thread Simone Federici
On Thu, Nov 7, 2013 at 11:54 AM, Bastien Sevajol
wrote:

> formsets = {}


this class variable is in ModelFormsetManager class namespace
so it is shared across the subclasses.

You are using formsets to save before the object class, and after the
instances,
so when in the formset there is the instance of the last "view", and you
try to call it
create the instance of an class works, call the instance return object is
not callable exception

your last solution solve only apparently the superclass-namespace issue.


regards

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


AbstractBaseUser with a foreignkey...

2013-11-07 Thread Vanni Brutto
i'm trying to use AbstractBaseUser to extend the user model...

i used the code found on django pages, the only difference is that i use a 
foreignkey to "Sistema" models.
The originale code is on django pages: 
https://docs.djangoproject.com/en/dev/topics/auth/customizing/

my changes was:

[...]
class Sistema(models.Model):
models.ForeignKey(settings.AUTH_USER_MODEL)
nome = models.CharField(max_length=80)
def __unicode__(self):
return self.nome
class Meta:
verbose_name_plural = "Sistemi"

[...]

class MyUser(AbstractBaseUser):
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
db_index=True,
)
date_of_birth = models.DateField()
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)

TIPO_CHOICES = (
('C', 'Cameriere'),
('G', 'Guest'),
('A', 'Admin'),
)
tipo = models.CharField(max_length=1, choices=TIPO_CHOICES, default="C")
sistema = models.ForeignKey(Sistema)



when create the db with syncdb i got:
ds\createsuperuser.py", line 116, in handle
user_data[field_name] = field.clean(raw_value, None)
  File 
"C:\apps\Python27\Lib\site-packages\django\db\models\fields\__init__.py",
 line 255, in clean
self.validate(value, model_instance)
  File 
"C:\apps\Python27\Lib\site-packages\django\db\models\fields\related.py",
line 1189, in validate
using = router.db_for_read(model_instance.__class__, 
instance=model_instance
)
  File "C:\apps\Python27\Lib\site-packages\django\db\utils.py", line 250, 
in _ro
ute_db
return hints['instance']._state.db or DEFAULT_DB_ALIAS
AttributeError: 'NoneType' object has no attribute '_state'

C:\apps\xampp\htdocs\py\comanda>

-- 
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/613accd8-7c49-42e0-9793-776eac175ee4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Harry Houdini
You will want to use mod_wsgi:

https://code.google.com/p/modwsgi/


On Thursday, November 7, 2013 8:33:12 AM UTC-5, Robert Jonathan Šimon wrote:
>
> OK thank you, i need a real server, because a already created aplication 
> (a part) and i want to deliver to the internet. So best solution is Apache. 
> How can i install it with django 1.5 and python 3.3?
>
>
> On Thu, Nov 7, 2013 at 1:40 PM, Mike Dewhirst 
> 
> > wrote:
>
>> On 7/11/2013 9:34pm, Robert Jonathan Šimon wrote:
>>
>>> I still dont now how i can install Django into IIS.
>>>
>>
>> If you decide to use IIS you will find very few people able to help you 
>> if things go wrong. From a practical perspective, it would be safer to use 
>> Apache in your Django stack.
>>
>> However, you don't need either IIS or Apache during development. Django 
>> comes with its own server for development purposes. This lets you sensibly 
>> postpone your production webserver decision until you are ready to deploy.
>>
>> Your question in the subject line is easy to answer. Django 1.6 has just 
>> been released so go with that. Python 3.3 is better than 2.7 unless you 
>> need libraries which are only available for 2.7. Happily, things are 
>> changing fast in favour of 3.3.
>>
>> Good luck
>>
>> Mike
>>
>>  
>>>
>>> On Thu, Nov 7, 2013 at 11:21 AM, Timothy W. Cook 
>>> 
>>> > wrote:
>>>
>>> Did you see this:
>>> 
>>> https://docs.djangoproject.**com/en/1.6/howto/auth-remote-**user/#
>>>
>>> On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Å imon
>>>
>>>  
>>> > 
>>> wrote:
>>>  > I search for how can i do this, but i didnt find anything. Can
>>> you help me?
>>>  > It would be great if it can be on IIS 7.5
>>>  >
>>>  > --
>>>  > 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  >> 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/715d021d-**
>>> 77a5-4d2c-b99d-7d9efc72e304%**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 a topic in
>>> the Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/**topic/django-users/**
>>> 9SzSCZWYwOk/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, 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/CA%2B%**
>>> 3DOU3Uj29zDW-%**3D2Q3ib7zn44spOaJ29Q7A7WiAk_**4BmqAn9Kw%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...@**googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit t

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

Re: Django 1.5 or Django 1.6 with python 3.3 on windos Server 2008

2013-11-07 Thread Timothy W. Cook
RTFM: https://docs.djangoproject.com/search/?q=Apache

It is very good.


On Thu, Nov 7, 2013 at 11:33 AM, Robert Jonathan Šimon
 wrote:
> OK thank you, i need a real server, because a already created aplication (a
> part) and i want to deliver to the internet. So best solution is Apache. How
> can i install it with django 1.5 and python 3.3?
>
>
> On Thu, Nov 7, 2013 at 1:40 PM, Mike Dewhirst  wrote:
>>
>> On 7/11/2013 9:34pm, Robert Jonathan Šimon wrote:
>>>
>>> I still dont now how i can install Django into IIS.
>>
>>
>> If you decide to use IIS you will find very few people able to help you if
>> things go wrong. From a practical perspective, it would be safer to use
>> Apache in your Django stack.
>>
>> However, you don't need either IIS or Apache during development. Django
>> comes with its own server for development purposes. This lets you sensibly
>> postpone your production webserver decision until you are ready to deploy.
>>
>> Your question in the subject line is easy to answer. Django 1.6 has just
>> been released so go with that. Python 3.3 is better than 2.7 unless you need
>> libraries which are only available for 2.7. Happily, things are changing
>> fast in favour of 3.3.
>>
>> Good luck
>>
>> Mike
>>
>>>
>>>
>>> On Thu, Nov 7, 2013 at 11:21 AM, Timothy W. Cook >> > wrote:
>>>
>>> Did you see this:
>>> https://docs.djangoproject.com/en/1.6/howto/auth-remote-user/#
>>>
>>> On Thu, Nov 7, 2013 at 8:18 AM, Robert Jonathan Å imon
>>>
>>> mailto:bertiks...@gmail.com>> wrote:
>>>  > I search for how can i do this, but i didnt find anything. Can
>>> you help me?
>>>  > It would be great if it can be on IIS 7.5
>>>  >
>>>  > --
>>>  > 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/715d021d-77a5-4d2c-b99d-7d9efc72e304%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 a topic in
>>> the Google Groups "Django users" group.
>>> To unsubscribe from this topic, visit
>>>
>>> https://groups.google.com/d/topic/django-users/9SzSCZWYwOk/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/CA%2B%3DOU3Uj29zDW-%3D2Q3ib7zn44spOaJ29Q7A7WiAk_4BmqAn9Kw%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/CALsvuc%2BoGv-7rS7gr5jj8C_ZGvYihPHg_famEdY8F3S9z%2B-j%2BQ%40mail.gmail.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>> --
>> 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/9SzSCZWYwOk/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/g

Problem with Oauth and 1.6

2013-11-07 Thread Saurabh Ganeriwal
I have a backend that is build on rest framework and uses python social 
auth for Google OAuth2 authentication. The app suddenly stopped working 
yesterday. And after spending a day the problem seems to be django 1.6. 

Following combination seems to work properly:

Django - 1.5.5
Django rest framework - 2.3.8
python-social-auth-0.1.15

Without changing any code and simply migrating to 1.6 breaks Oauth. The 
failure which I see is also a little weird. It completes the process and I 
can the token generated and written to the database. I can see the cookie 
being sent properly. But somehow it keeps on saying "Authentication 
credentials not provided" and error 403.

thanks,
saurabh

-- 
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/18c6c4b0-5368-40b5-bb76-23808a9c238b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: foreign key within a manytomany within a model in admin

2013-11-07 Thread MikeKJ
Think this may be a solution:

Models: Advice, AdviceLevel, Organisation

class Organsiation(models.Model):
title = models.CharField(max_length=150)
advice = models.ManyToManyField(Advice, through='AdviceLevel')
 
class AdviceLevel(models.Model):
advice = models.ForeignKey(Advice)
organisation = models.ForeignKey(Organisation)
level = models.IntegerField()

any comments?


-- 
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/ff331c17-0926-483f-969e-8ede6bf412b0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django debugger

2013-11-07 Thread Andrew Farrell
It is possible to use pdb (or ipdb: https://pypi.python.org/pypi/ipdb) by 
inserting a set_trace() call and then running the django dev server with 
`manage.py runserver`. For example, the following will print the number of 
database queries before and then after a function which touches the 
database and, drop you into the pdb shell. This of course causes the server 
to block.

from django.db import connection
import pdb

print len(connection.queries)
structure = get_data()
print len(connection.queries)
pdb.set_trace()



On Tuesday, November 5, 2013 1:29:28 PM UTC-5, Harjot Mann wrote:
>
> I want to know that how can we debug django applications? 
> I got pdb but I think in this some commands are need to use and then I 
> come to know about pycharm. 
> Is it good? 
> I successfully installed it but dont' know how to use it? 
> Anyone please help me.. 
> -- 
> Harjot Kaur Mann 
> Blog: http://harjotmann.wordpress.com/ 
> Daily Dairy: http://harjotmann.wordpress.com/daily-diary/ 
>

-- 
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/a9cd55db-843a-4f44-b8b0-3549d120611f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problem with Oauth and 1.6

2013-11-07 Thread Thomas Murphy
What's the full 403 response header?

On Thu, Nov 7, 2013 at 10:27 AM, Saurabh Ganeriwal
 wrote:
> I have a backend that is build on rest framework and uses python social auth
> for Google OAuth2 authentication. The app suddenly stopped working
> yesterday. And after spending a day the problem seems to be django 1.6.
>
> Following combination seems to work properly:
>
> Django - 1.5.5
> Django rest framework - 2.3.8
> python-social-auth-0.1.15
>
> Without changing any code and simply migrating to 1.6 breaks Oauth. The
> failure which I see is also a little weird. It completes the process and I
> can the token generated and written to the database. I can see the cookie
> being sent properly. But somehow it keeps on saying "Authentication
> credentials not provided" and error 403.
>
> thanks,
> saurabh
>
> --
> 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/18c6c4b0-5368-40b5-bb76-23808a9c238b%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Sincerely,
Thomas Murphy
Code Ninja
646.957.6115

-- 
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/CAEcwjcyQizcZ%2BzL3r%3DCQEM8qy9JdsMipuNy%3DibzJE%3DmZ2gdHcQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django debugger

2013-11-07 Thread Harjot Mann
On Thu, Nov 7, 2013 at 11:35 PM, Andrew Farrell  wrote:
> It is possible to use pdb (or ipdb: https://pypi.python.org/pypi/ipdb) by
> inserting a set_trace() call and then running the django dev server with
> `manage.py runserver`. For example, the following will print the number of
> database queries before and then after a function which touches the database
> and, drop you into the pdb shell. This of course causes the server to block.


But I want that when my application runs, I can see all the queries
running from my browser, like apache log file is there. Is it possible
to view the sql queries working at the backend of django from browser
directly?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

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


Re: Invitations Apps

2013-11-07 Thread Rafael E. Ferrero
No body can help me?


2013/11/7 Rafael E. Ferrero 

>
> Has someone used some invitation app for django like django-invitation
> [1]... and more, has someone integrated something like that with AllAuth
> [2] ??
>
> In a project I need visitors to register on the site with their social
> accounts. Once registered the system will create a group which will own. Then
> the owner of the group may invite people to integrate this group. Those
> who respond to the invitation may log in with their social accounts too.
> Guests can not create groups, because they are guests.
>
> Someon has some tips for me?
>
> Thanks a lot!
>
>
> [1] https://bitbucket.org/david/django-invitation/wiki/Home
> [2] https://github.com/pennersr/django-allauth
>
>
> --
> Rafael E. Ferrero
>



-- 
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_8VPiVQqWRng-tSmnBndLyp%2B2CSSxjeb8%2BmNhWLMinLanw%40mail.gmail.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 Jason S
Hi Paul,
Thanks, now you mention it and I look at it again it seems obvious, can't 
see the wood for the trees moment.
Funnily enough I had that included at some point, but have made so many 
changes.

I'll try that tonight when I get home, thanks very much for the prompt 
reply!
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 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 {% 

Re: Invitations Apps

2013-11-07 Thread Amirouche Boubekki
Héllo Rafael,


I don't know those particular applications, so I can't help. Do you have a
specific problem?


2013/11/7 Rafael E. Ferrero 

> No body can help me?
>
>
> 2013/11/7 Rafael E. Ferrero 
>
>
>> Has someone used some invitation app for django like django-invitation
>> [1]... and more, has someone integrated something like that with AllAuth
>> [2] ??
>>
>> In a project I need visitors to register on the site with their social
>> accounts. Once registered the system will create a group which will own. Then
>> the owner of the group may invite people to integrate this group. Those
>> who respond to the invitation may log in with their social accounts too.
>> Guests can not create groups, because they are guests.
>>
>> Someon has some tips for me?
>>
>> Thanks a lot!
>>
>>
>> [1] https://bitbucket.org/david/django-invitation/wiki/Home
>>
>



>  [2] https://github.com/pennersr/django-allauth
>>
>
I don't know this application, I know about:

- python-social-auth
- http://peterhudec.github.io/authomatic/ something like that

Both are nice and probably work but I couldn't use because I did not use
django for this specific project and they did not integrate well.


Hope this helps,



Amirouche

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


Re: Invitations Apps

2013-11-07 Thread Rafael E. Ferrero
Im doing a project where visitors can registers with his social accounts
(this it can be done with AllAuth in a very simple way)
When a visitor get registered the system he can create a group. (this is
not a problem too)
But... a registered visitor can invitate, by email, to other people to join
in his group. The idea is that these guest can login with his own social
accounts too, So here's the problem, AllAuth make it easy to login with social
accounts but does not manage invitations.
I do not want to reinvent the wheel but if nobody did this before I'm
afraid that i have to put my hands in the dough.

Cheers !


2013/11/7 Amirouche Boubekki 

> Héllo Rafael,
>
>
> I don't know those particular applications, so I can't help. Do you have a
> specific problem?
>
>
> 2013/11/7 Rafael E. Ferrero 
>
>> No body can help me?
>>
>>
>> 2013/11/7 Rafael E. Ferrero 
>>
>>
>>> Has someone used some invitation app for django like django-invitation
>>> [1]... and more, has someone integrated something like that with AllAuth
>>> [2] ??
>>>
>>> In a project I need visitors to register on the site with their social
>>> accounts. Once registered the system will create a group which will own. 
>>> Then
>>> the owner of the group may invite people to integrate this group. Those
>>> who respond to the invitation may log in with their social accounts too.
>>> Guests can not create groups, because they are guests.
>>>
>>> Someon has some tips for me?
>>>
>>> Thanks a lot!
>>>
>>>
>>> [1] https://bitbucket.org/david/django-invitation/wiki/Home
>>>
>>
>
>
>
>>  [2] https://github.com/pennersr/django-allauth
>>>
>>
> I don't know this application, I know about:
>
> - python-social-auth
> - http://peterhudec.github.io/authomatic/ something like that
>
> Both are nice and probably work but I couldn't use because I did not use
> django for this specific project and they did not integrate well.
>
>
> Hope this helps,
>
>
>
> Amirouche
>
> --
> 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/CAL7_Mo9nHfUbR-OrvOjLALUZmeqqSKePbhzYuZXzOcxUaFC%3DJg%40mail.gmail.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_8XfAHskv35fZw%3D-GMT16%2Bvp%3DcU0W9BCokOm_Y158N0pHA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Invitations Apps

2013-11-07 Thread Avraham Serour
You could create a invitation model, I don't see the problem
but maybe you don't even need to, if all you want is for a user to ask the
server to send some emails you can just do that: let the user ask the
server to send emails.


On Thu, Nov 7, 2013 at 11:43 PM, Rafael E. Ferrero  wrote:

> Im doing a project where visitors can registers with his social accounts
> (this it can be done with AllAuth in a very simple way)
> When a visitor get registered the system he can create a group. (this is
> not a problem too)
> But... a registered visitor can invitate, by email, to other people to
> join in his group. The idea is that these guest can login with his own
> social accounts too, So here's the problem, AllAuth make it easy to login
> with social accounts but does not manage invitations.
>  I do not want to reinvent the wheel but if nobody did this before I'm
> afraid that i have to put my hands in the dough.
>
> Cheers !
>
>
> 2013/11/7 Amirouche Boubekki 
>
>> Héllo Rafael,
>>
>>
>> I don't know those particular applications, so I can't help. Do you have
>> a specific problem?
>>
>>
>> 2013/11/7 Rafael E. Ferrero 
>>
>>> No body can help me?
>>>
>>>
>>> 2013/11/7 Rafael E. Ferrero 
>>>
>>>
 Has someone used some invitation app for django like django-invitation
 [1]... and more, has someone integrated something like that with AllAuth
 [2] ??

 In a project I need visitors to register on the site with their social
 accounts. Once registered the system will create a group which will own
 . Then the owner of the group may invite people to integrate this group
 . Those who respond to the invitation may log in with their social
 accounts too. Guests can not create groups, because they are guests.

 Someon has some tips for me?

 Thanks a lot!


 [1] https://bitbucket.org/david/django-invitation/wiki/Home

>>>
>>
>>
>>
>>>  [2] https://github.com/pennersr/django-allauth

>>>
>> I don't know this application, I know about:
>>
>> - python-social-auth
>> - http://peterhudec.github.io/authomatic/ something like that
>>
>> Both are nice and probably work but I couldn't use because I did not use
>> django for this specific project and they did not integrate well.
>>
>>
>> Hope this helps,
>>
>>
>>
>> Amirouche
>>
>> --
>> 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/CAL7_Mo9nHfUbR-OrvOjLALUZmeqqSKePbhzYuZXzOcxUaFC%3DJg%40mail.gmail.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_8XfAHskv35fZw%3D-GMT16%2Bvp%3DcU0W9BCokOm_Y158N0pHA%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/CAFWa6tKeyH5SbfN9zMZUv2b4QsfsCSNubmZpu-3azozr-u-fmQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: django debugger

2013-11-07 Thread CLIFFORD ILKAY
On 11/07/2013 02:19 PM, Harjot Mann wrote:
> Is it possible to view the sql queries working at the backend of
> django from browser directly? 

Django debug toolbar
 will do that.

-- 
Regards,

Clifford Ilkay

647-778-8696

Dinamis



-- 
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/527C6442.1020508%40dinamis.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 Jason S
Hi,
Thanks for the tip, i tried adding the user as the argument, i tried the 
following:
new_post = pform.save(user=request.user)
new_post = pform.save(user)
new_post = pform.save(request.user)
and a few other things...

Now i just get the following save() takes at least 2 arguments (2 given)

Any ideas?
Thanks,
Jason

On Thursday, 7 November 2013 10:52:16 UTC-10, Jason S wrote:
>
> Hi Paul,
> Thanks, now you mention it and I look at it again it seems obvious, can't 
> see the wood for the trees moment.
> Funnily enough I had that included at some point, but have made so many 
> changes.
>
> I'll try that tonight when I get home, thanks very much for the prompt 
> reply!
> 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 return render_to_response('create_object.html', 
>>> {'Post_Form': pform, 'Comment_Form': cforms},
>>>  87 context_instance=RequestContex

Re: Django 1.6 transactions witn multiple databases

2013-11-07 Thread akaariai
On Thursday, November 7, 2013 3:36:17 PM UTC+2, Vaal wrote:
>
> Hi
> How to be in 1.6 with queries that involve multiple databases?
> Previously recommended to create custom TransactionMiddleware. It was 
> convenient. Now TransactionMiddleware is deprecated.
>

You can set ATOMIC_REQUESTS per database.

-- 
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/404f3556-5d44-4325-a47f-ae36cfd5cd3c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Complex query reduction

2013-11-07 Thread akaariai
On Sunday, November 3, 2013 1:48:07 PM UTC+2, Robin St.Clair wrote:
>
> *IN*
>
>- if using Django avoid the IN operation at all costs
>
>
> If there are potentially more than 15 items in the list, rework the IN as 
> a JOIN against whatever the source of the keys is
>

I don't necessarily agree with everything else said in the post, but this 
one is just plain wrong. It is completely OK to use __in=queryset. In fact, 
it is recommended in cases where the alternate is using join + distinct.

 - Anssi 

-- 
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/6b5f9e3a-2e41-47b5-b0d6-94473fe323b8%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 Jason S
Its likely i'm passing the wrong arguements, because its a type mismatch 
error
However i'm only passing the request.POST, instance and request.user.

Since the two arguements are "self" and "user", prehaps i'm not passing the 
self objject corrrectly, though I thought this was past of the request.POST 
data?


Django Version:1.4.3Exception Type:TypeErrorException Value:

save() takes at least 2 arguments (2 given)




On Thursday, 7 November 2013 19:10:09 UTC-10, Jason S wrote:
>
> Hi,
> Thanks for the tip, i tried adding the user as the argument, i tried the 
> following:
> new_post = pform.save(user=request.user)
> new_post = pform.save(user)
> new_post = pform.save(request.user)
> and a few other things...
>
> Now i just get the following save() takes at least 2 arguments (2 given)
>
> Any ideas?
> Thanks,
> Jason
>
> On Thursday, 7 November 2013 10:52:16 UTC-10, Jason S wrote:
>>
>> Hi Paul,
>> Thanks, now you mention it and I look at it again it seems obvious, can't 
>> see the wood for the trees moment.
>> Funnily enough I had that included at some point, but have made so many 
>> changes.
>>
>> I'll try that tonight when I get home, thanks very much for the prompt 
>> reply!
>> 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(

Re: Complex query reduction

2013-11-07 Thread Robin St . Clair

Anssi

The last time I checked the use of IN, all the records from the database 
in the query were brought back to the workstation, rather than being 
processed on the backend and only the results returned to the workstation.


Have there been changes that carry out the entire query on the backend? 
What has changed to cause you to prefer the use of the IN statement?


R+C
On 08/11/2013 05:55, akaariai wrote:

On Sunday, November 3, 2013 1:48:07 PM UTC+2, Robin St.Clair wrote:

*IN*

  * if using Django avoid the IN operation at all costs


If there are potentially more than 15 items in the list, rework
the IN as a JOIN against whatever the source of the keys is


I don't necessarily agree with everything else said in the post, but 
this one is just plain wrong. It is completely OK to use 
__in=queryset. In fact, it is recommended in cases where the alternate 
is using join + distinct.


 - Anssi
--
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/6b5f9e3a-2e41-47b5-b0d6-94473fe323b8%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/BLU0-SMTP357C2324CC6BEC3F975EB4AE2F20%40phx.gbl.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Complex query reduction

2013-11-07 Thread akaariai
On Friday, November 8, 2013 8:44:09 AM UTC+2, Robin St.Clair wrote:
>
>  Anssi
>
> The last time I checked the use of IN, all the records from the database 
> in the query were brought back to the workstation, rather than being 
> processed on the backend and only the results returned to the workstation.
>
> Have there been changes that carry out the entire query on the backend? 
> What has changed to cause you to prefer the use of the IN statement?
>

Django has had the ability to execute __in=qs in single query for a 
somewhat long time (from Django 1.2 maybe?).

It is true that __in lookup against a large list of values is often a bad 
choice even if you have the values at hand. Unfortunately this doesn't 
apply to all databases, for example older versions of MySQL do not handle 
subqueries well.

 - Anssi

-- 
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/f3428fda-e4be-4d75-8626-a95bd20f66c8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django (cache?) make some mistake with formset generated class

2013-11-07 Thread Bastien Sevajol
You're right! I mistake with python object logic :/ Sorry ! 
Thank's !

Le jeudi 7 novembre 2013 14:45:45 UTC+1, Simone Federici a écrit :
>
>
> On Thu, Nov 7, 2013 at 11:54 AM, Bastien Sevajol 
> 
> > wrote:
>
>> formsets = {}
>
>
> this class variable is in ModelFormsetManager class namespace
> so it is shared across the subclasses.
>
> You are using formsets to save before the object class, and after the 
> instances,
> so when in the formset there is the instance of the last "view", and you 
> try to call it
> create the instance of an class works, call the instance return object is 
> not callable exception
>
> your last solution solve only apparently the superclass-namespace issue.
>
>
> regards
>  

-- 
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/f3e7a325-ac20-4eaa-98fe-dcb6059e0931%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.