Re: translation of view messages and business related messages not working

2014-10-30 Thread Ramiro Morales
On Oct 30, 2014 8:45 PM, "Marcela Campo"  wrote:
>
> Hi,
>   I am using the translation functionality in Django 1.7 successfully for
plain strings in a template, so something simple like
>
> {% trans "Edit Client" %}
>
> works just fine.
>
>
> I am now trying to translate success_message from views with the
SuccessMessageMixin and also error messages that bubble up from business
logic but I just can't make those work.The messages show up for translation
in the .po file. For example:
>
> # python-format
> #: views/adminDashboard.py:158
> #, python-format
> msgid "Productive Unit %(name)s has been created."
> msgstr "La Unidad Productiva %(name)s ha sido creada."
>
> I have compiled the messages already.
>
> In my view
>
> 
> 
> from django.utils.translation import ugettext as _

Try replacing ugettext with ugettext_lazy. Read the relevante documentation
for the details.

> class CustomerFieldUpdateView(AdminRequiredMixin, SuccessMessageMixin,
UpdateView):
> model = Field
> template_name = 'ui/field_update_form.html'
> success_message = _('Productive Unit %(name)s has been updated.')
> .
>
> In the template:
> 
> {% load i18n %}
> 
> {% if messages %}
> {% for message in messages %}
>   {{ message }}
> {% endfor %}
> {% endif %}
> 
>
>
> If I look at self.request.LANGUAGE_CODE in the view is set to 'es' but
still the messages that bubble up from python code are displayed in the
default ('en') whereas the plain strings in the template are correctly
translated to spanish. I also tried using {% trans message.message %} or
blocktrans as well, but nothing works.
>
> Any ideas what I am missing?
>
> Thanks!!!
> Marcela
>
>
>
>
>
> --
> 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/be1ce953-ccee-4016-b4d6-686655755986%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CAO7PdF8vJ5fx57V5CqmYqgtz_7Y5V%3DPNV_tx0XzgKBDXcGiMNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


translation of view messages and business related messages not working

2014-10-30 Thread Marcela Campo
Hi,
  I am using the translation functionality in Django 1.7 successfully for 
plain strings in a template, so something simple like

{% trans "Edit Client" %} 

works just fine.


I am now trying to translate success_message from views with the 
SuccessMessageMixin and also error messages that bubble up from business 
logic but I just can't make those work.The messages show up for translation 
in the .po file. For example:

# python-format
#: views/adminDashboard.py:158
#, python-format
msgid "Productive Unit %(name)s has been created."
msgstr "La Unidad Productiva %(name)s ha sido creada."

I have compiled the messages already.

In my view



from django.utils.translation import ugettext as _
class CustomerFieldUpdateView(AdminRequiredMixin, SuccessMessageMixin, 
UpdateView):
model = Field
template_name = 'ui/field_update_form.html'
success_message = _('Productive Unit %(name)s has been updated.')
.

In the template:

{% load i18n %}

{% if messages %}
{% for message in messages %}
  {{ message }}
{% endfor %}
{% endif %}



If I look at self.request.LANGUAGE_CODE in the view is set to 'es' but 
still the messages that bubble up from python code are displayed in the 
default ('en') whereas the plain strings in the template are correctly 
translated to spanish. I also tried using {% trans message.message %} or 
blocktrans as well, but nothing works. 

Any ideas what I am missing?

Thanks!!! 
Marcela





-- 
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/be1ce953-ccee-4016-b4d6-686655755986%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Actively developed/supported piston fork?

2014-10-30 Thread Russell Keith-Magee
Hi,

On Thu, Oct 30, 2014 at 5:34 PM,  wrote:

> I've inherited an app that was written for Django 1.4, and updated it to
> Django 1.7.
>
> I've noticed lots of forks of Piston on the web.
>
> Are any being actively used/fixed/supported?  Which one should I try?
>
> Is anyone who has a fork that they are keeping up to date on this mailing
> list?
>
> Finally - if it makes more sense to replace piston with something else,
> what would be the easiest thing to replace it with?
>
> Thanks!
>

