PyCharm not stopping at breakpoint

2016-04-18 Thread schaf . mh
HI All,
I have some unit tests (using django-nose). As one was failing I wanted to 
debug the test (to see what's going on), but pyCharm does not stop at the 
breakpoint.
I'm working with Python 2.7.6, Django 1.5.1, django-node 1.2, nose 1.3.3. 
PyCharm 4.5.3

Do you have any ideas?

Thanks
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dca07250-eed1-4f19-b24a-c533c650acab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PyCharm not stopping at breakpoint

2016-04-18 Thread Žan Anderle
Hi,

are you sure that the breakpoint is reached? Maybe the test fails before 
that?

Also, you might want to update your PyCharm, as it is quite a few versions 
behind :)

Best,
Žan

Dne ponedeljek, 18. april 2016 15.04.56 UTC+2 je oseba scha...@gmail.com 
napisala:
>
> HI All,
> I have some unit tests (using django-nose). As one was failing I wanted to 
> debug the test (to see what's going on), but pyCharm does not stop at the 
> breakpoint.
> I'm working with Python 2.7.6, Django 1.5.1, django-node 1.2, nose 1.3.3. 
> PyCharm 4.5.3
>
> Do you have any ideas?
>
> Thanks
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1a939a42-910c-47d5-9343-4d8b2f1d873a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


request user

2016-04-18 Thread Elias Coutinho
Good afternoon people,

I am using django material, LayoutMixin

My view is:

class NewProfissoesPessoaView (LoginRequiredMixin, LayoutMixin,
 extra_views.NamedFormsetsMixin,
 extra_views.CreateWithInlinesView):
   title = "New Job"
   model = ProfissoesPessoa

print ( 'come on line 334')

layout = Layout (
   Row ( 'person', 'profession', 'rating'),
   # Fieldset ( 'Address'
   # Row (Span7 ( 'address'), Span5 ( 'zipcode'))
   # Row (Span5 ( 'city'), Span2 ( 'state'), Span5 ( 'country')))
   Inline ( 'Qualifications Profession', ItemInline)
   )

def form_valid (self, form):
   print ( 'come on line 343')
   profession = self.object.save (commit = False)
   profissao.pessoa = request.user
   profissao.save ()

def get_success_url (self):
   return self.object.get_absolute_url ()



If you look has form_valid function, I'm trying to get my registration can 
be done without having to manually enter the logged in user.

A View only enter if you login, but when loading the template it does not 
meet the user field. (This field wanted to hide)

As I am using django materials needed to create the forms.py

Can someone help me? All he wanted was to save without informing the user 
logged in, he seve be added without the intervention of anyone.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5d3b9d5-dba6-4361-999c-e0467ad69a3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


recuperar user logado

2016-04-18 Thread Elias Coutinho
Boa tarde pessoal,

Estou utilizando django material, LayoutMixin

Minha View é a seguinte:

class NewProfissoesPessoaView(LoginRequiredMixin,LayoutMixin,
 extra_views.NamedFormsetsMixin,
 extra_views.CreateWithInlinesView):
   title = "Nova Profissão"
   model = ProfissoesPessoa

print('Chegou na linha 334')

layout = Layout(
   Row('pessoa', 'profissao', 'rating'),
   # Fieldset('Address',
   #  Row(Span7('address'), Span5('zipcode')),
   #  Row(Span5('city'), Span2('state'), Span5('country'))),
   Inline('Qualificações da Profissão', ItemInline),
   )

def form_valid(self, form):
   print('Chegou na linha 343')
   profissao = self.object.save(commit=False)
   profissao.pessoa = request.user
   profissao.save()

def get_success_url(self):
   return self.object.get_absolute_url()





Se observarem tem a função form_valid, que estou tentando fazer com que meu 
cadastro possa ser feito sem ter que informar manualmente o user logado.

A View só entra se fizer login, mas ao carregar o template ele não preenche 
o campo de user. (Este campo queria ocultar)

Como estou utilizando django material não precisei criar o forms.py

Alguém pode me ajudar? Tudo que queria era salvar sem precisar informar o 
user logado, ele seve ser adicionado sem intervenção de ninguém.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d0a81003-4f92-4a48-8c22-b341ed3268ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


My Form is not persisted

2016-04-18 Thread Douglas Bonafe
Helo everybody.
Could someone answer me this question on stackoverflow?

http://stackoverflow.com/questions/36703456/django-my-form-isnt-persisting-on-database

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


Re: Migrations force me to have, forever, any name/reference I use in field validators=, choices=, whatever, valid forever (even if the requirements change).

2016-04-18 Thread marcin . j . nowak


On Friday, February 27, 2015 at 11:22:13 PM UTC+1, Gergely Polonkai wrote:
>
> Hello,
>
> another solution may be to patch your models in the migration module or 
> class
>


The best solution is not to use Django built-in migrations. Of course you 
can create them very quickly (via automatic "makemigrations"), but this is 
probably just the only advantage. Everyting else is something what I'm 
calling "built-in hell". 

Try to use external solutions like Liquibase. But remember - you'll need to 
track builtin schema changes (as a part of "builtin-hell") and converting 
3rd app migrations. 
Also guys from Django Team removed very useful command - `sql`, which was a 
base tool for speeding up of Liquibase changesets creation. But until you 
know what you're doing, you can write every change manually. As a result 
you're getting rock-solid db schema management without python imports 
problem, without historical problems nor models, without strange squashing 
ideas, refactoring horror, and so on... 

Kind Regards,
Marcin

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4cc59dcd-782c-46f3-afe2-3c16f61d57f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PyCharm not stopping at breakpoint

2016-04-18 Thread Fred Stluka

  
  
Schaf,

Yes, I've seen that.  In my case, it's not a bug.  It's an
intentional
design decision that is necessary for a symbolic debugger to 
work the way you want it to.  Happens in all symbolic debuggers, 
including PyCharm.

Here's a explanation I sent my team recently:


Team,

I just figured out something that has been a mystery to me for
a while.

In some cases, I've found that the PyCharm debugger does 2
weird things:
A. Runs the code differently when I step through it than when I 
    run it flat out
B. Skips breakpoints that I've set (even if I'm very careful to 
    have only one Run and/or Debug tab running at a time)

