Is it possible to cleanly override another app's URL namespace in Django 1.11?

2017-05-17 Thread Robert Rollins
I have a project where I want to override a subset of the URLs provided by 
one of the third-party apps I have installed. I did so months ago, and it 
works just fine. However, once I upgraded to Django 1.11, I started seeing 
this warning appear every time I do anything with manage.py:

?: (urls.W005) URL namespace 'wagtailusers_groups' isn't unique. You may 
not be able to reverse all URLs in this namespace

How do I get rid of this warning? Do I need to accomplish this namespace 
override in some alternate manner, so that Django doesn't complain about 
the namespace being duplicated?

-- 
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/b693f1dd-8a0c-4296-b592-885c5927aba1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels - unbalanced load for threaded workers

2017-05-17 Thread Stephen J. Butler
CPython uses a global interpreter lock, which means that only one thread
per process can ever be running Python code. Where threading really helps
is if your python project is mostly I/O bound (waiting on database work,
network connections, etc). If it's CPU bound then you probably won't see
much concurrency with multiple threads.

I'm guessing this is why you're seeing all your work being accounted to a
couple processes. You'd get better concurrency moving to a
multiprocess/fork model.

https://www.ploggingdev.com/2017/01/multiprocessing-and-multithreading-in-python-3/


On Wed, May 17, 2017 at 3:53 AM,  wrote:

> I am trying to deploy Django project with Channels. After some trial and
> error I settled on 4 workers with 16 threads each. However as attached
> screen shows, the processes that are spawned by supervisor have CPU usage
> at ~15% while threads are around ~1-2%. Number of connections at the moment
> is less than 100. I tried load testing this setup, and as more messages are
> coming in the CPU usage is increasing both on processes that were spawned
> by supervisor and threads of these processes - so there is still
> disproportion (~50% and ~10%). Is it normal behavior? Any tips to configure
> it some other way to better balance the load?
>
> --
> 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/b566a9bc-5313-4573-9351-d6dd81915251%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/CAD4ANxXhDp3TfhoWVkhhJFT_%3DZ08bHxeQoBP2S7sSOCGbxhYew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels - unbalanced load for threaded workers

2017-05-17 Thread Andrew Godwin
Hi - I am not sure what you are saying exactly. That the load only goes to
some processes? Python threads are strange, the OS may not show stats
correctly and I'd generally advise multiple processes instead.

Andrew

On Wed, May 17, 2017 at 1:53 AM,  wrote:

> I am trying to deploy Django project with Channels. After some trial and
> error I settled on 4 workers with 16 threads each. However as attached
> screen shows, the processes that are spawned by supervisor have CPU usage
> at ~15% while threads are around ~1-2%. Number of connections at the moment
> is less than 100. I tried load testing this setup, and as more messages are
> coming in the CPU usage is increasing both on processes that were spawned
> by supervisor and threads of these processes - so there is still
> disproportion (~50% and ~10%). Is it normal behavior? Any tips to configure
> it some other way to better balance the load?
>
> --
> 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/b566a9bc-5313-4573-9351-d6dd81915251%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/CAFwN1uoRQydaH8aC5bx%3DQReZT0JQVVBB5pHt1HMxbiZERxSHrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django in chm format

2017-05-17 Thread James Schneider
On May 17, 2017 2:44 PM,  wrote:

I see think django doc in chm format help in ease of navigation


I'm assuming that you are referring to Compiled HTML format, common for MS
help dialogs. I don't believe there is a need expressed for this format, as
the documentation is available in other, more universally accessible
formats such as HTML and PDF. I've never seen software that is downloadable
from the web with documentation in CHM format.

You may have some luck converting the existing formats to CHM, our you can
search/file a ticket with the devs to see if there is any interest.

-James

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


Re: Signal limitations with custom models!

2017-05-17 Thread James Schneider
On May 17, 2017 7:59 AM, "Uzair Tariq"  wrote:

So i read about *Signal Limitations *in Django that comes up with user
custom models and you can't use *get_user_model()* as according to this link
it's clearly stated that the
reason for it is because the module is not completely loaded at this point
and the solution is to defer the function call until the whole module is
loaded. So why not this case does not apply to Default user model i.e.
*AbstractUser* in django? Is it because of execution order or is it some
back end One Time execution logic that loads the default models only once
in a cache and retrieves it every time but not in custom user model case?


>From my brief reading of the ticket, it looks like the signal call for the
built-in User (not AbstractUser, which is never directly used) only works
because that model is already loaded by the time the custom models are
inspected.

My guess is that the internal Django models are loaded first, and then app
models are loaded. Since you're defining the signal handler in your app,
you would be able to reference the built-in models but not any models that
haven't already been inspected.

I doubt there is any magic involved, it's technically a race condition.

Admittedly, I'm not deeply familiar with the mechanics in this scenario,
but it's my best educated guess.

-James

-- 
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/CA%2Be%2BciWz8nygB24iy97jAQWGQ60-FNb2K9ow-TnQ2LRBZmeQgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django in chm format

2017-05-17 Thread udosenakane
I see think django doc in chm format help in ease of navigation

-- 
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/10f4709f-28c4-473b-9314-e45a36638d3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: vs {{ form }}

2017-05-17 Thread James Schneider
On May 17, 2017 6:31 AM, "guettli" 
wrote:

Hi Russell Keith-Magee,

which version do you use? With  or without table?

   {{ form }} vs {{ form }}


Both of these are incorrect.

You need to wrap {{ form }} in a  HTML tag. If you want it in a
table, use {{ form.as_table }}.

https://docs.djangoproject.com/en/1.11/topics/forms/#form-rendering-options

There is no "correct" way, it depends on your template design as to which
one is more appropriate.

-James

-- 
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/CA%2Be%2BciUnJ2FDo%2BQwZKgdhek7G47C0JHE4B%3DjB%2BSQUQ0N02Wcig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels error : (index):173 Disconnected from chat socket websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexp

2017-05-17 Thread djangorobert
currently getting this error : 
WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error 
during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):174 Disconnected from chat socket

On Tuesday, May 16, 2017 at 11:31:19 PM UTC-5, djangorobert wrote:
>
> thanks ya that seemed to help a little now im running into a new error: 
>
> WebSocket connection to 'ws://www.openchat.us/griper' failed: WebSocket 
> is closed before the connection is established.
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/griper' failed: Error during WebSocket handshake: 
> Unexpected response code: 403
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
>
> hmmm :)
>
> On Tuesday, May 16, 2017 at 8:26:18 PM UTC-5, Dylan Reinhold wrote:
>>
>> Sorry sounds like you will need to configure somting in your webfaction 
>> controll panel.
>>
>> Here is another person with same issue, they said it fixed it for them.
>> https://github.com/django/channels/issues/445
>>
>> On Tue, May 16, 2017 at 5:46 PM, djangorobert  
>> wrote:
>>
>>> hi Dylan Im usingWebfaction Im kind of new to django channels 
>>> my website is www.openchat.us 
>>>
>>> do you mean redisserver ?
>>>
>>> or are you refering to the commands python mange.py runserver or 
>>> runworkder? because with those commancds im kind of confused when ussing 
>>> webfaction 
>>> im using putty to enter the commands to my webfaction account
>>>
>>> On Tuesday, May 16, 2017 at 5:49:04 PM UTC-5, Dylan Reinhold wrote:

 How are you running the web server?
 Looks like your web socket traffic is not being set to daphene. 
 Probably hitting the regular django listener and its returning a 404.

 Dylan

 On Tue, May 16, 2017 at 3:39 PM, djangorobert  
 wrote:

> working on the Django channels example : multi chat on Github 
> but am getting this error
>
>
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> (index):173 Disconnected from chat socket
> websocketbridge.js:118 WebSocket connection to 'ws://
> www.openchat.us/chat/stream/' failed: Error during WebSocket 
> handshake: Unexpected response code: 404
> connect @ websocketbridge.js:118
> 2(index):173 Disconnected from chat socket
> 

Re: Django Internship

2017-05-17 Thread Mark Phillips
A couple of comments..

1. This list is not for job hunting. Learn how to post correctly on email
lists. In this instance, you need an OT (Off Topic) at the start of your
subject line as this is a list for asking technical questions about Django.
More people will want to help you if you respect the purpose of each email
list you post on.

2. No one will sign in to Google drive to see your resume. It should be
readable on your web site in both plain text and pdf (NOT downloads).

3. Never tell a prospective employer that you hate something ("...and just
hates Front-end ."). Always tell them what you have accomplished, what you
are good at and what you enjoy doing. Always be open minded about learning
new things/technologies/etc until you have a lot more experience, many more
accomplishments, and at least a hint of gray hair. ;)

4. If you are going to post the code you wrote, then you better be sure it
is golden. functions.php has no comments, poor style, and I have no idea
what it does. Not the code I want to have in my products. Learn how to
write code that others can easily support, then post that code to your web
site so others will be impressed. There are all sorts of style guides for
php, python, java, etc. Learn them and apply them to the code you publish
for others to see (actually all your code).

