Re: Presentation ideas?

2014-01-16 Thread Keith Edmiston
John/Russ,

Thanks a ton for these suggestions. Great thoughts!

Keith

On Thursday, January 16, 2014, Russell Keith-Magee 
wrote:

> These are all good reasons, especially for the tutorial side of things.
>
> From the perspective of sprints:
>
>  * You can discuss architectural issues/challenges with members of the
> project core team
>  * You can get engaged with the open source development process
>  * You can get immediate answers (and often resolution) on bugs that are
> causing you personal problems
>  * You can get rapid design feedback on proposals you'd like to see
> integrated with the project
>
> Yours,
> Russ Magee %-)
>
> On Fri, Jan 17, 2014 at 6:31 AM, John DeRosa 
> 
> > wrote:
>
>> You can survey technologies you don’t use in your daily work.
>> You can explore alternative technologies for your current job.
>> You can learn new details about technologies you know, in intermediate or
>> advanced tutorials.
>> You can learn in-depth, because you’re in a session for 3 hours, vs. 45
>> minutes.
>> You can more easily network, because tutorials are less frenetic than the
>> full-conference madhouse.
>>
>>
>> John
>>
>> On Jan 16, 2014, at 2:25 PM, Keith Edmiston 
>> >
>> wrote:
>>
>> I'm scheduled to give a talk/presentation to my colleagues on why
>> attending tutorials and sprints at a conference is a great idea (I attended
>> DjangoConUS2013).
>>
>> Any ideas/thoughts much appreciated.
>>
>> ---
>>
>> Conference Tutorials and Sprints…what are they all about?
>>
>> "Often we attend technical conferences, but wonder what the tutorials
>> beforehand and sprints afterwards really offer. This session will provide
>> some insight to that dark world of give and take."
>>
>>
>> --
>> Keith Edmiston
>> (512)970-7222
>>
>> --
>> 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 > 'cvml', 'django-users+unsubscr...@googlegroups.com');>.
>> To post to this group, send email to 
>> django-users@googlegroups.com> 'django-users@googlegroups.com');>
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAP_gv7LC_owxKuigT_hbVd5mjruCm7AUKMqBHq6y1P0uP%2BdaKw%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 > 'cvml', 'django-users%2bunsubscr...@googlegroups.com');>.
>> To post to this group, send email to 
>> django-users@googlegroups.com> 'django-users@googlegroups.com');>
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/73858338-D0B1-4736-84B0-6416D2ACBCED%40ipstreet.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  'cvml', 'django-users%2bunsubscr...@googlegroups.com');>.
> To post to this group, send email to 
> django-users@googlegroups.com 'django-users@googlegroups.com');>
> .
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJxq84_80vQ-ZnrrmnAsx6e1rx_6KPc9JL18EpKfU2HcSTFG9w%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>


-- 
Keith Edmiston
(512)970-7222

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


Re: django websockets

2014-01-16 Thread carlos
Hi maybe this link help you
https://www.djangopackages.com/grids/g/websockets/

Cheers


On Thu, Jan 16, 2014 at 8:34 PM, Silviu Dicu  wrote:

> Hello,
>
> I'm looking to implement websockets with django.
> Any hints will be appreciated.
>
> thanks!
>
> -silviu
>
> --
> 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/CAOZ558nn5fZioaMrhMpXJc-yX1ruExDqgLcOOdAWoafEJJTNbg%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/CAM-7rO3X9rQBVRb4g0aLSy9R9jZk4f3x%2B11k4DUdnP-1eKps4g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImproperlyConfigured: Error loading psycopg2 module: No module named _psycopg

2014-01-16 Thread Начаров Михаил

Hi Timothy,

Note that your mod_wsgi module compiled for using python2.7. So what you 
need now is install(compile) mod_wsgi for python3 instead of the 
same module compiled for python2.7.

On Debian you can do it by this command:
$ sudo apt-get install libapache2-mod-wsgi-py3



16.01.2014 16:34, Timothy W. Cook пишет:
This question is also on Stackoverflow http://goo.gl/LinMue  but I 
thought somene here may have an idea.



I have a Django 1.5, Python 2.7 site running under Apache with 
mod_wsgi on a CentOS 6.4 server.


I have rebuilt this site using Django 1.6 and Python 3.3. Deploying it 
to the same server and changing the paths in httpd.conf I get the 
subject error. This new install works as expected using ./manage.py 
runserver.


Here are the two WSGI definitions from httpd.conf:

|WSGIScriptAlias/  /home/ccdgen/CCDGEN2/apache/wsgi.py
WSGIPythonPath/home/ccdgen/CCDGEN2/ccdgen/ccdgen:/home/ccdgen/CCDGEN2/ccdgen:/home/ccdgen/CCDGEN2/lib/python3.3/site-packages


  Order  allow,deny
  Allowfrom  all



#WSGIScriptAlias/ccdgen/home/ccdgen/CCDGEN/apache/wsgi.py
#WSGIPythonPath/home/ccdgen/CCDGEN/mlhim/ccdgen:/home/ccdgen/CCDGEN/mlhim:/home/ccdgen/CCDGEN/lib/python2.7/site-packages
#
#
#  Order  allow,deny
#  Allowfrom  all
#
#|

The wsgi.py file is the same on both installations:

|import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",  "mlhim.settings")
from  django.core.wsgi import get_wsgi_application
application=  get_wsgi_application()|

--

Thanks in advance for any ideas.

Cheers,
Tim


--
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%3DOU3XNi7-FGOCPnKS%2Bb6%3D-ueWbPMOWFXfOce663fn0YpjWwQ%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/52D8A90F.3040209%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


django websockets

2014-01-16 Thread Silviu Dicu
Hello,

I'm looking to implement websockets with django.
Any hints will be appreciated.

thanks!

-silviu

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


Re: Presentation ideas?

2014-01-16 Thread Russell Keith-Magee
These are all good reasons, especially for the tutorial side of things.

>From the perspective of sprints:

 * You can discuss architectural issues/challenges with members of the