I'm not aware of any actively maintained fork of Piston. The bulk of the
energy around REST tools in the Django community has moved to Django REST
Framework:

http://www.django-rest-framework.org

It's not a drop-in replacement for Piston, though - you'll need to do some
re-engineering.

Yours,
Russ Magee %-)

-- 
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-p_MvcpCeJmcCSM-fP%3DVJsddd%3D-S16%3DGhu%2BZRiaqn4Hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Get form from modelformset by the model associated in template

2014-10-30 Thread Luigi Cirillo
Hi all,
I think it is a simple question but I don't know how I can get the specific 
form associated to a model from a modelformset inside a template.
In other words I am extending a ListView and I pass a modelformset through 
the context.
So in the template:
{% for object in object_list %}
{{ object.field }}
{{ which form of modelformset? }}
{% endfor %}

Thank you,
Luigi

-- 
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/8c6a7fc4-420c-4ebc-ad74-ea16ddcea058%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pip type error.

2014-10-30 Thread sasidhar puranam
Thank you ..it helped !

On Saturday, 21 June 2014 12:19:09 UTC+5:30, Timmy Blumberg wrote:
>
> This is a much needed solution to a problem that has been plaguing my 
> development cycle for weeks. Many "thankyous", stranger.
>
> On Thursday, March 27, 2014 7:06:00 AM UTC-7, Dylan F. wrote:
>>
>> Thanks Brian! The out-file command with ascii encoding specified fixed 
>> this for me. 
>>
>> On Wednesday, September 26, 2012 1:55:31 AM UTC-4, Brian Peiris wrote:
>>>
>>> Thanks John, that was useful. 
>>> This happens because powershell outputs UTF-16 by default. Another way 
>>> to fix it is by using the out-file command with an ascii encoding specified:
>>>
>>> pip freeze | out-file -enc ascii requirements.txt
>>>
>>> On Sunday, March 11, 2012 4:17:59 AM UTC-4, John W. wrote:

 I know it's weird to reply to myself, but just in case that somebody 
 has the same problem. 

 It seems that the problem it is in the requirements.txt, i created it 
 using powershell and "pip.exe freeze > requirements.txt" command,
 which creates a file with a name that has nullbytes in it. 
 I was able to get around this problem by downloading a requirements.txt 
 from an example project on github and modifying it.
 That did the job and everything works nice.


 On Saturday, March 10, 2012 6:06:23 PM UTC+2, John W. wrote:
>
> Hi. I want to deploy a Django project on Heroku. The logic it's 
> straightforward : create a virtualenv, install django, some other stuff, 
> pip freeze into requirements.txt, create a git repository and git push it 
> to project's repository. From what i've seen it seems like the service 
> downloads the project and install virtualenv and pip on virtual server 
> and 
> it uses pip to install dependencies listed in requirments.txt . While 
> pushing to remote server it looks like everything goes nicely until pip 
> starts to install dependencies and then a error happens. I'm new to pip 
> so 
> maybe someone already seen this error. Thank you in advance.
>
> Console snapshot:
>
> ψ pip.exe freeze
> Django==1.3.1
> distribute==0.6.24
> versiontools==1.8.3
> (venv)
>
> ψ more .\requirements.txt
> Django==1.3.1
> distribute==0.6.24
> versiontools==1.8.3
>
> (venv)
>
> ψ git push heroku master
> Enter passphrase for key '/c/Program Files (x86)/Vim/.ssh/id_rsa':
> Counting objects: 12, done.
> Delta compression using up to 2 threads.
> Compressing objects: 100% (10/10), done.
> Writing objects: 100% (12/12), 3.30 KiB, done.
> Total 12 (delta 2), reused 0 (delta 0)
>
> -> Heroku receiving push
> -> Python/Django app detected
> -> Preparing virtualenv version 1.7
>New python executable in ./bin/python
>Installing 
> distribute.done.
>Installing pip...done.
> -> Activating virtualenv
> -> Installing dependencies using pip version 1.0.2
>Exception:
>Traceback (most recent call last):
>  File 
> "/tmp/build_k6zl66ydgqxp/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/basecommand.py",
>  line 126, in main
>self.run(options, args)
>  File 
> "/tmp/build_k6zl66ydgqxp/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/commands/install.py",
>  line 200, in run
>for req in parse_requirements(filename, finder=finder, 
> options=options):
>  File 
> "/tmp/build_k6zl66ydgqxp/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/req.py",
>  line 1255, in parse_requirements
>req = InstallRequirement.from_line(line, comes_from)
>  File 
> "/tmp/build_k6zl66ydgqxp/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/req.py",
>  line 82, in from_line
>elif os.path.isdir(path) and (os.path.sep in name or 
> name.startswith('.')):
>  File "/tmp/build_k6zl66ydgqxp/lib/python2.7/genericpath.py", 
> line 41, in isdir
>st = os.stat(s)
>TypeError: must be encoded string without NULL bytes, not str
>
>Storing complete log in /app/.pip/pip.log
>
>  ! Heroku push rejected, failed to compile Python/django app 
>


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