5. Not sure what all these courses are listed on your site. Did you take
them? If so, then they should be in your resume and not here. If you are
just trolling the web for content, don't make me guess what it is and don't
make me look at them. You are making yourself look very undesirable as a
candidate for an internship by just adding fluff to your github account.
Get rid of it. If you are just starting out and don't have a lot of
projects, that is OK. Showing me one project where you really excelled  (eg
see #4) is far better than a lot of poorly done projects with irrelevant
fluff surrounding them.

Good luck!

Mark

On Wed, May 17, 2017 at 11:55 AM, Mannu Gupta 
wrote:

> Hi everyone,
>
> I have been learning on Django for around 6+ months, Now looking for a
> internship based on it .If anyone know about any internship offer then
> please let me know.
>
> My Website :- http://theparadoxer02.github.io
> Github:-  http://github.com/theparadoxer02
>
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/f9a00b76-81b3-414b-a53a-84ab2c43a8cf%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/CAEqej2PsM0exG-Qut_PTDiunj%2BEVE%2B6UkQtM9NQDbxGGoFGGug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Internship

2017-05-17 Thread Mannu Gupta
Hi everyone,

I have been learning on Django for around 6+ months, Now looking for a 
internship based on it .If anyone know about any internship offer then 
please let me know.

My Website :- http://theparadoxer02.github.io 
Github:-  http://github.com/theparadoxer02

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f9a00b76-81b3-414b-a53a-84ab2c43a8cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django dev job opportunity at California College of Arts

2017-05-17 Thread Scot Hacker
San Francisco Django developers: A great opportunity has opened up at 
California College of Arts for a full-time Python/Django developer:

https://cca.wd5.myworkdayjobs.com/en-US/CCA/job/San-Francisco/Web-Developer_R502257

Full-stack skills desirable. This is a small but excellent team at a really 
interesting college. Check it out!

- Scot

-- 
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/5a149079-b504-46db-a6ca-dff3ceb3767e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Selenium mess

2017-05-17 Thread Tim Graham
I haven't been able to run the selenium tests in Django's test suite 
without errors similar to what you describe since the geckodriver became 
required for testing with Firefox. I suspect this is a selenium/geckodriver 
issue rather than anything Django related. In the meantime, we're running 
the selenium tests with Google Chrome.

On Wednesday, May 17, 2017 at 10:45:18 AM UTC-4, Antonis Christofides wrote:
>
> Hi,
>
> I am the author of django-selenium-clean 
> .
> I'm happy I wrote extensive unit tests for it, which has made it much 
> easier to see what's up in various Python/Selenium/Browser combinations. 
> But I have some trouble and I was wondering whether there's any Selenium 
> expert who can help. Or if anyone knows where I could ask for help. Or if 
> anyone could just investigate and verify these findings and come up with 
> any ideas.
>
> Here's the situation (copied from the ticket 
> ):
>
>- Selenium 2.53, Firefox 45: Everything runs fine (but tests are run 
>twice, but this is probably not a Selenium issue). 
>- Selenium 2.53, Firefox 53: Browser opens, then nothing happens, 
>after a while testing terminates with an error. 
>- Selenium 3.4, Firefox 53: Browser opens, tests start. Two tests run 
>successfully, then it hangs. Maximizing the browser and restoring it to 
> the 
>original size may unhang it, and it may re-hang. It always hangs after a 
>test finishes and before another starts. Some tests fail, but it can't be 
>said whether it's a problem until the hanging is fixed. 
>
> The above behavior is with Python 3. With Python 2, the behavior is the 
> same, except that, in addition, if it manages to terminate properly (such 
> as in Selenium 2.53 and Firefox 45), the browser stays open and there's an 
> error message in the console.
> Regards,
>
> A.
>
> -- 
> Antonis Christofideshttp://djangodeployment.com
>
>

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


Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
On Tuesday 16 May 2017 08:51:49 knbk wrote:
> On Tuesday, May 16, 2017 at 9:51:07 AM UTC+2, guettli wrote:
> > This is a basic fact, and AFAIK this basic question is not solved
> > yet.
> > 
> > {{ form }}  *  vs   * {{ form }}
> 
> That question is actually answered by the documentation
>  s-as-html>
> >- For flexibility, the output does *not* include the  and
> > tags, nor does it include the  and  tags or
> >an
> > tag. It’s your job to do that.

Not sure if flexibility really is the original intent, but the Form class is 
badly named when 
you think of it as HTML forms.

It is *not* an abstraction of the HTML  tag, it's closest to an 
abstraction of the DOM 
HTMLFormElements collection. Once you see that distinction, things become a lot 
easier to 
grasp.

-- 
Melvyn Sopacua

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


Re: Is an upgrade from 1.6 to 1.11 as complicated as migrating from 1.1 to 1.6?

2017-05-17 Thread Derek
What I found was that many third-party apps did not (yet) seem to support 
1.11.  So a move to 1.10 was most pragmatic for us, with the assumption 
that migrating to 1.11 would be straightforward in about a year or so. 
 And, yes, work in Python 3 unless a very good reason not to.

 

> Thanks Andreas, 
>
> Looking at the docs its seems upgrading to 1.11 LTS would give us the 
> longest 
> future in terms of updates. Is there any reason we should consider 1.10 
> over 1.11? 
>
> Thanks 
>
>
> On 5/16/2017 3:11 PM, Andréas Kühne wrote: 
> > I upgraded from 1.3 to 1.5. That was the hard part I think. We are 
> > currently running version 1.10 and the updates to that version have 
> > been without a problem. That being said - it all depends on what your 
> > application does. If you do a lot of things that are specific for your 
> > application. The main problems I had was with changing to class based 
> > views for certain functions. 
> > 
> > Also - you should really be upgrading to a supported LTS version 
> > regardless of what management thinks is necessary. The problem here 
> > isn't the time it takes to do the upgrade, but the things that are 
> > excluded by running an older version of django. Updates to django come 
> > on a regular basis and only come for the supported versions (right now 
> > 1.10 and 1.11). You REALLY don't want to run an old version of django 
> > because of security exploits. 
> > 
> > Regards, 
> > 
> > Andréas 
> > 
> > 2017-05-16 14:28 GMT+02:00 Mike Dewhirst   
> > >: 
> > 
> > Go from 1.6 to 1.8.18 which is still supported and is easy. Buy 
> > some time. Actually all the upgrades are easy. Well up to 1.10. I 
> > skipped 1.9 and haven't tried to go to 1.11. 
> > 
> > Good luck 
> > 
> > /Connected by Motorola/ 
> > 
> > 
> > NoviceSortOf  > > wrote: 
> > 
> > 
> > It's said here 1.11 is the recommended version of Django. 
> > 
> > Our upgrade from 1.1 to 1.6 took much more time that expected, 
> > and management does not want to upgrade again. In terms of best 
> > practice 
> > though I'd like to push for it. 
> > 
> > * Is an upgrade from 1.6 to 1.11 as complicated as migrating from 
> > 1.1 to 1.6? 
> > 
> > Please advise 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, 
> > send an email to django-users...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@googlegroups.com 
>  
> > . 
> > Visit this group at https://groups.google.com/group/django-users 
> > . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/89dfb079-65e5-4476-baf0-2ebfa286728b%40googlegroups.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/89dfb079-65e5-4476-baf0-2ebfa286728b%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
> > 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...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@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/o8hi5a20ukfnbnmaivhxhx3o.1494937708557%40email.android.com
>  
> > <
> https://groups.google.com/d/msgid/django-users/o8hi5a20ukfnbnmaivhxhx3o.1494937708557%40email.android.com?utm_medium=email_source=footer>.
>  
>
> > 
> > 
> > For more options, visit https://groups.google.com/d/optout 
> > . 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> > Google Groups "Django users" group. 
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/django-users/9CuRMH1vyqQ/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an email to 
> > django-users...@googlegroups.com  
> > . 
> > To post to this group, send email to django...@googlegroups.com 
>  
> > . 
> > Visit this group at 

Re: Problem with CircularDependency Model

2017-05-17 Thread Melvyn Sopacua
On Wednesday 17 May 2017 05:57:57 Tobias Dacoir wrote:
> Thanks Melvyn,
> 
> I used promises before, when I use a foreign key for a class that is
> not yet defined, however it didn't change anything for my problem. I
> can make migrations, but not migrate. I am starting with a new
> database from scratch.
>self.ensure_not_cyclic(target, lambda x: (parent.key for parent in
> self. node_map[x].parents))
>   File
> "/Users/no68tuh2/.virtualenvs/ihearu/lib/python2.7/site-packages/djang
> o/db/migrations/graph.py" , line 370, in ensure_not_cyclic
> raise CircularDependencyError(", ".join("%s.%s" % n for n in
> cycle)) django.db.migrations.exceptions.CircularDependencyError:
> play.0001_initial, portal.0001_initial
> 
> This CircularDependencyError is driving me crazy.