project core team
 * You can get engaged with the open source development process
 * You can get immediate answers (and often resolution) on bugs that are
causing you personal problems
 * You can get rapid design feedback on proposals you'd like to see
integrated with the project

Yours,
Russ Magee %-)

On Fri, Jan 17, 2014 at 6:31 AM, John DeRosa  wrote:

> You can survey technologies you don’t use in your daily work.
> You can explore alternative technologies for your current job.
> You can learn new details about technologies you know, in intermediate or
> advanced tutorials.
> You can learn in-depth, because you’re in a session for 3 hours, vs. 45
> minutes.
> You can more easily network, because tutorials are less frenetic than the
> full-conference madhouse.
>
>
> John
>
> On Jan 16, 2014, at 2:25 PM, Keith Edmiston  wrote:
>
> I'm scheduled to give a talk/presentation to my colleagues on why
> attending tutorials and sprints at a conference is a great idea (I attended
> DjangoConUS2013).
>
> Any ideas/thoughts much appreciated.
>
> ---
>
> Conference Tutorials and Sprints…what are they all about?
>
> "Often we attend technical conferences, but wonder what the tutorials
> beforehand and sprints afterwards really offer. This session will provide
> some insight to that dark world of give and take."
>
>
> --
> Keith Edmiston
> (512)970-7222
>
> --
> 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/CAP_gv7LC_owxKuigT_hbVd5mjruCm7AUKMqBHq6y1P0uP%2BdaKw%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/73858338-D0B1-4736-84B0-6416D2ACBCED%40ipstreet.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/CAJxq84_80vQ-ZnrrmnAsx6e1rx_6KPc9JL18EpKfU2HcSTFG9w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Modify FileField in Admin

2014-01-16 Thread Wnt2bsleepin
Hello,

I am new to Django and have run into a small problem with my application's 
admin page. It displays the full url to the uploaded file, but when I click 
on it the link is warped. I have a method to retrieve the file as a 
download, and would like to put that there instead of the plain url. Is 
there anyway to customize the link that is displayed there? 
Hereis a link to the picture in a larger size



Thank you for any help.

-- 
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/646fc99b-594f-4792-aece-3f9d7b4106c9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problems with Custom Tag Filter

2014-01-16 Thread Mark Phillips
I have a dictionary of dictionaries that I need to open up in a template.

The dictionary:
'values': {(1L, 2L): {'selling_costs__sum': None, 'sale_price__sum': None,
'debt__sum': None, 'estimate__quote__sum': None},
(3L, 2L): {'selling_costs__sum': Decimal('10.45'), 'sale_price__sum':
Decimal('50.00'), 'debt__sum': Decimal('0.00'), 'estimate__quote__sum':
Decimal('100.00')}}

My templatetag:
from django import template
register = template.Library()

@register.filter
def lookup(container, key):
if type(container) is dict:
return container.get(key)
elif type(container) in (list, tuple):
return container[key] if len(container) > key else None
return None

And my template code:
{% for location in locations %}
{% for category in categories %}