Re: re-apply migrations on restored database

2014-10-30 Thread Héctor Urbina
a ha!

I see the table on the restored database. I always though that running the
dump.sql would build an exact copy of the original database, but now I'm
thinking it just drops and rebuilds the existing original tables. I will
manually drop my dev database and then restore the dump again... and see
what happens...

Thanks,
H.

2014-10-30 15:14 GMT-03:00 Markus Holtermann :

> Hey Hector,
>
> There is a database table called "django_migrations" that is used to keep
> track of the applied migrations. I guess it's not documented, because
> touching it shouldn't ever be necessary.
>
> It would be interesting to see how you ended up in a state that Django
> thinks all migrations have been applied, though.
>
> /Markus
>
>
> On October 30, 2014 7:07:02 PM CET, "Héctor Urbina" 
> wrote:
>>
>> Hello,
>>
>> I'm working on a development branch for a django (1.7) project. I have a
>> couple of migrations, including a data migration, in this branch; and I
>> already applied the migrations. After that, I took a dump of the production
>> database (which didn't have those migrations, of course) and restored it to
>> use in development. So, first thing I need to do is to re-apply all the
>> development migrations to the database "again", but django says "no
>> migrations to apply".
>>
>> I can't find in the documentation how is that django knows what
>> migrations have been applied so far, or if there is a way of changing that,
>> in order to re-apply them.
>>
>> Any help would be appreciated,
>>
>> Hector.
>>
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>



-- 
Héctor Urbina S.
Ingeniero en Bioinformática
Fono: 82049138

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


Re: re-apply migrations on restored database

2014-10-30 Thread Markus Holtermann
Hey Hector,

There is a database table called "django_migrations" that is used to keep track 
of the applied migrations. I guess it's not documented, because touching it 
shouldn't ever be necessary.

It would be interesting to see how you ended up in a state that Django thinks 
all migrations have been applied, though.

/Markus

On October 30, 2014 7:07:02 PM CET, "Héctor Urbina"  wrote:
>Hello,
>
>I'm working on a development branch for a django (1.7) project. I have
>a
>couple of migrations, including a data migration, in this branch; and I
>already applied the migrations. After that, I took a dump of the
>production
>database (which didn't have those migrations, of course) and restored
>it to
>use in development. So, first thing I need to do is to re-apply all the
>development migrations to the database "again", but django says "no
>migrations to apply".
>
>I can't find in the documentation how is that django knows what
>migrations
>have been applied so far, or if there is a way of changing that, in
>order
>to re-apply them.
>
>Any help would be appreciated,
>
>Hector.
>
>-- 
>Héctor Urbina S.
>Ingeniero en Bioinformática
>Fono: 82049138
>
>-- 
>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/CADHcORjtM2ywhbMGZWDrsatReCz1_H76JrX_axo6mysTL-xH2Q%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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/EB185059-7189-43EE-BCBA-77EBCB83AB9C%40markusholtermann.eu.
For more options, visit https://groups.google.com/d/optout.


re-apply migrations on restored database

2014-10-30 Thread Héctor Urbina
Hello,

I'm working on a development branch for a django (1.7) project. I have a
couple of migrations, including a data migration, in this branch; and I
already applied the migrations. After that, I took a dump of the production
database (which didn't have those migrations, of course) and restored it to
use in development. So, first thing I need to do is to re-apply all the
development migrations to the database "again", but django says "no
migrations to apply".

I can't find in the documentation how is that django knows what migrations
have been applied so far, or if there is a way of changing that, in order
to re-apply them.

Any help would be appreciated,

Hector.

-- 
Héctor Urbina S.
Ingeniero en Bioinformática
Fono: 82049138

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


Re: DB foreign key constraints : Django 1.7 regression ?

2014-10-30 Thread Carl Meyer
On 10/30/2014 06:09 AM, nots...@gmail.com wrote:
> Thanks Daniel, that was it (instead of removing the migrations folder, I
> now use makemigrations).
> 
> I expected everything to work without the need of migrations.
> So I guess that with django 1.7, it is simply mandatory to use migrations.
> 
> It is indeed stated
> in 
> https://docs.djangoproject.com/en/1.7/topics/migrations/#unmigrated-dependencies
> 
> I guess adding a nice big system check would have helped me !
> Is that addition worthy of a ticket ?

I'm not sure off the top of my head how feasible such a check would be,
but in principle I think it would be a good idea - so yes, I'd recommend
opening a ticket.

Carl



signature.asc
Description: OpenPGP digital signature


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-10-30 Thread Tom Evans
On Thu, Oct 30, 2014 at 2:54 PM, bobhaugen  wrote:
> On Wednesday, October 29, 2014 12:26:01 PM UTC-5, Chris Hawkes wrote:
>>
>> All this being said, there is definitely a trend towards SPA's.
>>
>
> Does anybody else besides me hate the SPA trend?  I much prefer apps that
> are separated into logical components where each component has its own URL,
> rather than an a seemingly-infinite scroll.
>

SPAs can (should) be separated into logical components that have their
own URLs - the fact that those distinct URLs load an SPA in to
specific states is desirable.

The trouble with SPAs is that people get tempted to do "un-webby"
things - SOLR's web interface springs to mind, the "application"
regularly polls the server to see if it is still there. If it is not,
it shades the page, making everything on the page unselectable and
says "instance gone away". All you can do then is reload the page when
it comes back, which loses anything input to that page.

OTOH, gmail is a SPA with deep links that work correctly and don't
ever cause problems. It does paging instead of infinite scroll.

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/CAFHbX1JwEtY1odiyuiXu8e_bexpNzF43MDeUM-e4e8Uued%3DnsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Calling a function for a url tag parameter

2014-10-30 Thread Daniel Grace
Hi,
I am trying to use the url tag on some parameters, one of which needs to 
come from a function.
For example as follows:
{% with state_url=encode_url flow.state.description %}
advance

encode_url is defined as follows:
@register.simple_tag
def encode_url(link_text):
return link_text.replace(' ', '_')

This causes an error on the with statement:
Request Method: GET
Request URL: http://127.0.0.1:8000/list_flows/
Django Version: 1.7
Exception Type: TemplateSyntaxError
Exception Value: 
'with' received an invalid token: 'flow.state.description'

I'm guessing that you cannot put another template tag in the "with" 
statement.  I cannot see a way around this.  Any ideas?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9a93cbaf-0f47-41d5-9eea-e6d3297caeac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: pycurl and SSLv3

2014-10-30 Thread Erik Cederstrand
> Den 30/10/2014 kl. 15.50 skrev john :
> 
> On the server side of my Django website I use pycurl (version 7.20.x) to 
> connect to authorize.net (to send credit card info).  On Nov 4 Authorize.net 
> will turn off SSLv3.  So I'm wondering if my use pycurl will continue to 
> work.  To be honest I haven't thought about it much since the pycurl seem to 
> take care of everything that Authorize.net required.  Now I'm questioning if 
> pycurl will continue to work and if I need to change anything - what do I 
> chan.
> 
> c=pycurl.Curl()
>c.setopt(c.URL, GatewayURL)
>c.setopt(c.POST, TRUE)
>c.setopt(c.SSL_VERIFYPEER, FALSE)


This would depend on the version of libcurl on your server, and ultimately on 
the version of libssl.

I assume authorize.net will only accept TLS, so just force the SSL version and 
test if it works. Something like this should do:

  c.setopt(c.SSLVERSION, c.CURL_SSLVERSION_TLSv1_2)


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/D25E117E-82AF-4076-86AE-342FC7FD2571%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Do you think Django's future is threatened by JS frameworks in both client & server?

2014-10-30 Thread bobhaugen
On Wednesday, October 29, 2014 12:26:01 PM UTC-5, Chris Hawkes wrote:
>
> All this being said, there is definitely a trend towards SPA's.  
>
>
Does anybody else besides me hate the SPA trend?  I much prefer apps that 
are separated into logical components where each component has its own URL, 
rather than an a seemingly-infinite scroll.

-- 
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/89172ae2-33de-4b36-8c36-d579fc31c8c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


pycurl and SSLv3

2014-10-30 Thread john

Hi,

On the server side of my Django website I use pycurl (version 7.20.x) to 
connect to authorize.net (to send credit card info).  On Nov 4 
Authorize.net will turn off SSLv3.  So I'm wondering if my use pycurl 
will continue to work.  To be honest I haven't thought about it much 
since the pycurl seem to take care of everything that Authorize.net 
required.  Now I'm questioning if pycurl will continue to work and if I 
need to change anything - what do I chan.


 c=pycurl.Curl()
c.setopt(c.URL, GatewayURL)
c.setopt(c.POST, TRUE)
c.setopt(c.SSL_VERIFYPEER, FALSE)


Thanks in advance,
Johnf


--
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/54525024.4010905%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.


Re: Override

2014-10-30 Thread Avraham Serour
this is why VCS were created for.
if the project is already under git, just clone and don't push

On Thu, Oct 30, 2014 at 6:09 AM, Julien Romagnoli <
julien.romagn...@gmail.com> wrote:

> Hello Guys,
>
> I'm working on the an existing project with django,
> but i need to change some behavior of this project for personal use.
>
> but the problem is if i change some part of code of the project after it
> will be complicate to apply the next update with git
>
> that why i'm trying to find a way for override some function, but without
> change the original code
>
> Best 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/fbef1cb5-1528-4279-88aa-8fb014fcd1ab%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6tJmNZqjw%2BHvL9f5S9tVWWB7LYd5hEayaNn73e9xgqXYCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy with wsgi causes python library to fail.

2014-10-30 Thread Tom Evans
On Wed, Oct 29, 2014 at 1:44 PM, Bohdan Anderson
 wrote:
> I can run in the testing server fine (python manage.py runserver
> 0.0.0.0:8000) but once I deploy to the server I'm not even getting the
> django error page in response to it's failure.
> I looked into the apache log files and all I get is a generic error message
> "[notice] child pid 17364 exit signal Segmentation fault (11)".
> I thought it might be because apache is run by a different user, so I rand
> django with the test server and it works fine for the apache user.
>
> My question is what should my next steps be in debugging, has any one else
> encountered this before?
>
> what I'm using is
> Debian
> MySQL
> Apache
> Django
> and the python package that is not working is librets
>
> Any direction would be appreciated.

Get a core dump, (get debug symbols for python+httpd), run gdb on the
coredump, get a backtrace.

Is the suspected package installed as an egg by any chance?

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/CAFHbX1KZAEjp3Vd%3D_jhQ8rucuiFix5ik3yQKAhP5ZV6Y7N6w7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django query in DetailView

2014-10-30 Thread Collin Anderson
Hello,

I _think_ your code looks right to me, though the query / or_query code is 
confusing. Print statements could be helpful there to be sure it's actually 
filtering something.

Does this code work?

def searchcandidate(request):
query_string = request.GET.get('q', '').strip()
found_entries = []
if query_string:
found_entries = CandidateToJob.objects.order_by('-candidate')
for term in query_string.split():  # or call your normalize_query() 
here
q = Q()
for field_name in ['candidate__user__first_name', 
'candidate__user__last_name']:
q |= Q(**{"%s__icontains" % field_name: term})
found_entries.filter(q)
return render(request, 'dashboard/candidates_results.html', {
'query_string': query_string, 'found_entries': found_entries})

Collin

-- 
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/a5b873e8-6311-47e4-bf7c-382a97288c25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: "Raw query must include the primary key" when inheriting models

2014-10-30 Thread Collin Anderson
Hi Tobias,

Based on your database query, it looks like you are not doing multiple 
table inheritance, but your models are set up for multiple table 
inheritance.
https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance

Why not just have a status field on your Campaign model? Django expects 
each (non abstract, non proxy) model to map to a database table.

If you are doing multiple table inheritance, I'm guessing the primary key 
that django is expecting would be the auto generated campaign_ptr_id, which 
would live on the campaignext table.

In you are doing multiple table inheritance, why not just 
do CampaignExt.objects.get(id=campaign_id) ?

Collin

-- 
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/5b9df009-5c6c-4808-8964-98e871d85fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy with wsgi causes python library to fail.

2014-10-30 Thread Collin Anderson
Hello,

Ouch.  Segmentation faults are never a good sign.

How do you know that it's librets that's not working?

You may want to open an issue at librets or ask on the mod-wsgi list.

Collin

-- 
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/c8f037e7-46d3-4730-a22e-42ac951e0da8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DB foreign key constraints : Django 1.7 regression ?

2014-10-30 Thread notsqrt
Thanks Daniel, that was it (instead of removing the migrations folder, I 
now use makemigrations).

I expected everything to work without the need of migrations.
So I guess that with django 1.7, it is simply mandatory to use migrations.

It is indeed stated 
in 
https://docs.djangoproject.com/en/1.7/topics/migrations/#unmigrated-dependencies

I guess adding a nice big system check would have helped me !
Is that addition worthy of a ticket ?

Thanks

NotSqrt

Le jeudi 30 octobre 2014 12:53:28 UTC+1, Daniel Roseman a écrit :
>
> On Wednesday, 29 October 2014 17:53:40 UTC, not...@gmail.com wrote:
>>
>> Hi !
>>
>> Just tested the following:
>>
>>- create clean DB
>>- run syncdb
>>- compare obtained tables when using Django 1.6.8 and Django 1.7.1
>>
>> My findings :
>>
>> In Django 1.7, some fields with models.ForeignKey no longer get the DB 
>> constraint.
>>
>> In Django 1.6, I indeed get (in postgresql) for instance:
>> CONSTRAINT TABLE_FIELD_id_fkey FOREIGN KEY (FIELD_id)
>>   REFERENCES django_content_type (id) MATCH SIMPLE
>>   ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
>> DEFERRED,
>>
>> The models for which it fails are always:
>>
>>- ContentType
>>- Auth.Group
>>- Auth.permission
>>- django_site
>>
>> My local apps are always defined after "django.contrib.contenttypes" and 
>> "django.contrib.auth" in INSTALLED_APPS.
>> Putting "django.contrib.contenttypes" as my last app does not change the 
>> DB construction.
>>
>> So does it have to do with the order in INSTALLED_APPS ?
>> Is it a regression ?
>>
>> Thanks for the input !
>>
>> NotSqrt
>>
>>
> Have you tried putting contenttypes and auth as dependencies in your 
> migration?
> --
> 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/cc7233d8-04ff-4c0f-9023-afda35ea7001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: DB foreign key constraints : Django 1.7 regression ?

2014-10-30 Thread notsqrt
Hi !

I have identified very reproducible steps (cf attached file).

It fails with a single app with a single model with single field which is a 
foreign key to ContentType.
Testable instantly with tox :

   - install django and tox in your prefered env
   - run steps.sh wichi will create all files.
   - configure the settings (postgresql, db name, password, ..), add the 
   "example" app to the INSTALLED_APPS
   - run tox from the "fkregression" folder

I coded a test that checks for the actual foreign keys in the system table 
of PostgreSQL, looking for multiple foreign keys.
It passes on django 1.5 and 1.6, but fails with django 1.7

I will fill a bug with similar info.

NotSqrt




Le mercredi 29 octobre 2014 22:37:05 UTC+1, Carl Meyer a écrit :
>
> Hi NotSqrt, 
>
> On 10/29/2014 11:53 AM, not...@gmail.com  wrote: 
> > Just tested the following: 
> > 
> >   * create clean DB 
> >   * run syncdb 
> >   * compare obtained tables when using Django 1.6.8 and Django 1.7.1 
> > 
> > My findings : 
> > 
> > In Django 1.7, some fields with models.ForeignKey no longer get the DB 
> > constraint. 
> > 
> > In Django 1.6, I indeed get (in postgresql) for instance: 
> > CONSTRAINT TABLE_FIELD_id_fkey FOREIGN KEY (FIELD_id) 
> >   REFERENCES django_content_type (id) MATCH SIMPLE 
> >   ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
> > DEFERRED, 
> > 
> > The models for which it fails are always: 
> > 
> >   * ContentType 
> >   * Auth.Group 
> >   * Auth.permission 
> >   * django_site 
> > 
> > My local apps are always defined after "django.contrib.contenttypes" and 
> > "django.contrib.auth" in INSTALLED_APPS. 
> > Putting "django.contrib.contenttypes" as my last app does not change the 
> > DB construction. 
> > 
> > So does it have to do with the order in INSTALLED_APPS ? 
> > Is it a regression ? 
>
> I don't have time to look into this and try to reproduce at the moment, 
> but if the situation is as you've described it (and it's not due to 
> something else specific to your project), it is certainly a regression 
> and a bug. If you can reproduce with a fixed set of steps (starting from 
> a fresh "startproject" for each Django version), please do file a bug at 
> code.djangoproject.com with those reproduction instructions. Thanks! 
>
> Carl 
>
>

-- 
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/d957d88e-b590-481e-b588-76391cb33bbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
django-admin startproject fkregression
cd fkregression/
./manage.py startapp example

rm -rf example/migrations example/admin.py example/views.py

cat >example/models.py <<'EOT'
from django.contrib.contenttypes.models import ContentType
from django.db import models


class MyModel(models.Model):

content_type = models.ForeignKey(ContentType, verbose_name="Content type of Object")
EOT

cat >example/tests.py <<'EOT'
from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Permission
from django.db import connection
from example.models import MyModel

# query that returns tuples (foreign key column, source table, foreign table)

LIST_FOREIGN_KEY_QUERY = """SELECT pg_attribute.attname AS column, source_table.relname AS source_table, foreign_table.relname AS foreign_table
FROM pg_constraint

INNER JOIN pg_class as foreign_table
ON confrelid = foreign_table.oid

INNER JOIN pg_class as source_table
ON conrelid = source_table.oid

INNER JOIN pg_attribute
ON pg_constraint.conkey @> ARRAY[pg_attribute.attnum] AND pg_attribute.attrelid = source_table.oid

WHERE contype = 'f'  -- limit to foreign keys
"""


class TestFK(TestCase):

def test_connection(self):

cursor = connection.cursor()
cursor.execute('SELECT current_database()')
self.assertEqual(cursor.fetchone()[0], 'test_test_fk')

cursor.execute(LIST_FOREIGN_KEY_QUERY)

foreign_keys = set(cursor)

some_expected_foreign_keys = {
("content_type_id", Permission._meta.db_table, ContentType._meta.db_table),
("content_type_id", LogEntry._meta.db_table, ContentType._meta.db_table),
}

self.assertLess(some_expected_foreign_keys, foreign_keys)
self.assertIn(
("content_type_id", MyModel._meta.db_table, ContentType._meta.db_table),
foreign_keys
)
EOT

echo "add 'example' to INSTALLED_APPS"
echo "configure DB."
# I use
## DATABASES = {
## 'default': {
## 'ENGINE': 

Re: DB foreign key constraints : Django 1.7 regression ?

2014-10-30 Thread Daniel Roseman
On Wednesday, 29 October 2014 17:53:40 UTC, not...@gmail.com wrote:
>
> Hi !
>
> Just tested the following:
>
>- create clean DB
>- run syncdb
>- compare obtained tables when using Django 1.6.8 and Django 1.7.1
>
> My findings :
>
> In Django 1.7, some fields with models.ForeignKey no longer get the DB 
> constraint.
>
> In Django 1.6, I indeed get (in postgresql) for instance:
> CONSTRAINT TABLE_FIELD_id_fkey FOREIGN KEY (FIELD_id)
>   REFERENCES django_content_type (id) MATCH SIMPLE
>   ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY 
> DEFERRED,
>
> The models for which it fails are always:
>
>- ContentType
>- Auth.Group
>- Auth.permission
>- django_site
>
> My local apps are always defined after "django.contrib.contenttypes" and 
> "django.contrib.auth" in INSTALLED_APPS.
> Putting "django.contrib.contenttypes" as my last app does not change the 
> DB construction.
>
> So does it have to do with the order in INSTALLED_APPS ?
> Is it a regression ?
>
> Thanks for the input !
>
> NotSqrt
>
>
Have you tried putting contenttypes and auth as dependencies in your 
migration?
--
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/87f58ef0-46b0-4086-adaa-b72b3501598c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Review copies available for “Web Development with Django Cookbook”

2014-10-30 Thread Sunitha Palanna
 

We have a few e-copies of *Web Development with Django Cookbook* (
https://www.packtpub.com/web-development/web-development-django-cookbook
) available for review. 

 

If interested, just drop a line in the comments below with following 
required details:

1. Email address

2. Choice of website for posting your book-review (can be your blog or 
website, Amazon.com and/or Goodreads.com)

You can even directly send me an email at sunit...@packtpub.com

P.S: Limited copies available.

https://www.packtpub.com/web-development/web-development-django-cookbook

-- 
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/703d230d-ef7e-4cf3-9bd4-8f8174323164%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Actively developed/supported piston fork?

2014-10-30 Thread samslists
I've inherited an app that was written for Django 1.4, and updated it to 
Django 1.7.

I've noticed lots of forks of Piston on the web.

Are any being actively used/fixed/supported?  Which one should I try?

Is anyone who has a fork that they are keeping up to date on this mailing 
list?

Finally - if it makes more sense to replace piston with something else, 
what would be the easiest thing to replace it with?

Thanks!

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


Override

2014-10-30 Thread Julien Romagnoli
Hello Guys,

I'm working on the an existing project with django, 
but i need to change some behavior of this project for personal use.

but the problem is if i change some part of code of the project after it 
will be complicate to apply the next update with git

that why i'm trying to find a way for override some function, but without 
change the original code 

Best 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/fbef1cb5-1528-4279-88aa-8fb014fcd1ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.