Ah, now I see!
This has nothing to do with *model* dependencies. Two *migrations* depend on 
each other: 
play and port, both 0001_initial.

Do you have any idea how you got into that jam? Did you fiddle with 
django_migrations table? 
Maybe run --fake?
-- 
Melvyn Sopacua

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


Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
On Tuesday 16 May 2017 12:05:59 Jani Tiainen wrote:

> "rightway" to do things is to keep rendering (html) in the place where
> it belongs to - in templates. That's the main functionality of
> templates.

First, there's no single place to render HTML. Template rendering deals very 
poorly with nesting 
and recusion. The right place for those really is a progamming language.

Second, forms don't have to be rendered as HTML, but I agree that rendering is 
in principle the 
job of a template (but not the only place).

> Unfortunately traditionally Django forms have been doing things wrong
> and pushed HTML rendering to Python code - bascially to change your
> HTML you need to change Python code, which in production would mean
> deploying site again.

I've never experienced that as an issue (ok, maybe once). In the vast majority 
of cases, the 
changes needed to a form are not HTML related.

And this brings me to the point you're not seeing: if a tag renders a piece of 
HTML correctly for 
the majority of the cases, then by all means use it. For the exceptions, you 
can use plain HTML.

So, the reason I advised the bootstrap3 package, is that it produces the 
correct HTML 9 outof 10. 
Do I need it? No. Does it save me time? Yes, definitely. And it keeps structure 
of templates 
readable.

-- 
Melvyn Sopacua

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


Re: vs {{ form }}

2017-05-17 Thread Melvyn Sopacua
On Tuesday 16 May 2017 00:51:07 guettli wrote:
> Am Mittwoch, 10. Mai 2017 10:56:56 UTC+2 schrieb Melvyn Sopacua:
> > On Tuesday 09 May 2017 14:08:44 Jani Tiainen wrote:
> > > And to use bootstrap you don't need any special package, you can
> > > do it
> > > 
> > > without it just fine.
> > 
> > To render a webpage, you don't need Django you can do just fine
> > typing HTML. What's your point really?
> 
> I know that I can render a webpage without django.
> 
> What is the point?

I am on your side of the fence. Please observe thread structure and quoting.

-- 
Melvyn Sopacua

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


Signal limitations with custom models!

2017-05-17 Thread Uzair Tariq
So i read about *Signal Limitations *in Django that comes up with user 
custom models and you can't use *get_user_model()* as according to this link 
it's clearly stated that the 
reason for it is because the module is not completely loaded at this point 
and the solution is to defer the function call until the whole module is 
loaded. So why not this case does not apply to Default user model i.e. 
*AbstractUser* in django? Is it because of execution order or is it some 
back end One Time execution logic that loads the default models only once 
in a cache and retrieves it every time but not in custom user model case?

-- 
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/68a0e076-a288-4be8-a1da-6941d0713ca7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Selenium mess

2017-05-17 Thread Antonis Christofides
Hi,

I am the author of django-selenium-clean
.

I'm happy I wrote extensive unit tests for it, which has made it much easier to
see what's up in various Python/Selenium/Browser combinations. But I have some
trouble and I was wondering whether there's any Selenium expert who can help. Or
if anyone knows where I could ask for help. Or if anyone could just investigate
and verify these findings and come up with any ideas.

Here's the situation (copied from the ticket
):

  * Selenium 2.53, Firefox 45: Everything runs fine (but tests are run twice,
but this is probably not a Selenium issue).
  * Selenium 2.53, Firefox 53: Browser opens, then nothing happens, after a
while testing terminates with an error.
  * Selenium 3.4, Firefox 53: Browser opens, tests start. Two tests run
successfully, then it hangs. Maximizing the browser and restoring it to the
original size may unhang it, and it may re-hang. It always hangs after a
test finishes and before another starts. Some tests fail, but it can't be
said whether it's a problem until the hanging is fixed.

The above behavior is with Python 3. With Python 2, the behavior is the same,
except that, in addition, if it manages to terminate properly (such as in
Selenium 2.53 and Firefox 45), the browser stays open and there's an error
message in the console.

Regards,

A.

-- 
Antonis Christofides
http://djangodeployment.com

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


Re: vs {{ form }}

2017-05-17 Thread guettli
Hi Russell Keith-Magee,

which version do you use? With  or without table?

   {{ form }} vs {{ form }}

Regards,
  Thomas

Am Dienstag, 16. Mai 2017 17:52:19 UTC+2 schrieb Russell Keith-Magee:
>
>
> On 16 May 2017, 12:51 AM -0700, guettli  >, wrote:
>
>
> I know that real super heroes prefer the hard way. I don't like the hard 
> way. Call me wuss, pussy, weenie if you want to. 
>
>
> That kind of language is completely unnecessary. I don’t care how 
> frustrated you are - the Django community code of conduct requires that you 
> keep a civil tone. If you persist in using language like this, we’ll block 
> your account from posting.
>
> 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8901710a-b653-4fd0-b4c9-b7f82dbee174%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with CircularDependency Model

2017-05-17 Thread Tobias Dacoir

I am not sure if this is solution but instead of running makemigrations 
first, I ran migrate --run-syncdb. That got me past this error. 

-- 
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/8bb9c8f8-fd97-4331-bdbd-be01473fa67d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Database Routing

2017-05-17 Thread Joe
I am in the process of setting up a django server. I am trying to connect 
our 4 legacy DBs to her. I have created a separate app for each DB, added 
the app_label to the meta of the model and wrote a read only router for 
each db. This was working fine until i got to the last one. The routing is 
not taking. There error message shows me that it is failing because django 
is looking for a table in my default DB instead of following the route. Why 
is this???

-- 
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/1448feac-e772-436a-b296-3ccc0017e109%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with CircularDependency Model

2017-05-17 Thread Tobias Dacoir
Thanks Melvyn,

I used promises before, when I use a foreign key for a class that is not 
yet defined, however it didn't change anything for my problem. I can make 
migrations, but not migrate. I am starting with a new database from 
scratch. 
   self.ensure_not_cyclic(target, lambda x: (parent.key for parent in self.
node_map[x].parents))
  File 
"/Users/no68tuh2/.virtualenvs/ihearu/lib/python2.7/site-packages/django/db/migrations/graph.py"
, line 370, in ensure_not_cyclic
raise CircularDependencyError(", ".join("%s.%s" % n for n in cycle))
django.db.migrations.exceptions.CircularDependencyError: play.0001_initial, 
portal.0001_initial

This CircularDependencyError is driving me crazy.

-- 
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/ed4e63f1-ae28-405f-b6ec-6dce38c2f386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Email conformation problem

2017-05-17 Thread m712 - Developer
Do not respond to everyone with the same question. We see it once you respond 
to somebody (mail is delivered to every subscriber of this group).
I already gave you a suggestion. It should be pretty easy to search "what is a 
PTR record" and "how to set PTR record on $server_host" on your favorite search 
engine. Learn to research a little, please.
Other than that, try what James suggested.

On May 17, 2017 1:12 PM, Ismail Sarenkapic  wrote:
>
> Ok, so how do I solve this problem of fishing content in my mails?
>
> On Wednesday, May 17, 2017 at 9:56:56 AM UTC+2, m712 - Developer wrote:
>>
>> That's a pretty rude way to reply for someone who is asking questions. Many 
>> major email providers mark emails from servers without a PTR record to their 
>> domains as "spam".
>>
>> On May 17, 2017 9:52 AM, Ismail Sarenkapic  wrote:
>>>
>>> lol, It is Django related question and can be solved with some of third 
>>> party libraries like allauth, scoialauth etc. 
>>> Please don't replay to the posts when you don't know what it is about.tnx 
>>> again
>>>
>>> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko 
>>> wrote:

 It is not a Django related question, sorry.
 I can just suggest to look in 'SPAM' filters in you mailing agent.

 On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic  
 wrote:
>
> I already fixed the problem tnx.
> but i still dont know why are my emails treated like potential fishing 
> content, can you help me with that?
>
>
> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko 
> wrote:
>>
>> Hi, Ismail
>>
>> Did you try:
>>
>> instance.user.email?
>>
>> I hope it should be what you need.
>>
>> Regards,
>> Constantine C.
>>
>> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  
>> wrote:
>>>
>>> from django.conf import settings
>>> from django.contrib.auth.models import (
>>> BaseUserManager, AbstractBaseUser
>>> )
>>> from django.contrib import messages
>>> from django.core.mail import send_mail
>>> from django.conf import settings
>>> from django.core.validators import RegexValidator
>>> from django.db import models
>>> from django.db.models.signals import post_save
>>> # Create your models here.
>>> from .utils import code_generator
>>>
>>> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>>>
>>> class MyUserManager(BaseUserManager):
>>> def create_user(self, username, email, password=None):
>>> """
>>> Creates and saves a User with the given email, date of
>>> birth and password.
>>> """
>>> if not email:
>>> raise ValueError('Users must have an email address')
>>>
>>> user = self.model(
>>> username = username,
>>> email=self.normalize_email(email),
>>> )
>>>
>>> user.set_password(password)
>>> user.save(using=self._db)
>>> return user
>>>
>>> def create_superuser(self, username, email, password):
>>> """
>>> Creates and saves a superuser with the given email, date of
>>> birth and password.
>>> """
>>> user = self.create_user(
>>> username,
>>> email,
>>> password=password,
>>> )
>>> user.is_admin = True
>>> user.is_staff = True
>>> user.save(using=self._db)
>>> return user
>>>
>>>
>>> def get_email_field_name(self, email):
>>> email_string = str(self.email)
>>> return email_string
>>>
>>> class MyUser(AbstractBaseUser):
>>> username = models.CharField(
>>> max_length=255, 
>>> validators=[
>>> RegexValidator(
>>> regex = USERNAME_REGEX,
>>> message = 'Username must be Alpahnumeric or 
>>> contain any of the following: ". @ + -" ',
>>> code='invalid_username'
>>> )],
>>> unique=True,
>>> )
>>> email = models.EmailField(
>>> verbose_name='email address',
>>> max_length=255,
>>> unique=True,
>>> )
>>> zipcode   = models.CharField(max_length=120, default="92660")
>>> is_active = models.BooleanField(default=True)
>>> is_staff = models.BooleanField(default=False)
>>> is_admin = models.BooleanField(default=False)
>>>
>>> objects = MyUserManager()
>>>
>>> USERNAME_FIELD = 'username'
>>> REQUIRED_FIELDS = ['email']
>>>
>>> def get_full_name(self):
>>>   

Re: Email conformation problem

2017-05-17 Thread James Schneider
On May 16, 2017 11:24 PM, "Ismail Sarenkapic"  wrote:

I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing
content, can you help me with that?


There are potentially dozens of reasons for this. Some may be
Django-related, most probably are not.

Ensure that the email being generated by Django is properly formatted with
all of the fields necessary (message sender/receiver, envelope
sender/receiver, subject, mime type, etc.). All email addresses involved
should be valid and reachable from other SMTP servers. If HTML formatting
is used for the body, ensure it is valid and complete. If necessary, ensure
the language used for the email matches the recipient preferences. Often
times particular phrases will trigger phishing filters like "someone hacked
your account", so avoid those. From the Django perspective, this is about
all you can do.

Otherwise, I'd suggest relaying your messages through a real mail provider
(smart host) instead of sending them out directly through a local MTA on
your server. The provider for your email service (our rather, the mail
provider for your site domain) will already be setup properly (hopefully),
including any relevant DNS records (PTR, TXT/SPF, etc.). Contact your mail
provider with questions.

Running an SMTP server is difficult due to the volume of SPAM/Phishing
messages that are sent out. I would highly recommend that you don't run one
yourself due to the ancillary setup required and ongoing maintenance
needed. Relaying through a mail company will alleviate many of these
problems.

Many companies use reputation-based filtering systems such as Cisco
IronPort. You can check your reputation with them here:

https://www.talosintelligence.com/reputation_center

That may also shed some light on what may need correcting if your domain
has a low reputation.

Ultimately, though, the answer in many cases is "you can't" because you
have no control over the remote filtering system. In most cases, the user
will be informed as to why a message was flagged a certain way. You'll need
to retrieve this information from the affected customer and/or their IT
department to get a reason, and then address it accordingly. I ran mail
servers for several domains for years, and I'll never do it again.

-James

-- 
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/CA%2Be%2BciUD4X6%3D1X%3Dfjhtn%3D-jkVYGqA-cw%2BCJRzvp3viuK7035QQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Email conformation problem

2017-05-17 Thread Constantine Covtushenko
Hi Ismail,

Thank you for your suggestion.
Will get it into consideration for future responds.

Have a nice day to all.

On Wed, May 17, 2017 at 10:55 AM, m712 - Developer <
comeon@getbackinthe.kitchen> wrote:

> That's a pretty rude way to reply for someone who is asking questions.
> Many major email providers mark emails from servers without a PTR record to
> their domains as "spam".
> On May 17, 2017 9:52 AM, Ismail Sarenkapic  wrote:
>
> lol, It is Django related question and can be solved with some of third
> party libraries like allauth, scoialauth etc.
> Please don't replay to the posts when you don't know what it is about.tnx
> again
>
> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko
> wrote:
>
> It is not a Django related question, sorry.
> I can just suggest to look in 'SPAM' filters in you mailing agent.
>
> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic 
> wrote:
>
> I already fixed the problem tnx.
> but i still dont know why are my emails treated like potential fishing
> content, can you help me with that?
>
>
> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko
> wrote:
>
> Hi, Ismail
>
> Did you try:
>
> *instance.user.email*?
>
> I hope it should be what you need.
>
> Regards,
> Constantine C.
>
> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic 
> wrote:
>
> from django.conf import settings
> from django.contrib.auth.models import (
> BaseUserManager, AbstractBaseUser
> )
> from django.contrib import messages
> from django.core.mail import send_mail
> from django.conf import settings
> from django.core.validators import RegexValidator
> from django.db import models
> from django.db.models.signals import post_save
> # Create your models here.
> from .utils import code_generator
>
> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>
> class MyUserManager(BaseUserManager):
> def create_user(self, username, email, password=None):
> """
> Creates and saves a User with the given email, date of
> birth and password.
> """
> if not email:
> raise ValueError('Users must have an email address')
>
> user = self.model(
> username = username,
> email=self.normalize_email(email),
> )
>
> user.set_password(password)
> user.save(using=self._db)
> return user
>
> def create_superuser(self, username, email, password):
> """
> Creates and saves a superuser with the given email, date of
> birth and password.
> """
> user = self.create_user(
> username,
> email,
> password=password,
> )
> user.is_admin = True
> user.is_staff = True
> user.save(using=self._db)
> return user
>
>
> def get_email_field_name(self, email):
> email_string = str(self.email)
> return email_string
>
> class MyUser(AbstractBaseUser):
> username = models.CharField(
> max_length=255,
> validators=[
> RegexValidator(
> regex = USERNAME_REGEX,
> message = 'Username must be Alpahnumeric or contain 
> any of the following: ". @ + -" ',
> code='invalid_username'
> )],
> unique=True,
> )
> email = models.EmailField(
> verbose_name='email address',
> max_length=255,
> unique=True,
> )
> zipcode   = models.CharField(max_length=120, default="92660")
> is_active = models.BooleanField(default=True)
> is_staff = models.BooleanField(default=False)
> is_admin = models.BooleanField(default=False)
>
> objects = MyUserManager()
>
> USERNAME_FIELD = 'username'
> REQUIRED_FIELDS = ['email']
>
> def get_full_name(self):
> # The user is identified by their email address
> return self.email
>
> def get_short_name(self):
> # The user is identified by their email address
> return self.email
>
> def __str__(self):  # __unicode__ on Python 2
> return self.email
>
> def has_perm(self, perm, obj=None):
> "Does the user have a specific permission?"
> # Simplest possible answer: Yes, always
> return True
>
> def has_module_perms(self, app_label):
> "Does the user have permissions to view the app `app_label`?"
> # Simplest possible answer: Yes, always
> return True
>
>
>
> # @property
> # def is_staff(self):
> # "Is the user a member of staff?"
> # # Simplest possible answer: All admins are staff
> # return self.is_admin
>
>
>
> class ActivationProfile(models.Model):
> user= models.ForeignKey(settings.AUTH_USER_MODEL)
> key = models.CharField(max_length=120)
> expired = models.BooleanField(default=False)
>
> 

Re: Email conformation problem

2017-05-17 Thread Ismail Sarenkapic
Ok, so how do I solve this problem of fishing content in my mails?