{{ location }}
{{ category }}
${{ values|lookup:(location.id, category.id)|lookup:'
selling_costs__sum' }}

{% endfor %}
{% endfor %}

The error I get is: lookup requires 1 arguments, 0 provided.

The location.id and category.id both generate the correct values. It seems
that template tags can't take a tuple as a key for a dictionary.

Also I read that one cannot chain a filter like this. Is this true?

Any suggestions on how to read data from the dictionary values?

Thanks!

Mark

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


Re: Presentation ideas?

2014-01-16 Thread John DeRosa
You can survey technologies you don’t use in your daily work.
You can explore alternative technologies for your current job.
You can learn new details about technologies you know, in intermediate or 
advanced tutorials.
You can learn in-depth, because you’re in a session for 3 hours, vs. 45 minutes.
You can more easily network, because tutorials are less frenetic than the 
full-conference madhouse.


John

On Jan 16, 2014, at 2:25 PM, Keith Edmiston  wrote:

> I'm scheduled to give a talk/presentation to my colleagues on why attending 
> tutorials and sprints at a conference is a great idea (I attended 
> DjangoConUS2013). 
> 
> Any ideas/thoughts much appreciated. 
> 
> ---
> 
> Conference Tutorials and Sprints…what are they all about?
> 
> "Often we attend technical conferences, but wonder what the tutorials 
> beforehand and sprints afterwards really offer. This session will provide 
> some insight to that dark world of give and take."
> 
> 
> -- 
> Keith Edmiston
> (512)970-7222
> 
> -- 
> 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/CAP_gv7LC_owxKuigT_hbVd5mjruCm7AUKMqBHq6y1P0uP%2BdaKw%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/73858338-D0B1-4736-84B0-6416D2ACBCED%40ipstreet.com.
For more options, visit https://groups.google.com/groups/opt_out.


Presentation ideas?

2014-01-16 Thread Keith Edmiston
I'm scheduled to give a talk/presentation to my colleagues on why attending
tutorials and sprints at a conference is a great idea (I attended
DjangoConUS2013).

Any ideas/thoughts much appreciated.

---

Conference Tutorials and Sprints…what are they all about?

"Often we attend technical conferences, but wonder what the tutorials
beforehand and sprints afterwards really offer. This session will provide
some insight to that dark world of give and take."


-- 
Keith Edmiston
(512)970-7222

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


Unofficial Kindle builds of the Django documentation

2014-01-16 Thread Markus Amalthea Magnuson
Hey all,

I've done .mobi builds of the Django documentation so you can read it on a 
Kindle:

http://alimony.github.io/django-docs-kindle/

Just thought people here might be interested :)

-- 
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/44a36d4d-12c1-4dd0-bb3d-a55302628448%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Conditionally display fields in admin

2014-01-16 Thread Larry Martell
I have an admin form for a model and based on the value of one column
(either as it is in the database or as it's entered or changed by the
user), I want to conditionally display or not display other fields. Is
there a way to do this natively in the admin or do I have to write
some javascript code.  If I have to write some js code, where would I
put that code?

Thanks!
-larry

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


Re: open data protocol and django

2014-01-16 Thread Adolphe Cher-Aime
Have you tested  tastypie?

http://tastypieapi.org/


Regards,




On Thu, Jan 16, 2014 at 3:04 PM, Sven Aßmann  wrote:

> Hi Folks,
>
> again i wanna ask you if someone of you already had the chance to play
> around
> with the open data protocol and a django integration?
>
> Currently it looks like that there is no real stable client implementation
> for
> python. Only found that https://code.google.com/p/odata-py/ and it is
> still
> not production ready.
>
> After thinking about it i came to the idea that the djnago-rest-framework
> would be maybe the best starting point. The protocol is a REST based one
> and
> therefore only some serializers and glue code for data types and REST
> methods
> would be needed. An extension to rest-framework would be an possible
> option,
> maybe.
>
> Therefore the question if someone maybe did already a small playaround
> basing
> on django-rest-framework or a small selfmade implementation?
>
> Thanks for your feedback.
>
>
> --
>
>
> Best Regards,
> Sven
>
> --
> 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/1553947.x5EqRhUUPE%40gilgamesch
> .
> 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/CA%2BfkitJ_UVLu0Ev5NJPWAaSRt%3DsODxRgiYfSzw32NEm5DWXT8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


save returns the id and pk none

2014-01-16 Thread fabricio


my model


class Caixafaccao(models.Model):

empresa = models.ForeignKey(Empresa, null=True, blank=True)
cliente = models.ForeignKey(Cliente, verbose_name=u'Cliente')
conta = models.ForeignKey(Conta, verbose_name=u'Conta' )
subconta = models.ForeignKey(SubConta, verbose_name=u'Sub-Conta' )
caixa = models.IntegerField(u'Caixa', blank=True, null=True)
entrega = models.IntegerField(u'Entrega', blank=True, null=True)
entregaitens = models.IntegerField(u'Entrega Itens', blank=True, 
null=True)
dtlancamento = models.DateField(u'Data lançamento', 
default=datetime.now, null=True, blank=True)
idcentrocusto = models.CharField(u'Centro de custo', max_length=1, 
default='', choices=Centro_custo_CHOICE)
valor = models.DecimalField(u'Vlr. Unit.', max_digits=18, 
decimal_places=2, default=0)
tipo = models.CharField(u'Tipo', max_length=1, default='', null=True, 
blank=True, choices=DebCred_CHOICE)
observacoes = models.TextField(u'Observações', max_length=650, 
default='', null=True, blank=True)
valordefeito = models.DecimalField(u'Vlr. Defeito.', default=0, 
max_digits=18, decimal_places=2, null=True, blank=True)


class Meta:
ordering = ['dtlancamento','id' ]

def __unicode__(self):
   return u'%s' % (self.id)






my form


class CaixafaccaoForm(ModelForm):
class Meta:
model = Caixafaccao

def __init__(self, *args, **kwargs):
super( CaixafaccaoForm , self).__init__(*args, **kwargs)

self.fields["dtlancamento"].widget.attrs['readonly'] = "True"
self.fields["dtlancamento"].widget.attrs['class'] = "data"
self.fields["cliente"].widget.attrs['class'] = 
"chosen-select-no-results"
self.fields["observacoes"].widget.attrs['style'] = "width: 555px; 
height: 150px; resize: none;"
self.fields["conta"].widget.attrs['class'] = 
"chosen-select-no-results"
self.fields["subconta"].widget.attrs['class'] = 
"chosen-select-no-results"


def __new__(cls, *args, **kwargs):
new_class = super(CaixafaccaoForm, cls).__new__(cls, *args, 
**kwargs)
for field in new_class.base_fields.values():
if isinstance(field, DecimalField):
field.localize = True
field.widget.is_localized = True
return new_class





My view code

 if request.method == 'POST':
form_caixafaccao = CaixafaccaoForm(request.POST )
if form_caixafaccao.is_valid():

caixafaccao = form_caixafaccao.save( commit=False )



when I get the form_caixafaccao.save caixafaccao returns with id = PK = None 
and None debugging and saw that has an error DoesNotExist  if someone can help me thank you.







-- 
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/22b329b9-19f0-446f-bf40-b57cd916bd73%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to re-sync with Heroku?

2014-01-16 Thread Sven Aßmann
Hi Scott,

it looks more like a cygwin - heroku issue.
If you search for the heroku command, where do you find it, if even?

Try to extend your PATH variable to the path whereever the tool belt was 
installed and try it again.

Cheers,
Sven

On Thursday 09 January 2014 22:39:59 Scott Meyers wrote:
> Newbie here (obviously!).
> 
> I'm starting a Django project in Cygwin.  I push to Heroku.  I'm playing
> around, checking heroku logs, and my power goes out.  So I boot my
> computer, get back into Cygwin, go back into my project's root.  How do I
> sync it with Heroku again?  If I type heroku ps or heroku login or
> anything, I get "heroku: command not found".  How do I link it back up so
> my cygwin and heroku start talking to each other again?  Thanks!
-- 


Best Regards, 
Sven

-- 
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/2786360.KUsKBlklUr%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


open data protocol and django

2014-01-16 Thread Sven Aßmann
Hi Folks,

again i wanna ask you if someone of you already had the chance to play around 
with the open data protocol and a django integration?

Currently it looks like that there is no real stable client implementation for 
python. Only found that https://code.google.com/p/odata-py/ and it is still 
not production ready.

After thinking about it i came to the idea that the djnago-rest-framework 
would be maybe the best starting point. The protocol is a REST based one and 
therefore only some serializers and glue code for data types and REST methods 
would be needed. An extension to rest-framework would be an possible option, 
maybe.

Therefore the question if someone maybe did already a small playaround basing 
on django-rest-framework or a small selfmade implementation?

Thanks for your feedback.


-- 


Best Regards, 
Sven

-- 
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/1553947.x5EqRhUUPE%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mass email app for django

2014-01-16 Thread Sven Aßmann
Hi Dedrerik,

maybe your are right and just using a service like Mailchimp (which seems to 
be pretty userfriendly) would be the best way to go. I will defenetly have a 
look on it and try to find out if the users needs can be satisfied by that.

Thanks a lot.

Cheers,
Sven

On Thursday 16 January 2014 12:14:20 Diederik van der Boor wrote:
> Hi Sven,
> 
> What you describe sounds like a Mailinglist..
> Wouldn't it be possible to use Mailchimp or Aweber for this kind of service?
> From Django you can use their API's.
> 
> Mass-mailing has a risk of being blacklisted as server,
> at least make sure you send email via a whitelisted SMPT server (and not
> directly to everyone at the web). For mass-mailing I always recommend using
> specialized mailinglist software.
> 
> Greetings,
> Diederik
> 
> Op 15 jan. 2014, om 01:42 heeft Sven Aßmann  het volgende 
geschreven:
> > Hi Group,
> > 
> > currently i evaluating / research for a django app that supports mailing
> > specific texts to a receipient list (like mass emailing). the corner
> > features are:
> > 
> > - email text should be editable (text or html nothing special) thru the
> > admin app
> > - the receipient list should be maintainable independently from users and
> > texts (like a addressbook that is maintanale thru admin app)
> > - ideally supports several mail backends like smtp, aws sms, postmark
> > etc..
> > - processing of the sending can be done async via django cli / message
> > queue services
> > 
> > The closest use case app would be something like a newsletter app, where
> > the subscibers can be maintainted apart from django.auth.users
> > I am aware of www.djangopackages.com and found already a couple of
> > applications that could make the job.
> > 
> > I ask you folks if someone has good experience with a specific one and or
> > what features are included and helpfull and what are not that helpfull.
> > 
> > I really appreciate your contributions.
-- 


Best Regards, 
Sven

-- 
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/3294591.EeCsXCzNCc%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mass email app for django

2014-01-16 Thread Sven Aßmann
Hi Serge,

unfortunately the smtp server is a managed server therefore no configuration to 
use a db as virtual mail backend can be performed.

But thanks for your notes, especially i wasn't aware that djnago can use the 
postmark / rest api for mails out of the box. I need to investigate on that - 
exiting.

Cheers,
Sven

On Wednesday 15 January 2014 13:34:11 Sergiy Khohlov wrote:
> Hello Sven,
> 
> Look like it is not task for django. This is task  for SMTP server. Of
> course you can create a task  for SMTP server using django but  main
> force of the your application is based on mail server.
>  I'm proposing  next solution:
> 1) Store usermail in  database
> 2) configure smtp server for using database as virtual  emails
> database (it is not hard)
> 3) Use django as web interface
> 4) Send letter to SMTP using standart protocol
> 
>  P.S. Postmark has API and it  is possible to use it directly from django.
> If you  have any questions let me know. I've supported SMTP servers
> for 15 years and 've worked  for spamfight service.
> Many thanks,
> 
> Serge
> 
> 
> +380 636150445
> skype: skhohlov
> 
> On Wed, Jan 15, 2014 at 2:42 AM, Sven Aßmann  wrote:
> > Hi Group,
> > 
> > currently i evaluating / research for a django app that supports mailing
> > specific texts to a receipient list (like mass emailing). the corner
> > features are:
> > 
> > - email text should be editable (text or html nothing special) thru the
> > admin app
> > - the receipient list should be maintainable independently from users and
> > texts (like a addressbook that is maintanale thru admin app)
> > - ideally supports several mail backends like smtp, aws sms, postmark
> > etc..
> > - processing of the sending can be done async via django cli / message
> > queue services
> > 
> > The closest use case app would be something like a newsletter app, where
> > the subscibers can be maintainted apart from django.auth.users
> > I am aware of www.djangopackages.com and found already a couple of
> > applications that could make the job.
> > 
> > I ask you folks if someone has good experience with a specific one and or
> > what features are included and helpfull and what are not that helpfull.
> > 
> > I really appreciate your contributions.
> > 
> > --
> > 
> > 
> > Best Regards,
> > Sven
> > 
> > --
> > 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/3688706.24zruyElKd%40gilga
> > mesch. For more options, visit https://groups.google.com/groups/opt_out.
-- 