I figured out why.  It's a problem common to all symbolic 
debuggers but it doesn't come up very often, so I hadn't had 
to think about it for a while.  It's bitten me a few times lately 
because I've been doing detailed debugging of the validation 
code that Django runs for forms.

Basically, the problem is that there are 2 things symbolic 
debuggers typically do:
1. Execute code internally to compute values to show you in 
    the Variables and Watches frames of the debugger
2. Skip any breakpoints that occur while executing such code
    internally

The standard Django Form class has this code:

    def _get_errors(self):
    "Returns an ErrorDict for the data provided for the
  form"
    if self._errors is None:
    self.full_clean()
    return self._errors
    errors = property(_get_errors)

So, errors is a property that calls _get_errors() whenever 
PyCharm tries to get its value to show it to me, which happens 
each time I hit a breakpoint or single-step past a line of code.
But probably only if I have the Variables pane open with the 
tree expanded to show the value of errors.

The first time it's called, _get_errors() notices that _errors is 
None, and calls full_clean(), which sets _errors to an ErrorDict.
After that, it never calls full_clean() again.

Our clean() methods and other validation code are called by 
full_clean().

I was trying to debug our clean() method, and had set a 
breakpoint there.  But PyCharm doesn't hit breakpoints there 
when it's running the code internally to compute a value to 
show it me.  See #2 above.

The first evaluation of errors is the only one that calls 
full_clean() and that was happening much earlier when I was
poking around in the debugger, peeking at things to see if 
they had changed yet, than when I was running the code flat 
out.  See #1 above.

The upshot was that my breakpoint was never being hit.  I had
to add logging statements to convince myself it was really 
running, and to debug what was going wrong.

In a nutshell: "Holy Heisenberg Uncertainty Principal, Batman!"

--Fred
  
  Fred Stluka -- mailto:f...@bristle.com --
  http://bristle.com/~fred/
  
  Bristle Software, Inc -- http://bristle.com -- Glad to be of
  service!
  
  Open Source: Without walls and fences, we need no Windows or
  Gates.
  

On 4/18/16 9:04 AM, schaf...@gmail.com
  wrote:


  HI All,
I have some unit tests (using django-nose). As one was failing I
wanted to debug the test (to see what's going on), but pyCharm
does not stop at the breakpoint.
I'm working with Python 2.7.6, Django 1.5.1, django-node 1.2,
nose 1.3.3. PyCharm 4.5.3

Do you have any ideas?

Thanks
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 https://groups.google.com/group/django-users.
  To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dca07250-eed1-4f19-b24a-c533c650acab%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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/57157C96.30701%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


No Downtime Code Releases

2016-04-18 Thread bliyanage
Hey,

I have two issues I'm looking at solving at work, and I'm looking for a 
couple suggestions as to how other people have solved this.  The two things 
are:

* scale out their django installation to allow for smaller releases (I'm 
thinking microservices, but it could also be internal django apps or who 
knows what else)
* minimizing the impact of migrations during releases (aka we want to be 
able to release in the middle of the afternoon

Currently we put up a maintenance page whenever we are doing database 
operations (aka migrations).  This seems like a recommended best practice.

One way I was thinking about addressing this issue was to break all of our 
models out into a separate repo.  That way we'd only need to deploy 
migrations when the models themselves have deployed.  For code that needs 
the models, we could pip install the repo as an app and away we go.  
Likewise it seems like I could break up different parts of our app via a 
similar strategy.

Does this seem viable?  How have other people solved this kind of problem?

Thanks,

-Ben

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e5fd0359-9e8b-4cce-b3e1-4880951a2a8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.