On Wednesday, May 17, 2017 at 9:56:56 AM UTC+2, m712 - Developer wrote:
>
> That's a pretty rude way to reply for someone who is asking questions. 
> Many major email providers mark emails from servers without a PTR record to 
> their domains as "spam".
> On May 17, 2017 9:52 AM, Ismail Sarenkapic  > wrote:
>
> lol, It is Django related question and can be solved with some of third 
> party libraries like allauth, scoialauth etc. 
> Please don't replay to the posts when you don't know what it is about.tnx 
> again
>
> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko 
> wrote:
>
> It is not a Django related question, sorry.
> I can just suggest to look in 'SPAM' filters in you mailing agent.
>
> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic  
> wrote:
>
> I already fixed the problem tnx.
> but i still dont know why are my emails treated like potential fishing 
> content, can you help me with that?
>
>
> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko 
> wrote:
>
> Hi, Ismail
>
> Did you try:
>
> *instance.user.email*?
>
> I hope it should be what you need.
>
> Regards,
> Constantine C.
>
> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  
> wrote:
>
> from django.conf import settings
> from django.contrib.auth.models import (
> BaseUserManager, AbstractBaseUser
> )
> from django.contrib import messages
> from django.core.mail import send_mail
> from django.conf import settings
> from django.core.validators import RegexValidator
> from django.db import models
> from django.db.models.signals import post_save
> # Create your models here.
> from .utils import code_generator
>
> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>
> class MyUserManager(BaseUserManager):
> def create_user(self, username, email, password=None):
> """
> Creates and saves a User with the given email, date of
> birth and password.
> """
> if not email:
> raise ValueError('Users must have an email address')
>
> user = self.model(
> username = username,
> email=self.normalize_email(email),
> )
>
> user.set_password(password)
> user.save(using=self._db)
> return user
>
> def create_superuser(self, username, email, password):
> """
> Creates and saves a superuser with the given email, date of
> birth and password.
> """
> user = self.create_user(
> username,
> email,
> password=password,
> )
> user.is_admin = True
> user.is_staff = True
> user.save(using=self._db)
> return user
>
>
> def get_email_field_name(self, email):
> email_string = str(self.email)
> return email_string
>
> class MyUser(AbstractBaseUser):
> username = models.CharField(
> max_length=255, 
> validators=[
> RegexValidator(
> regex = USERNAME_REGEX,
> message = 'Username must be Alpahnumeric or contain 
> any of the following: ". @ + -" ',
> code='invalid_username'
> )],
> unique=True,
> )
> email = models.EmailField(
> verbose_name='email address',
> max_length=255,
> unique=True,
> )
> zipcode   = models.CharField(max_length=120, default="92660")
> is_active = models.BooleanField(default=True)
> is_staff = models.BooleanField(default=False)
> is_admin = models.BooleanField(default=False)
>
> objects = MyUserManager()
>
> USERNAME_FIELD = 'username'
> REQUIRED_FIELDS = ['email']
>
> def get_full_name(self):
> # The user is identified by their email address
> return self.email
>
> def get_short_name(self):
> # The user is identified by their email address
> return self.email
>
> def __str__(self):  # __unicode__ on Python 2
> return self.email
>
> def has_perm(self, perm, obj=None):
> "Does the user have a specific permission?"
> # Simplest possible answer: Yes, always
> return True
>
> def has_module_perms(self, app_label):
> "Does the user have permissions to view the app `app_label`?"
> # Simplest possible answer: Yes, always
> return True
>
>
>
> # @property
> # def is_staff(self):
> # "Is the user a member of staff?"
> # # Simplest possible answer: All admins are staff
> # return self.is_admin
>
>
>
> class ActivationProfile(models.Model):
> user= models.ForeignKey(settings.AUTH_USER_MODEL)
> key = models.CharField(max_length=120)
> expired = models.BooleanField(default=False)
>
> def save(self, *args, **kwargs):
> self.key 

Re: Email conformation problem

2017-05-17 Thread Ismail Sarenkapic
Ok, so how do I solve this problem of fishing content in my mails?

On Wednesday, May 17, 2017 at 9:54:15 AM UTC+2, Andréas Kühne wrote:
>
> Hi,
>
> I think Constantine is probably correct. It's not a specific django 
> problem if your emails are being flagged as fishing emails. The problem is 
> more likely how the emails are being sent AFTER they are sent from django. 
> Django only creates an email based on the properties you use - sender, 
> recipient, subject, text content, html content. What happens with the email 
> after that is not djangos fault or problem. Likely issues could be SPF 
> records (because I'm guessing you are not using the domains default email 
> server for sending your email). 
>
> Even if you add more plugins to your django app - if the SPF records 
> aren't correctly setup, email servers will still mark you email as unsafe.
>
> Regards,
>
> Andréas
>
> 2017-05-17 8:52 GMT+02:00 Ismail Sarenkapic  >:
>
>> lol, It is Django related question and can be solved with some of third 
>> party libraries like allauth, scoialauth etc. 
>> Please don't replay to the posts when you don't know what it is about.tnx 
>> again
>>
>> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko 
>> wrote:
>>>
>>> It is not a Django related question, sorry.
>>> I can just suggest to look in 'SPAM' filters in you mailing agent.
>>>
>>> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic  
>>> wrote:
>>>
 I already fixed the problem tnx.
 but i still dont know why are my emails treated like potential fishing 
 content, can you help me with that?


 On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko 
 wrote:
>
> Hi, Ismail
>
> Did you try:
>
> *instance.user.email*?
>
> I hope it should be what you need.
>
> Regards,
> Constantine C.
>
> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  > wrote:
>
>> from django.conf import settings
>> from django.contrib.auth.models import (
>> BaseUserManager, AbstractBaseUser
>> )
>> from django.contrib import messages
>> from django.core.mail import send_mail
>> from django.conf import settings
>> from django.core.validators import RegexValidator
>> from django.db import models
>> from django.db.models.signals import post_save
>> # Create your models here.
>> from .utils import code_generator
>>
>> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>>
>> class MyUserManager(BaseUserManager):
>> def create_user(self, username, email, password=None):
>> """
>> Creates and saves a User with the given email, date of
>> birth and password.
>> """
>> if not email:
>> raise ValueError('Users must have an email address')
>>
>> user = self.model(
>> username = username,
>> email=self.normalize_email(email),
>> )
>>
>> user.set_password(password)
>> user.save(using=self._db)
>> return user
>>
>> def create_superuser(self, username, email, password):
>> """
>> Creates and saves a superuser with the given email, date of
>> birth and password.
>> """
>> user = self.create_user(
>> username,
>> email,
>> password=password,
>> )
>> user.is_admin = True
>> user.is_staff = True
>> user.save(using=self._db)
>> return user
>>
>>
>> def get_email_field_name(self, email):
>> email_string = str(self.email)
>> return email_string
>>
>> class MyUser(AbstractBaseUser):
>> username = models.CharField(
>> max_length=255, 
>> validators=[
>> RegexValidator(
>> regex = USERNAME_REGEX,
>> message = 'Username must be Alpahnumeric or 
>> contain any of the following: ". @ + -" ',
>> code='invalid_username'
>> )],
>> unique=True,
>> )
>> email = models.EmailField(
>> verbose_name='email address',
>> max_length=255,
>> unique=True,
>> )
>> zipcode   = models.CharField(max_length=120, default="92660")
>> is_active = models.BooleanField(default=True)
>> is_staff = models.BooleanField(default=False)
>> is_admin = models.BooleanField(default=False)
>>
>> objects = MyUserManager()
>>
>> USERNAME_FIELD = 'username'
>> REQUIRED_FIELDS = ['email']
>>
>> def get_full_name(self):
>> # The user is identified by their 

Re: what on earth is this and how do I access 2 particular values to 2 keys

2017-05-17 Thread MikeKJ
Thanks guys, yes it is SOAP and thank you for the pointer to suds-jurko 
library, making progress now

-- 
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/3cde9658-3d93-4ab7-907a-5e5d13b6027f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Email conformation problem