Best Regards, 
Sven

-- 
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/1397870.1xd54BY6e8%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Johannes Schneider
No, just if you use auto generated PKs. Exactly this is the point. We 
use manually generated PKs, so can not use this check.



On 16.01.2014 18:03, Javier Guerra Giraldez wrote:

On Thu, Jan 16, 2014 at 11:50 AM, Johannes Schneider
 wrote:

The point is, I have to distinguish between an instance which is created,
but its save method is not yet called. And an instance coming from the
database via a manager.



AFAIK, if it has a 'pk' property, it has been saved.




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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/52D8155C.8060307%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: trying to introduce django custom templatetags - some jinja also involve

2014-01-16 Thread carlos
Hi maybe help you this link http://askbot.org/en/questions/ ask your
question theres!

Cheers


On Thu, Jan 16, 2014 at 9:44 AM, django-newb  wrote:

> I am working on a project where I used a open source framework. Here is
> the link for the opensource framework:
> https://github.com/ASKBOT/askbot-devel. I wanted to add a/b testing to it
> and after doing some research I found out 
> django-lean.
> I am not an expert in django but I manage to bring the strip down version
> of the django-lean to my version of askbot-dlevel. I used the blog 
> post.
> But my problem is that I am getting following error:
>
> TemplateSyntaxError at /questions/Encountered unknown tag 
> 'experiment'.Request Method: GETRequest URL:
> http://localhost:8001/questions/Django Version: 1.4.10Exception Type: 
> TemplateSyntaxErrorException Value:Encountered unknown tag 'experiment'.
>
> Just to give more information how I incorporate django-lean: As the
> blog-post mention I only use the experiments module: I added experiments
> folder from django-lean inside askbot folder and expose it as another
> install-app using settings file. So now it looks like another application.
>
> I copied experiments.py and smartif.py to askbot-dlevel/templatetags
> because thats the right thing to do based on he django 
> documentation:
> also I copied content of the templates folder in the django-lean to
> askbot-dlevel project's templates folder. So here is how the project looks
> like:
>
>> askbot-dlevel
>> |__experiments
>> |__OtherApps
>> templates
>> |__experiments
>> |__other_templates
>
> In askbot-dlevel there is a utils folder and in that there is
> decorators.py, I added the following:
>
> def set_experiment_user(view_func):
> '''Decorator for setting the WebUser for use with ab split testing assumes
> first argument is the request object'''
> @functools.wraps(view_func)
> def decorator(request, *args, **kwargs):
> WebUser(request).confirm_human()
> return view_func(request, *args, **kwargs)
> return decorator
>
> This is a slight modification respect to what the 
> blog-posthas
>  mentioned but the logic is still the same. At the point blog-post
> advise to add it to the views so I added to a view in the askbot-dlevel
> project:
>
> @csrf.csrf_protect@decorators.set_experiment_userdef ask_widget(request, 
> widget_id):
>
> def post_question(data, request):
> thread = models.Thread.objects.create_new(**data)
> question = thread._question_post()
> request.session['widget_question_url'] = question.get_absolute_url()
> return question
>
> widget = get_object_or_404(models.AskWidget, id=widget_id)
> ...
>
> after this I added the necessary code to the template file which would add
> all incoming users to the current experiment that is live on the. Now
> askbot-dlevel uses jinja2. I but I first tried as the blog post mention
> because I really don't have a good idea of jinja.
>
> So in sidebar.html of the adkbot-dlevel I added the following:
>
> {% import "macros.html" as macros %}
> {% load experiments %}{% experiment experiment_name top_contributors %}{% if 
> contributors and settings.SIDEBAR_MAIN_SHOW_AVATARS %}
> {% include "widgets/contributors.html" %}{% endif %}{% endexperiment %}
>
> But that gave me the error that I put at the start of this post. As the
> blog post mention things should work. Using the admin console I have
> created an experiment and the name of the experiment is top_contributors.
> And if things run all users would be in the experiment. But I am getting
> above mention error which tells me template tags have not been registered.
>
> So I tried my best to convert this to jinja format and tried the
> following:
>
> {% if experiments.experiment('top_contributors') %}{% if contributors and 
> settings.SIDEBAR_MAIN_SHOW_AVATARS %}
> {% include "widgets/contributors.html" %}{% endif %}{% endif %}
>
> But that gave me following error:
>
> UndefinedError at /questions/'experiments' is undefinedRequest Method: 
> GETRequest URL:http://localhost:8001/questions/Django Version: 
> 1.4.10Exception Type: UndefinedErrorException Value:'experiments' is 
> undefinedException Location: 
> ..python2.7/site-packages/Jinja2-2.7.1-py2.7.egg/jinja2/environment.py in 
> getattr, line 397Python Executable:  ../ABFrameWork/bin/python
>
> Hopefully someone can help on solving this problem.
>
> Thank You,
>
> --
> 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, 

Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Johannes Schneider
This could be a way to it, but we need this information while handling 
the Pre_save singal. So this does not work too.