2017-05-17 Thread m712 - Developer
That's a pretty rude way to reply for someone who is asking questions. Many major email providers mark emails from servers without a PTR record to their domains as "spam".
On May 17, 2017 9:52 AM, Ismail Sarenkapic  wrote:lol, It is Django related question and can be solved with some of third party libraries like allauth, scoialauth etc. Please don't replay to the posts when you don't know what it is about.tnx againOn Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko wrote:It is not a Django related question, sorry.I can just suggest to look in 'SPAM' filters in you mailing agent.On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic  wrote:I already fixed the problem tnx.but i still dont know why are my emails treated like potential fishing content, can you help me with that?On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko wrote:Hi, IsmailDid you try:instance.user.email?I hope it should be what you need.Regards,Constantine C.On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  wrote:from django.conf import settingsfrom django.contrib.auth.models import (BaseUserManager, AbstractBaseUser)from django.contrib import messagesfrom django.core.mail import send_mailfrom django.conf import settingsfrom django.core.validators import RegexValidatorfrom django.db import modelsfrom django.db.models.signals import post_save# Create your models here.from .utils import code_generatorUSERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'class MyUserManager(BaseUserManager):def create_user(self, username, email, password=None):"""Creates and saves a User with the given email, date ofbirth and password."""if not email:raise ValueError('Users must have an email address')user = self.model(username = username,email=self.normalize_email(email),)user.set_password(password)user.save(using=self._db)return userdef create_superuser(self, username, email, password):"""Creates and saves a superuser with the given email, date ofbirth and password."""user = self.create_user(username,email,password=password,)user.is_admin = Trueuser.is_staff = Trueuser.save(using=self._db)return userdef get_email_field_name(self, email):email_string = str(self.email)return email_stringclass MyUser(AbstractBaseUser):username = models.CharField(max_length=255, validators=[RegexValidator(regex = USERNAME_REGEX,message = 'Username must be Alpahnumeric or contain any of the following: ". @ + -" ',code='invalid_username')],unique=True,)email = models.EmailField(verbose_name='email address',max_length=255,unique=True,)zipcode   = models.CharField(max_length=120, default="92660")is_active = models.BooleanField(default=True)is_staff = models.BooleanField(default=False)is_admin = models.BooleanField(default=False)objects = MyUserManager()USERNAME_FIELD = 'username'REQUIRED_FIELDS = ['email']def get_full_name(self):# The user is identified by their email addressreturn self.emaildef get_short_name(self):# The user is identified by their email addressreturn self.emaildef __str__(self):  # __unicode__ on Python 2return self.emaildef has_perm(self, perm, obj=None):"Does the user have a specific permission?"# Simplest possible answer: Yes, alwaysreturn Truedef has_module_perms(self, app_label):"Does the user have permissions to view the app `app_label`?"# Simplest possible answer: Yes, alwaysreturn True# @property# def is_staff(self):# "Is the user a member of staff?"# # Simplest possible answer: All admins are staff# return self.is_adminclass ActivationProfile(models.Model):user= models.ForeignKey(settings.AUTH_USER_MODEL)key = models.CharField(max_length=120)expired = models.BooleanField(default=False)def save(self, *args, **kwargs):self.key = code_generator()super(ActivationProfile, self).save(*args, **kwargs)def post_save_activation_receiver(sender, instance, created, *args, **kwargs):if created:#send emailsubject = 'Registration'message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)from_email = settings.EMAIL_HOST_USERrecipient_list = ['UserEmail']print(recipient_list)send_mail(subject, message, from_email, recipient_list,fail_silently=True)post_save.connect(post_save_activation_receiver, sender=ActivationProfile)class 

Re: Email conformation problem

2017-05-17 Thread Andréas Kühne
Hi,

I think Constantine is probably correct. It's not a specific django problem
if your emails are being flagged as fishing emails. The problem is more
likely how the emails are being sent AFTER they are sent from django.
Django only creates an email based on the properties you use - sender,
recipient, subject, text content, html content. What happens with the email
after that is not djangos fault or problem. Likely issues could be SPF
records (because I'm guessing you are not using the domains default email
server for sending your email).

Even if you add more plugins to your django app - if the SPF records aren't
correctly setup, email servers will still mark you email as unsafe.

Regards,

Andréas

2017-05-17 8:52 GMT+02:00 Ismail Sarenkapic :

> lol, It is Django related question and can be solved with some of third
> party libraries like allauth, scoialauth etc.
> Please don't replay to the posts when you don't know what it is about.tnx
> again
>
> On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko
> wrote:
>>
>> It is not a Django related question, sorry.
>> I can just suggest to look in 'SPAM' filters in you mailing agent.
>>
>> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic 
>> wrote:
>>
>>> I already fixed the problem tnx.
>>> but i still dont know why are my emails treated like potential fishing
>>> content, can you help me with that?
>>>
>>>
>>> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko
>>> wrote:

 Hi, Ismail

 Did you try:

 *instance.user.email*?

 I hope it should be what you need.

 Regards,
 Constantine C.

 On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic 
 wrote:

> from django.conf import settings
> from django.contrib.auth.models import (
> BaseUserManager, AbstractBaseUser
> )
> from django.contrib import messages
> from django.core.mail import send_mail
> from django.conf import settings
> from django.core.validators import RegexValidator
> from django.db import models
> from django.db.models.signals import post_save
> # Create your models here.
> from .utils import code_generator
>
> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>
> class MyUserManager(BaseUserManager):
> def create_user(self, username, email, password=None):
> """
> Creates and saves a User with the given email, date of
> birth and password.
> """
> if not email:
> raise ValueError('Users must have an email address')
>
> user = self.model(
> username = username,
> email=self.normalize_email(email),
> )
>
> user.set_password(password)
> user.save(using=self._db)
> return user
>
> def create_superuser(self, username, email, password):
> """
> Creates and saves a superuser with the given email, date of
> birth and password.
> """
> user = self.create_user(
> username,
> email,
> password=password,
> )
> user.is_admin = True
> user.is_staff = True
> user.save(using=self._db)
> return user
>
>
> def get_email_field_name(self, email):
> email_string = str(self.email)
> return email_string
>
> class MyUser(AbstractBaseUser):
> username = models.CharField(
> max_length=255,
> validators=[
> RegexValidator(
> regex = USERNAME_REGEX,
> message = 'Username must be Alpahnumeric or 
> contain any of the following: ". @ + -" ',
> code='invalid_username'
> )],
> unique=True,
> )
> email = models.EmailField(
> verbose_name='email address',
> max_length=255,
> unique=True,
> )
> zipcode   = models.CharField(max_length=120, default="92660")
> is_active = models.BooleanField(default=True)
> is_staff = models.BooleanField(default=False)
> is_admin = models.BooleanField(default=False)
>
> objects = MyUserManager()
>
> USERNAME_FIELD = 'username'
> REQUIRED_FIELDS = ['email']
>
> def get_full_name(self):
> # The user is identified by their email address
> return self.email
>
> def get_short_name(self):
> # The user is identified by their email address
> return self.email
>
> def __str__(self):  # __unicode__ on Python 2
> return self.email
>
> def 

Re: Email conformation problem

2017-05-17 Thread Ismail Sarenkapic
lol, It is Django related question and can be solved with some of third 
party libraries like allauth, scoialauth etc. 
Please don't replay to the posts when you don't know what it is about.tnx 
again

On Wednesday, May 17, 2017 at 8:41:05 AM UTC+2, Constantine Covtushenko 
wrote:
>
> It is not a Django related question, sorry.
> I can just suggest to look in 'SPAM' filters in you mailing agent.
>
> On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic  > wrote:
>
>> I already fixed the problem tnx.
>> but i still dont know why are my emails treated like potential fishing 
>> content, can you help me with that?
>>
>>
>> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko 
>> wrote:
>>>
>>> Hi, Ismail
>>>
>>> Did you try:
>>>
>>> *instance.user.email*?
>>>
>>> I hope it should be what you need.
>>>
>>> Regards,
>>> Constantine C.
>>>
>>> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  
>>> wrote:
>>>
 from django.conf import settings
 from django.contrib.auth.models import (
 BaseUserManager, AbstractBaseUser
 )
 from django.contrib import messages
 from django.core.mail import send_mail
 from django.conf import settings
 from django.core.validators import RegexValidator
 from django.db import models
 from django.db.models.signals import post_save
 # Create your models here.
 from .utils import code_generator

 USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'

 class MyUserManager(BaseUserManager):
 def create_user(self, username, email, password=None):
 """
 Creates and saves a User with the given email, date of
 birth and password.
 """
 if not email:
 raise ValueError('Users must have an email address')

 user = self.model(
 username = username,
 email=self.normalize_email(email),
 )

 user.set_password(password)
 user.save(using=self._db)
 return user

 def create_superuser(self, username, email, password):
 """
 Creates and saves a superuser with the given email, date of
 birth and password.
 """
 user = self.create_user(
 username,
 email,
 password=password,
 )
 user.is_admin = True
 user.is_staff = True
 user.save(using=self._db)
 return user


 def get_email_field_name(self, email):
 email_string = str(self.email)
 return email_string

 class MyUser(AbstractBaseUser):
 username = models.CharField(
 max_length=255, 
 validators=[
 RegexValidator(
 regex = USERNAME_REGEX,
 message = 'Username must be Alpahnumeric or 
 contain any of the following: ". @ + -" ',
 code='invalid_username'
 )],
 unique=True,
 )
 email = models.EmailField(
 verbose_name='email address',
 max_length=255,
 unique=True,
 )
 zipcode   = models.CharField(max_length=120, default="92660")
 is_active = models.BooleanField(default=True)
 is_staff = models.BooleanField(default=False)
 is_admin = models.BooleanField(default=False)

 objects = MyUserManager()

 USERNAME_FIELD = 'username'
 REQUIRED_FIELDS = ['email']

 def get_full_name(self):
 # The user is identified by their email address
 return self.email

 def get_short_name(self):
 # The user is identified by their email address
 return self.email

 def __str__(self):  # __unicode__ on Python 2
 return self.email

 def has_perm(self, perm, obj=None):
 "Does the user have a specific permission?"
 # Simplest possible answer: Yes, always
 return True

 def has_module_perms(self, app_label):
 "Does the user have permissions to view the app `app_label`?"
 # Simplest possible answer: Yes, always
 return True



 # @property
 # def is_staff(self):
 # "Is the user a member of staff?"
 # # Simplest possible answer: All admins are staff
 # return self.is_admin



 class ActivationProfile(models.Model):
 user= models.ForeignKey(settings.AUTH_USER_MODEL)
 key = models.CharField(max_length=120)
 expired = models.BooleanField(default=False)

 def save(self, *args, **kwargs):
 self.key = code_generator()

Re: Email conformation problem

2017-05-17 Thread Constantine Covtushenko
It is not a Django related question, sorry.
I can just suggest to look in 'SPAM' filters in you mailing agent.

On Wed, May 17, 2017 at 9:24 AM, Ismail Sarenkapic 
wrote:

> I already fixed the problem tnx.
> but i still dont know why are my emails treated like potential fishing
> content, can you help me with that?
>
>
> On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko
> wrote:
>>
>> Hi, Ismail
>>
>> Did you try:
>>
>> *instance.user.email*?
>>
>> I hope it should be what you need.
>>
>> Regards,
>> Constantine C.
>>
>> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic 
>> wrote:
>>
>>> from django.conf import settings
>>> from django.contrib.auth.models import (
>>> BaseUserManager, AbstractBaseUser
>>> )
>>> from django.contrib import messages
>>> from django.core.mail import send_mail
>>> from django.conf import settings
>>> from django.core.validators import RegexValidator
>>> from django.db import models
>>> from django.db.models.signals import post_save
>>> # Create your models here.
>>> from .utils import code_generator
>>>
>>> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>>>
>>> class MyUserManager(BaseUserManager):
>>> def create_user(self, username, email, password=None):
>>> """
>>> Creates and saves a User with the given email, date of
>>> birth and password.
>>> """
>>> if not email:
>>> raise ValueError('Users must have an email address')
>>>
>>> user = self.model(
>>> username = username,
>>> email=self.normalize_email(email),
>>> )
>>>
>>> user.set_password(password)
>>> user.save(using=self._db)
>>> return user
>>>
>>> def create_superuser(self, username, email, password):
>>> """
>>> Creates and saves a superuser with the given email, date of
>>> birth and password.
>>> """
>>> user = self.create_user(
>>> username,
>>> email,
>>> password=password,
>>> )
>>> user.is_admin = True
>>> user.is_staff = True
>>> user.save(using=self._db)
>>> return user
>>>
>>>
>>> def get_email_field_name(self, email):
>>> email_string = str(self.email)
>>> return email_string
>>>
>>> class MyUser(AbstractBaseUser):
>>> username = models.CharField(
>>> max_length=255,
>>> validators=[
>>> RegexValidator(
>>> regex = USERNAME_REGEX,
>>> message = 'Username must be Alpahnumeric or contain 
>>> any of the following: ". @ + -" ',
>>> code='invalid_username'
>>> )],
>>> unique=True,
>>> )
>>> email = models.EmailField(
>>> verbose_name='email address',
>>> max_length=255,
>>> unique=True,
>>> )
>>> zipcode   = models.CharField(max_length=120, default="92660")
>>> is_active = models.BooleanField(default=True)
>>> is_staff = models.BooleanField(default=False)
>>> is_admin = models.BooleanField(default=False)
>>>
>>> objects = MyUserManager()
>>>
>>> USERNAME_FIELD = 'username'
>>> REQUIRED_FIELDS = ['email']
>>>
>>> def get_full_name(self):
>>> # The user is identified by their email address
>>> return self.email
>>>
>>> def get_short_name(self):
>>> # The user is identified by their email address
>>> return self.email
>>>
>>> def __str__(self):  # __unicode__ on Python 2
>>> return self.email
>>>
>>> def has_perm(self, perm, obj=None):
>>> "Does the user have a specific permission?"
>>> # Simplest possible answer: Yes, always
>>> return True
>>>
>>> def has_module_perms(self, app_label):
>>> "Does the user have permissions to view the app `app_label`?"
>>> # Simplest possible answer: Yes, always
>>> return True
>>>
>>>
>>>
>>> # @property
>>> # def is_staff(self):
>>> # "Is the user a member of staff?"
>>> # # Simplest possible answer: All admins are staff
>>> # return self.is_admin
>>>
>>>
>>>
>>> class ActivationProfile(models.Model):
>>> user= models.ForeignKey(settings.AUTH_USER_MODEL)
>>> key = models.CharField(max_length=120)
>>> expired = models.BooleanField(default=False)
>>>
>>> def save(self, *args, **kwargs):
>>> self.key = code_generator()
>>> super(ActivationProfile, self).save(*args, **kwargs)
>>>
>>>
>>> def post_save_activation_receiver(sender, instance, created, *args, 
>>> **kwargs):
>>> if created:
>>> #send email
>>> subject = 'Registration'
>>> message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
>>> from_email = settings.EMAIL_HOST_USER
>>> recipient_list = ['UserEmail']
>>> 

Re: Email conformation problem

2017-05-17 Thread Ismail Sarenkapic
I already fixed the problem tnx.
but i still dont know why are my emails treated like potential fishing 
content, can you help me with that?