On 16.01.2014 17:53, Martin Marrese wrote:

On Thu, Jan 16, 2014 at 1:50 PM, Johannes Schneider
> wrote:

The point is, I have to distinguish between an instance which is
created, but its save method is not yet called. And an instance
coming from the database via a manager.

bg,
Johannes


Perhaps get_or_create
(https://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create)
?

Martín

--
Martin Marrese
marr...@gmail.com 
+54 911 5112 9448

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



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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/52D8159A.5030105%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Javier Guerra Giraldez
On Thu, Jan 16, 2014 at 11:50 AM, Johannes Schneider
 wrote:
> The point is, I have to distinguish between an instance which is created,
> but its save method is not yet called. And an instance coming from the
> database via a manager.


AFAIK, if it has a 'pk' property, it has been saved.

-- 
Javier

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


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Martin Marrese
On Thu, Jan 16, 2014 at 1:50 PM, Johannes Schneider <
johannes.schnei...@galileo-press.de> wrote:

> The point is, I have to distinguish between an instance which is created,
> but its save method is not yet called. And an instance coming from the
> database via a manager.
>
> bg,
> Johannes
>

Perhaps get_or_create (
https://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create) ?

Martín

-- 
Martin Marrese
marr...@gmail.com
+54 911 5112 9448

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


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Johannes Schneider
The point is, I have to distinguish between an instance which is 
created, but its save method is not yet called. And an instance coming 
from the database via a manager.


bg,
Johannes

On 16.01.2014 16:04, Erik Cederstrand wrote:

Den 16/01/2014 kl. 14.27 skrev Johannes Schneider 
:


Hi List,
I need to check, if a given instance of a Model already exists in the Database. 
I cannot check 'instance.pk is None', because there are manually given PKs (no 
discussion about this plz).

Up to now I check if 'instance._state.adding' is true. But I don't like this 
solution.
Checking 'InstanceModel.objects.exists(pk=self.pk)' generates too much queries, 
so this is not acceptable in my case.


Can you elaborate on “too much queries”? exists() is supposed to be the 
cheapest way of checking if the object exists. It seems like you want to check 
the database, without actually checking the database…

If you want to check a large number of objects at the same time, just do 
something like:

InstanceModel.objects.filter(id__in=(your, list, of, 
PKs)).values_list('id', flat=True)

to get all pre-existing PKs in one query.

Erik




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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/52D80DDF.90004%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


trying to introduce django custom templatetags - some jinja also involve

2014-01-16 Thread django-newb
I am working on a project where I used a open source framework. Here is the 
link for the opensource framework:  https://github.com/ASKBOT/askbot-devel. I 
wanted to add a/b testing to it and after doing some research I found out 
django-lean . I am not 
an expert in django but I manage to bring the strip down version of the 
django-lean to my version of askbot-dlevel. I used the blog 
post. 
But my problem is that I am getting following error:

TemplateSyntaxError at /questions/Encountered unknown tag 'experiment'.Request 
Method: GETRequest URL:http://localhost:8001/questions/Django Version: 
1.4.10Exception Type: TemplateSyntaxErrorException Value:Encountered 
unknown tag 'experiment'.

Just to give more information how I incorporate django-lean: As the 
blog-post mention I only use the experiments module: I added experiments 
folder from django-lean inside askbot folder and expose it as another 
install-app using settings file. So now it looks like another application.

I copied experiments.py and smartif.py to askbot-dlevel/templatetags 
because thats the right thing to do based on he django 
documentation:
 
also I copied content of the templates folder in the django-lean to 
askbot-dlevel project's templates folder. So here is how the project looks 
like: 

> askbot-dlevel
> |__experiments
> |__OtherApps
> templates
> |__experiments
> |__other_templates

In askbot-dlevel there is a utils folder and in that there is 
decorators.py, I added the following:

def set_experiment_user(view_func):
'''Decorator for setting the WebUser for use with ab split testing assumes
first argument is the request object'''
@functools.wraps(view_func)
def decorator(request, *args, **kwargs):
WebUser(request).confirm_human()
return view_func(request, *args, **kwargs)
return decorator

This is a slight modification respect to what the 
blog-posthas
 mentioned but the logic is still the same. At the point blog-post 
advise to add it to the views so I added to a view in the askbot-dlevel 
project: 

@csrf.csrf_protect@decorators.set_experiment_userdef ask_widget(request, 
widget_id):

def post_question(data, request):
thread = models.Thread.objects.create_new(**data)
question = thread._question_post()
request.session['widget_question_url'] = question.get_absolute_url()
return question

widget = get_object_or_404(models.AskWidget, id=widget_id)
...

after this I added the necessary code to the template file which would add 
all incoming users to the current experiment that is live on the. Now 
askbot-dlevel uses jinja2. I but I first tried as the blog post mention 
because I really don't have a good idea of jinja. 

So in sidebar.html of the adkbot-dlevel I added the following: 

{% import "macros.html" as macros %}
{% load experiments %}{% experiment experiment_name top_contributors %}{% if 
contributors and settings.SIDEBAR_MAIN_SHOW_AVATARS %}
{% include "widgets/contributors.html" %}{% endif %}{% endexperiment %}

But that gave me the error that I put at the start of this post. As the 
blog post mention things should work. Using the admin console I have 
created an experiment and the name of the experiment is top_contributors. 
And if things run all users would be in the experiment. But I am getting 
above mention error which tells me template tags have not been registered.

So I tried my best to convert this to jinja format and tried the following: 

{% if experiments.experiment('top_contributors') %}{% if contributors and 
settings.SIDEBAR_MAIN_SHOW_AVATARS %}
{% include "widgets/contributors.html" %}{% endif %}{% endif %}

But that gave me following error: 

UndefinedError at /questions/'experiments' is undefinedRequest Method: 
GETRequest URL:http://localhost:8001/questions/Django Version: 
1.4.10Exception Type: UndefinedErrorException Value:'experiments' is 
undefinedException Location: 
..python2.7/site-packages/Jinja2-2.7.1-py2.7.egg/jinja2/environment.py in 
getattr, line 397Python Executable:  ../ABFrameWork/bin/python

Hopefully someone can help on solving this problem.

Thank You,

-- 
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/f3b009ea-a66e-4888-83db-8b8bba4e4a9a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Erik Cederstrand
Den 16/01/2014 kl. 14.27 skrev Johannes Schneider 
:

> Hi List,
> I need to check, if a given instance of a Model already exists in the 
> Database. I cannot check 'instance.pk is None', because there are manually 
> given PKs (no discussion about this plz).
> 
> Up to now I check if 'instance._state.adding' is true. But I don't like this 
> solution.
> Checking 'InstanceModel.objects.exists(pk=self.pk)' generates too much 
> queries, so this is not acceptable in my case.

Can you elaborate on “too much queries”? exists() is supposed to be the 
cheapest way of checking if the object exists. It seems like you want to check 
the database, without actually checking the database…

If you want to check a large number of objects at the same time, just do 
something like:

   InstanceModel.objects.filter(id__in=(your, list, of, PKs)).values_list('id', 
flat=True)

to get all pre-existing PKs in one query.

Erik

-- 
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/4848B682-ECB2-4DC9-83A7-5C7D58DE0EFF%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Can we upgraded from django 1.1.1 to 1.6.1??

2014-01-16 Thread carlos
I thing YES, but you first need sure complete understand django 1.6.1 and
replace pieces of code when get error in you application. other thing is
you need read all releases notes all version of django:
1.2
1.3
1.4
1.5
1.6
and you discover what is new, what is deprecated and what is removed!

in fact you replaced your code(views) but your will keep your data
intact(models)

cheers


On Thu, Jan 16, 2014 at 3:50 AM,  wrote:

> Can we??
>
> If yes, what are the definite obstacles that we will face while getting it
> done for  MENTORING APPLICATION.
>
> Thanks & Regards
> Raj
>
> --
> 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/a32b0893-7e75-46b5-9da7-f774a0fcf71d%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/CAM-7rO0A5DJijp0Lkc9%3DFTpVQjY_a3Jd%2BXzbizDgBT9EhU5-Wg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-16 Thread Johannes Schneider

Hi List,
I need to check, if a given instance of a Model already exists in the 
Database. I cannot check 'instance.pk is None', because there are 
manually given PKs (no discussion about this plz).


Up to now I check if 'instance._state.adding' is true. But I don't like 
this solution.
Checking 'InstanceModel.objects.exists(pk=self.pk)' generates too much 
queries, so this is not acceptable in my case.


bg
Johannes


--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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/52D7DE2D.8070604%40galileo-press.de.
For more options, visit https://groups.google.com/groups/opt_out.


Can we upgraded from django 1.1.1 to 1.6.1??

2014-01-16 Thread subashg
Can we??

If yes, what are the definite obstacles that we will face while getting it 
done for  MENTORING APPLICATION.

Thanks & Regards
Raj

-- 
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/a32b0893-7e75-46b5-9da7-f774a0fcf71d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Reverse Lookup Failure on password change/reset views

2014-01-16 Thread William Opondo
Hi all, I'm new to django and I am using django 1.6 on my local machine yet 
the version of django on the company server is 1.5.4 thus I get the 
following error:

Reverse for 'django.contrib.auth.views.password_reset_confirm' with arguments 
'()' and keyword arguments '{u'uidb64': u'4', u'token': 
u'3ob-9370053c94189ea07a08'}' not found.

The error occurs when it tries to perform the following line:

{{ protocol }}://{{ domain }}{% url 
'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}

my guess is that there is a change from django 1.5 to 1.6 in how the reverse 
url is matched. How would I then change the code so that it works with the 
older version(1.5), could it be the fact the uidb64 was introduced in 1.6 while 
1.5 uses uidb36. Would that be the only change needed?

 

On Monday, August 19, 2013 1:48:24 PM UTC+2, anentropic wrote:
>
> Hmm, well after looking at the source of the `reverse` method I can see 
> that it's not doing what I imagined it was...
>
> I am so used to always naming my urls in urlconfs, when I saw a full 
> import path to a view function like:
> reverse('django.contrib.auth.views.password_reset_done')
> in the auth/views.py I assumed it ought to find that vew function in 
> whichever urlconf it was defined
>
> Thinking about it, it can't do that because you could easily have more 
> than one url pointing to that function
>
> It means if you have something like this in your root urlconf:
> (r'^accounts/', include('django.contrib.auth.urls', namespace="auth")),
>
> then the reverse isn't going to work because it would have to be:
> reverse('auth:django.contrib.auth.views.password_reset_done')
>
> in short, don't use a namespace on the built-in auth urls
>
> Arguably, the auth views could work out what namespace they're under and 
> handle it though, eg:
> (django/contrib/auth/views.py #147)
> resolver = resolve(request.path)
> ns = ''
> if resolver.namespace:
> ns = resolver.namespace + ':'
> post_reset_redirect = 
> reverse('{0}django.contrib.auth.views.password_reset_done'.format(ns))
>
> (admittedly this assumes you have imported all of the auth urls into the 
> same namespace)
>
> On Monday, 19 August 2013 12:27:57 UTC+1, anentropic wrote:
>>
>> This seems a bug in Django... the `reverse` function is passed the name 
>> of a view function, not a named url, so the fact that the url it's being 
>> asked to match is included under a namespace shouldn't matter?
>>
>> (here because I just hit the same problem myself)
>>
>> On Saturday, 27 July 2013 08:20:18 UTC+1, Peter wrote:
>>>
>>> Yep, that fixed it.  Thanks.
>>>
>>> I still think it's wrong of django not to find it by view name though...
>>>
>>>
 Probably because you've included it under a namespace, so Django would 
 need to look for it as "registration:whatever". There's no need to use the 
 namespace in the include call.
 --
 DR. 

>>>

-- 
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/9722be69-420d-41b3-b254-fac5b45f5ee4%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


error after form validation

2014-01-16 Thread fabricio
I got the following error 


My model http://pastebin.com/2BuE0N0d 


my view http://pastebin.com/48xEPvQz 


  when it reaches this part of the code 

gr_caixafaccao = form_caixafaccao.save (commit = False) 

gr_caixafaccao the object returns me Unable to get repr is  


hence not caught the id. 

can someone help me?

-- 
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/bdb87af4-c57b-4458-9a6c-7e4521f91d29%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Adding an API to an existing Django app

2014-01-16 Thread Dennis Plöger
Hi!

It's me again.

I think, I got the whole thing wrong. Instead of plunging an API to an 
existing WebApp, it would be best to base the WebApp onto the API in the 
first place. I saw, that you can actually do that using the common Rest 
frameworks available, so I'm digging my way through that for now.

If anybody has other interesting ideas, please tell.

Kind regards

Dennis

-- 
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/804ed1e7-4df6-4ec9-ad99-20d1cc1b5002%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mass email app for django

2014-01-16 Thread Diederik van der Boor
Hi Sven,

What you describe sounds like a Mailinglist..
Wouldn't it be possible to use Mailchimp or Aweber for this kind of service?
>From Django you can use their API's.

Mass-mailing has a risk of being blacklisted as server,
at least make sure you send email via a whitelisted SMPT server (and not 
directly to everyone at the web).
For mass-mailing I always recommend using specialized mailinglist software.

Greetings,
Diederik

Op 15 jan. 2014, om 01:42 heeft Sven Aßmann  het volgende 
geschreven:

> Hi Group,
> 
> currently i evaluating / research for a django app that supports mailing 
> specific texts to a receipient list (like mass emailing). the corner features 
> are:
> 
> - email text should be editable (text or html nothing special) thru the admin 
> app
> - the receipient list should be maintainable independently from users and 
> texts (like a addressbook that is maintanale thru admin app)
> - ideally supports several mail backends like smtp, aws sms, postmark etc..
> - processing of the sending can be done async via django cli / message queue 
> services 
> 
> The closest use case app would be something like a newsletter app, where the 
> subscibers can be maintainted apart from django.auth.users
> I am aware of www.djangopackages.com and found already a couple of 
> applications that could make the job.
> 
> I ask you folks if someone has good experience with a specific one and or 
> what 
> features are included and helpfull and what are not that helpfull. 
> 
> I really appreciate your contributions.
> 
> -- 
> 
> 
> Best Regards, 
> Sven
> 
> -- 
> 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/3688706.24zruyElKd%40gilgamesch.
> 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/2A731BC5-4F93-433F-9E04-5267DDC82719%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


ImproperlyConfigured: Error loading psycopg2 module: No module named _psycopg

2014-01-16 Thread Timothy W. Cook
This question is also on Stackoverflow http://goo.gl/LinMue  but I thought
somene here may have an idea.


I have a Django 1.5, Python 2.7 site running under Apache with mod_wsgi on
a CentOS 6.4 server.

I have rebuilt this site using Django 1.6 and Python 3.3. Deploying it to
the same server and changing the paths in httpd.conf I get the subject
error. This new install works as expected using ./manage.py runserver.

Here are the two WSGI definitions from httpd.conf:

WSGIScriptAlias / /home/ccdgen/CCDGEN2/apache/wsgi.py
WSGIPythonPath
/home/ccdgen/CCDGEN2/ccdgen/ccdgen:/home/ccdgen/CCDGEN2/ccdgen:/home/ccdgen/CCDGEN2/lib/python3.3/site-packages
   
 Order allow,deny
 Allow from all
   
#WSGIScriptAlias /ccdgen
/home/ccdgen/CCDGEN/apache/wsgi.py#WSGIPythonPath
/home/ccdgen/CCDGEN/mlhim/ccdgen:/home/ccdgen/CCDGEN/mlhim:/home/ccdgen/CCDGEN/lib/python2.7/site-packages##   # Order allow,deny#
  Allow from all#   #

The wsgi.py file is the same on both installations:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mlhim.settings")from
django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


--

Thanks in advance for any ideas.

Cheers,
Tim


-- 
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%3DOU3XNi7-FGOCPnKS%2Bb6%3D-ueWbPMOWFXfOce663fn0YpjWwQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Problem with Form with ForeignKey field

2014-01-16 Thread Tom Evans
On Wed, Jan 15, 2014 at 8:44 PM, Jonathan Pentecost
 wrote:
> Does it have anything to do with the related name of animal being `+`? I
> can't test this out just yet, but I don't THINK you can have a related_name
> as just `+`, I believe it needs to be a valid identifier.

'+' is perfectly valid for related_name, it means "do not create a
reverse relation".

https://docs.djangoproject.com/en/1.6/ref/models/fields/#django.db.models.ForeignKey.related_name

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1KcDB_59_02dYtPOSN41uYQNQ%2B8MfbNFZF4v8uUtkLK_A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Server return error 304

2014-01-16 Thread Igor Korot
Hi, ALL,
I'm getting an error 304 trying to locate the JavaScript files on my
dev machine.

Here's what I did.
I created a project and then created an application according to the tutorial.
Looking at https://docs.djangoproject.com/en/1.5/howto/static-files/ I
made sure that "STATIC" environment variable is defined.

Here is my structure:

artefacts (project)
|
|> (settings.py, urls.py, wsgi.py)
|
displayusbdata (application)
|
|---> (admin.py, models.py, tests.py, views.py)
|
|--> static
|
|> jqwidgets-ver3.1.0 (JavaScript files)
|
templates
|
|> html
   |
   |---> index.html

Now, the page (index.html) loads fine. When I go to "View->Source" (I
use IE here) I can see the code of the page.
Here is this code:

[code]



Test
{% load staticfiles %}













var data = "{{usb_data}}";
$(document).ready(function(){
var source =
{
localdata: data,
datatype: "json",
datafields:
[
{ name: '"device_name"', type: 'string' },
{ name: '"vid_pid"', type: 'date' },
{ name: '"install"', type: 'date' },
{ name: '"disk_device"', type: 'date' },
{ name: '"volume_device"', type: 'date' },
{ name: '"usb_type"', type: 'string' },
{ name: '"vid"', type: 'string' },
{ name: '"pid"', type: 'string' },
{ name: '"hub"', type: 'number' }
],
id: '"pk"',
root: '"fields"'
};
var dataAdapter = new $.jqx.dataAdapter(source)
//initialize jqxGrid
$("#grid").jqxGrid(
{
source: dataAdapter,
showstatusbar: true,
editable: false,
columns:
[
{ text: 'Device Name', columntype: 'textbox',
datafield: '"device_name"', width: 100 },
{ text: 'VID/PID', columntype: 'textbox', datafield:
'"vid_pid"', width: 50 },
{ text: 'Install', columntype: 'textbox', datafield:
'"install"', width: 50 },
{ text: 'Disk Device', columntype: 'textbox',
datafield: '"disk_device"', width: 50 },
{ text: 'Volume Device', columntype: 'textbox',
datafield: '"volume_device"', width: 50 },
{ text: 'Type', columntype: 'textbox', datafield:
'"usb_type"', width: 100 },
{ text: 'VID', columntype: 'textbox', datafield:
'"vid"', width: 100 },
{ text: 'PID', columntype: 'textbox', datafield:
'"pid"', width: 100 },
{ text: 'Hub', datafield: '"hub"',
cellsalign: 'right', cellsformat: 'n2' }
]
});
});








[/code]
However, on the terminal of my developmental server I see following:

[16/Jan/2014 01:26:05] "GET /usb/ HTTP/1.1" 200 223915
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/styles/jqx.base.css HTTP/1.1" 304
0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxcore.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET /static/jquery-1.10.2.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxdata.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.sort.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxscrollbar.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.filter.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.selection.js HTTP/1.1"
304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.pager.js HTTP/1.1" 304 0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.grouping.js HTTP/1.1" 304
0
[16/Jan/2014 01:26:05] "GET
/static/jqwidgets-ver3.1.0/jqwidgets/jqxgrid.aggregates.js HTTP/1.1"
304 0

Which means that the server returns the 304 error on my jQWidgets files.

What am I missing? Where should I put my jQWidgets files in order to
get 200 and see the page?

Thank you.

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

Sqlalchemy in Django with User Authentication Problem

2014-01-16 Thread Chen Xu
Hi Everyone,
I am using sqlalchemy instead of Django's ORM for my new website, and I am
running into the incompatible user authentication issue,  I am wondering if
there are any good python authentication library that allows both facebook,
google, twitter,etc login and its own email registration?



Thanks in advance

-- 
⚡ Chen Xu ⚡

-- 
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/CACac-qbFhQq%3DZF1t0C8tCEKmkS9o9A%3DRDj-b9b3KemZwBHCLRg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.