On Wednesday, May 17, 2017 at 8:21:22 AM UTC+2, Constantine Covtushenko 
wrote:
>
> Hi, Ismail
>
> Did you try:
>
> *instance.user.email*?
>
> I hope it should be what you need.
>
> Regards,
> Constantine C.
>
> On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic  > wrote:
>
>> from django.conf import settings
>> from django.contrib.auth.models import (
>> BaseUserManager, AbstractBaseUser
>> )
>> from django.contrib import messages
>> from django.core.mail import send_mail
>> from django.conf import settings
>> from django.core.validators import RegexValidator
>> from django.db import models
>> from django.db.models.signals import post_save
>> # Create your models here.
>> from .utils import code_generator
>>
>> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>>
>> class MyUserManager(BaseUserManager):
>> def create_user(self, username, email, password=None):
>> """
>> Creates and saves a User with the given email, date of
>> birth and password.
>> """
>> if not email:
>> raise ValueError('Users must have an email address')
>>
>> user = self.model(
>> username = username,
>> email=self.normalize_email(email),
>> )
>>
>> user.set_password(password)
>> user.save(using=self._db)
>> return user
>>
>> def create_superuser(self, username, email, password):
>> """
>> Creates and saves a superuser with the given email, date of
>> birth and password.
>> """
>> user = self.create_user(
>> username,
>> email,
>> password=password,
>> )
>> user.is_admin = True
>> user.is_staff = True
>> user.save(using=self._db)
>> return user
>>
>>
>> def get_email_field_name(self, email):
>> email_string = str(self.email)
>> return email_string
>>
>> class MyUser(AbstractBaseUser):
>> username = models.CharField(
>> max_length=255, 
>> validators=[
>> RegexValidator(
>> regex = USERNAME_REGEX,
>> message = 'Username must be Alpahnumeric or contain 
>> any of the following: ". @ + -" ',
>> code='invalid_username'
>> )],
>> unique=True,
>> )
>> email = models.EmailField(
>> verbose_name='email address',
>> max_length=255,
>> unique=True,
>> )
>> zipcode   = models.CharField(max_length=120, default="92660")
>> is_active = models.BooleanField(default=True)
>> is_staff = models.BooleanField(default=False)
>> is_admin = models.BooleanField(default=False)
>>
>> objects = MyUserManager()
>>
>> USERNAME_FIELD = 'username'
>> REQUIRED_FIELDS = ['email']
>>
>> def get_full_name(self):
>> # The user is identified by their email address
>> return self.email
>>
>> def get_short_name(self):
>> # The user is identified by their email address
>> return self.email
>>
>> def __str__(self):  # __unicode__ on Python 2
>> return self.email
>>
>> def has_perm(self, perm, obj=None):
>> "Does the user have a specific permission?"
>> # Simplest possible answer: Yes, always
>> return True
>>
>> def has_module_perms(self, app_label):
>> "Does the user have permissions to view the app `app_label`?"
>> # Simplest possible answer: Yes, always
>> return True
>>
>>
>>
>> # @property
>> # def is_staff(self):
>> # "Is the user a member of staff?"
>> # # Simplest possible answer: All admins are staff
>> # return self.is_admin
>>
>>
>>
>> class ActivationProfile(models.Model):
>> user= models.ForeignKey(settings.AUTH_USER_MODEL)
>> key = models.CharField(max_length=120)
>> expired = models.BooleanField(default=False)
>>
>> def save(self, *args, **kwargs):
>> self.key = code_generator()
>> super(ActivationProfile, self).save(*args, **kwargs)
>>
>>
>> def post_save_activation_receiver(sender, instance, created, *args, 
>> **kwargs):
>> if created:
>> #send email
>> subject = 'Registration'
>> message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
>> from_email = settings.EMAIL_HOST_USER
>> recipient_list = ['UserEmail']
>> print(recipient_list)
>>
>> send_mail(subject, message, from_email, 
>> recipient_list,fail_silently=True)
>>
>> post_save.connect(post_save_activation_receiver, sender=ActivationProfile)
>>
>>
>>
>>
>> class Profile(models.Model):
>> user = models.OneToOneField(settings.AUTH_USER_MODEL)
>> city = models.CharField(max_length=120, null=True, 

Re: Email conformation problem

2017-05-17 Thread Constantine Covtushenko
Hi, Ismail

Did you try:

*instance.user.email*?

I hope it should be what you need.

Regards,
Constantine C.

On Mon, May 15, 2017 at 3:47 PM, Ismail Sarenkapic 
wrote:

> from django.conf import settings
> from django.contrib.auth.models import (
> BaseUserManager, AbstractBaseUser
> )
> from django.contrib import messages
> from django.core.mail import send_mail
> from django.conf import settings
> from django.core.validators import RegexValidator
> from django.db import models
> from django.db.models.signals import post_save
> # Create your models here.
> from .utils import code_generator
>
> USERNAME_REGEX = '^[a-zA-Z0-9.+-]*$'
>
> class MyUserManager(BaseUserManager):
> def create_user(self, username, email, password=None):
> """
> Creates and saves a User with the given email, date of
> birth and password.
> """
> if not email:
> raise ValueError('Users must have an email address')
>
> user = self.model(
> username = username,
> email=self.normalize_email(email),
> )
>
> user.set_password(password)
> user.save(using=self._db)
> return user
>
> def create_superuser(self, username, email, password):
> """
> Creates and saves a superuser with the given email, date of
> birth and password.
> """
> user = self.create_user(
> username,
> email,
> password=password,
> )
> user.is_admin = True
> user.is_staff = True
> user.save(using=self._db)
> return user
>
>
> def get_email_field_name(self, email):
> email_string = str(self.email)
> return email_string
>
> class MyUser(AbstractBaseUser):
> username = models.CharField(
> max_length=255,
> validators=[
> RegexValidator(
> regex = USERNAME_REGEX,
> message = 'Username must be Alpahnumeric or contain 
> any of the following: ". @ + -" ',
> code='invalid_username'
> )],
> unique=True,
> )
> email = models.EmailField(
> verbose_name='email address',
> max_length=255,
> unique=True,
> )
> zipcode   = models.CharField(max_length=120, default="92660")
> is_active = models.BooleanField(default=True)
> is_staff = models.BooleanField(default=False)
> is_admin = models.BooleanField(default=False)
>
> objects = MyUserManager()
>
> USERNAME_FIELD = 'username'
> REQUIRED_FIELDS = ['email']
>
> def get_full_name(self):
> # The user is identified by their email address
> return self.email
>
> def get_short_name(self):
> # The user is identified by their email address
> return self.email
>
> def __str__(self):  # __unicode__ on Python 2
> return self.email
>
> def has_perm(self, perm, obj=None):
> "Does the user have a specific permission?"
> # Simplest possible answer: Yes, always
> return True
>
> def has_module_perms(self, app_label):
> "Does the user have permissions to view the app `app_label`?"
> # Simplest possible answer: Yes, always
> return True
>
>
>
> # @property
> # def is_staff(self):
> # "Is the user a member of staff?"
> # # Simplest possible answer: All admins are staff
> # return self.is_admin
>
>
>
> class ActivationProfile(models.Model):
> user= models.ForeignKey(settings.AUTH_USER_MODEL)
> key = models.CharField(max_length=120)
> expired = models.BooleanField(default=False)
>
> def save(self, *args, **kwargs):
> self.key = code_generator()
> super(ActivationProfile, self).save(*args, **kwargs)
>
>
> def post_save_activation_receiver(sender, instance, created, *args, **kwargs):
> if created:
> #send email
> subject = 'Registration'
> message = "http://127.0.0.1:8000/activate/{0}".format(instance.key)
> from_email = settings.EMAIL_HOST_USER
> recipient_list = ['UserEmail']
> print(recipient_list)
>
> send_mail(subject, message, from_email, 
> recipient_list,fail_silently=True)
>
> post_save.connect(post_save_activation_receiver, sender=ActivationProfile)
>
>
>
>
> class Profile(models.Model):
> user = models.OneToOneField(settings.AUTH_USER_MODEL)
> city = models.CharField(max_length=120, null=True, blank=True)
>
> def __str__(self):
> return str(self.user.username)
>
> def __unicode__(self):
> return str(self.user.username)
>
>
> def post_save_user_model_receiver(sender, instance, created, *args, **kwargs):
> if created:
> try:
> Profile.objects.create(user=instance)
> ActivationProfile.objects.create(user=instance)
> 

Re: Matching query does not exist after a post_data signal, but in fact does exist when visiting the url sent by the query

2017-05-17 Thread Constantine Covtushenko
Hi, François-Xavier

I believe that the reason of that is a transaction that is not committed
yet  when your code reaches 'post_save' listener.
And when you use 'requests' library there is nothing in the DB yet.

And I am just curios why there is a need of saving 'admin view' in the DB?

Regards,
Constantine C.

On Tue, May 16, 2017 at 10:17 PM, François-Xavier Cao 
wrote:

> Hi everone,
>
>
> I started to code a two-apps django project. ModelA belongs to appone and
> ModelB belongs to apptwo. My purpose is to create a ModelA instance
> everytime that the user creates a ModelB instance. And the value of a
> ModelA CharField (that is ckeditor widgeted) must be the source code of a
> ModelB admin view. I used a post_data signal to link a function of creation
> for that. The problem is that i use the id of each instance of ModelB in
> order to create the good content for each instance of ModelA. When I try to
> use a string of the url sending the id parameter, the content field has for
> value the source code of the debug page
>
> (error 500, DoesNotExist at /admin/apptwo/modelb/my_view/ref=76, [76 is
> an example] ModelB matching query does not exist. Exception location :
> /home/me/Desktop/env/lib/python3.5/site-packages/django/db/models/query.py
> in get, line 385)
>
> But when I try to visit the url "http://localhost:8000//admin/
> apptwo/modelb/my_view/ref=76", or when I hardcode the url, without a str(
> instance.id), the page exists and everything works perfectly.
>
> I don't understand why.
>
> Could anybody give me some help to solve this problem ?
>
> Thanks in advance,
>
> --
>
> PS :
>
> The first app has a model.py that contains the following code :
>
>
> from django.db import models
> from django.contrib.auth.models import Userfrom registre.models import *
> class ModelA(models.Model):
> content = models.CharField(max_length=255, null=True)
> def __str__(self):
> return "ModelA : " + str(self.id)
>
>
>
>
> the admin.py of this first app also contains :
>
>
> from django.contrib import admin
> from appone.models import *
> from apptwo.models import ModelB
> from django.http import HttpResponse
> from django.template.response import TemplateResponse
> from django.conf.urls import url
> from registre import views
> from django.db.models.signals import post_save
> from django.dispatch import receiver
> import datetime
> from django.contrib.auth.models import User
> from django import forms
> from ckeditor.widgets import CKEditorWidget
> from django.template.loader import render_to_string
> import requests
>
> class ModelAAdminForm(forms.ModelForm):
> content = forms.CharField(widget=CKEditorWidget())
> class Meta:
> model = ModelA
> fields = '__all__'
>
> class ModelAAdmin(admin.ModelAdmin):
> form = ModelAAdminForm
>
> def create_A(sender, instance, **kwargs):
> string = "http://localhost:8000/admin/apptwo/modelb/my_view/ref=; + 
> str(instance.id)
> r = requests.get(string)
> ModelA.objects.create(contenu=r.text.encode('utf-8'))
>
> post_save.connect(create_A, sender=ModelB)
>
> admin.site.register(ModelA, ModelAAdmin)
>
>
>
>
>
> the second app (apptwo) has a models.py like this :
>
>
>
> from django.db import models
> from django.contrib.auth.models import User
>
> class ModelB(models.Model):
> owner = models.ForeignKey(User, null=True)
> name = models.CharField(max_length=255, null=True)
>
> def __str__(self):
> return self.name
>
>
>
>
> and an admin.py that contains :
>
>
>
> from django.contrib import admin
> from appone.models import *
> from apptwo.models import *
> import datetime
> from django.conf.urls import url, include
> from django.template.response import TemplateResponse
>
> class ModelBAdmin(admin.ModelAdmin):
>
> def get_queryset(self, request):
> qs = super(ModelB, self).get_queryset(request)
> if request.user.is_superuser:
> return qs
> return qs.filter(owner=request.user)
>
> def save_model(self, request, obj, form, change):
> obj.owner = request.user
> obj.save()
>
> def get_urls(self):
> urls = super(ModelBAdmin, self).get_urls()
> my_urls = [
> url(r'^my_view/ref=(?P\d+)$', self.my_view),
> ]
> return my_urls + urls
>
> def my_view(self, request, id):
> context = dict(
>self.admin_site.each_context(request),
>selector = ModelB.objects.get(id=id),
> )
> return TemplateResponse(request, "myview.html", context)
>
> admin.site.register(ModelB, ModelBAdmin)
>
>
>
>
>
>
>
> and finally a template myview.html with :
>
>
> Test {{ selector.name }}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop