Extending Django User model with django-allauth

2019-01-28 Thread Achyut Pandey
I'm using django-allauth and I want to be able to add new field to my User
model. What's the best way to do this as of you ?

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


Django, mod_wsgi and apache2.4 = 403 forbidden

2019-01-28 Thread Rookies DJ
I'm sorry if I'm asking the repetitive but i really need assistance I been 
trying to setup a server for my company system but I had no progress. 

As the tile subject mention the I'm Using Mod_wsgi 4.6.5 and Apache 2.4

for my Django is 2.1 and python 3.7

When try to run on my local machine I get 403 and I did many google search 
and the only answer I get is add in Require all granted which I had already 
add in. you could see below for particle section for my Apache http

LoadModule wsgi_module 
"C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIScriptAlias / "C:\Frontier_Website\FrounterWebApp\FrounterWeb\wsgi.py"\
WSGIPythonPath "C:\Frontier_Website\FrounterWebApp\zigview"
WSGIPythonHome "C:\Users\user\AppData\Local\Programs\Python\Python37"


Require all granted




Require all granted




for more detail you can look at at code in stackoverflow.com:
 
https://stackoverflow.com/questions/54249683/django-mod-wsgi-and-apache2-4-problems
  
I had try to run the system in virtualenv but I get no result as well and 
when I try to start the server, I get this error: *The system cannot find 
the path specified.*
The virtualenv code is below;

#python and mod_wsgi setting 

 ServerName Localhost.com 
 DocumentRoot 
C:\Frontier_Website\FATWebsite\FrontierWebApp\zigview\templates\FrounterWeb
LoadModule wsgi_module 
C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd
WSGIScriptAlias / 
C:\Frontier_Website\FATWebsite\FrontierWebApp\FrounterWeb\wsgi.py
WSGIPythonHome C:\Frontier_Website\FATWebsite\Lib
WSGIPythonPath C:\Frontier_Website\FrounterWebApp\zigview

Alias /static \Frontier_Website\FATWebsite\FrounterWebApp\zigview\static

Require all granted




   Require all granted



 
 
Please help I had been trying to solve this problem for month 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/c95e4fd6-bf77-4da9-8745-39f36c97b38b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: validator not working in serializers.ModelSerializer

2019-01-28 Thread Maurya Allimuthu
Hi  Andréas,

I have fixed it. like subclassing the serializer field class and overriding
the to_representation for per field.
Thanks for the help once again.

Thanks,
Maurya

On Fri, Jan 25, 2019 at 10:50 PM Andréas Kühne 
wrote:

> If you want to change the output, you can override the fields that you
> output in your serializer. That's what the fields are for?
>
> I think it would be helpful if you provide more information because at
> least I don't really understand your use-case.
>
> The way I would do it is to change the fields and format them the way I
> wanted them to be on a get request.
>
> Regards,
>
> Andréas
>
>
> Den fre 25 jan. 2019 kl 02:47 skrev Maurya Allimuthu <
> catchmau...@gmail.com>:
>
>> Hi Andreas Kuhne,
>>
>> Thanks on the quick answer and great help. :-)
>>
>> Hi Andreas Kuhne/All,
>>
>> Is there a way or any kind of approach, I can use validators/anything in
>> GET method to format/change the output of the data coming from database and
>> before getting changed by serializer as stream of strings.
>> Please let me know if any.
>>
>> Regards,
>> Maurya
>>
>> On Thu, Jan 24, 2019 at 8:40 PM Andréas Kühne 
>> wrote:
>>
>>> Hi,
>>>
>>> Validators are only called when you are updating something on the model
>>> - a get request doesn't update anything and the validators will not be
>>> called (there is no data sent to the server to validate). The validators
>>> will be called on a POST, PUT or PATCH request.
>>>
>>> Regards,
>>>
>>> Andréas
>>>
>>>
>>> Den tors 24 jan. 2019 kl 13:19 skrev Maurya Allimuthu <
>>> catchmau...@gmail.com>:
>>>
 Hi All,

 I use  serializers.ModelSerializer and viewset DetailViewset(APIView).

 The validators are not getting called on GET request of the viewset via
 URLS, but the GET request is working.


 def validate(self, attrs):
 if attrs.get('password') != attrs.get('confirm_password'):
 raise serializers.ValidationError("Those passwords don't match.")
 return attrs

 OR


 class Meta:
 model = *
 fields = ('***', )
 validators = [
 trigger_validator
 ]


 Thanks,
 Maurya

 --
 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/ef2204c4-eed2-411c-a157-d8e1d1d63744%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/CAK4qSCcnMq6jGwToc8cw4EZ1Ksg5pA-1g5KawF26R2AwB%3DXaAw%40mail.gmail.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/CAEqjY81wfmvchoQcNvz0G2s7mR2vk2B17-KA1XSLiLv%3D4Cnk%2Bg%40mail.gmail.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
> 

Re: validator not working in serializers.ModelSerializer

2019-01-28 Thread Maurya Allimuthu
Many thanks Andreas :-)

On Thursday, January 24, 2019 at 8:40:35 PM UTC+8, Andréas Kühne wrote:
>
> Hi,
>
> Validators are only called when you are updating something on the model - 
> a get request doesn't update anything and the validators will not be called 
> (there is no data sent to the server to validate). The validators will be 
> called on a POST, PUT or PATCH request.
>
> Regards,
>
> Andréas
>
>
> Den tors 24 jan. 2019 kl 13:19 skrev Maurya Allimuthu  >:
>
>> Hi All,
>>
>> I use  serializers.ModelSerializer and viewset DetailViewset(APIView).
>>
>> The validators are not getting called on GET request of the viewset via 
>> URLS, but the GET request is working.
>>
>>
>> def validate(self, attrs):
>> if attrs.get('password') != attrs.get('confirm_password'):
>> raise serializers.ValidationError("Those passwords don't match.")
>> return attrs
>>
>> OR
>>
>>
>> class Meta:
>> model = *
>> fields = ('***', )
>> validators = [
>> trigger_validator
>> ]
>>
>>
>> Thanks,
>> Maurya
>>
>> -- 
>> 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/ef2204c4-eed2-411c-a157-d8e1d1d63744%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/3eec578e-a6e9-4e1e-8d0c-3f77edf956dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using Django Window Functions on a Filtered QuerySet

2019-01-28 Thread Bernd Wechner
I have a filtered queryset, and annotated it with a few window functions. I 
got a most surprising result when the filter is on fields in a related 
model and it turns out this lies in the structure of the SQL. 

I asked the question here:

https://stackoverflow.com/questions/54388936/using-django-window-functions-on-a-filtered-queryset

mainly because it supports nice layout and captures responses in nice way. 
The issue is explained there in some detail.

I have in the interim found a work around to meet my needs using slightly 
different query again, but am still puzzled about this question as it seems 
fairly prosaic and normal issue, the need to SELECT not from a TABLE but 
the result of another SELECT. Subqueries speak a little to this but not in 
a general way that I can seem to manipulate to produce the desired query 
(the third on cited on the stackoverflow question).

Regards,

Bernd.

-- 
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/f3d7368e-47ec-4ed2-b10e-105a6601e9c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet with Django’s user database authentication from Apache

2019-01-28 Thread Simon Charette
Hello again :)

Someone pointed out to me that it might be a documentation issue that 
requires
that you import check_password only after calling get_wsgi_application().

For example, your wsgi.py module would look like

import os
import mod_wsgi

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'check_apache.settings')

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

from django.contrib.auth.handlers.modwsgi import check_password

In all cases a bug report should be filled to either adjust the 
documentation or the calls to
get_user_model() in django.contrib.auth.handlers.modwsgi.

Best,
Simon

Le lundi 28 janvier 2019 10:16:30 UTC-5, Simon Charette a écrit :
>
> Hello there,
>
> That looks like a Django bug to me as auth.get_user_model() should only be 
> performed
> from within the check_password() function as it will certainly crash at 
> the module level.
>
> You should file a bug report so it gets addressed[0].
>
> Best,
> Simon
>
> [0] https://code.djangoproject.com/newticket
>
> Le lundi 28 janvier 2019 07:20:24 UTC-5, Binoy U a écrit :
>>
>> Hello,
>>
>> I have created a django project with only one application. I haven't made 
>> any changes in the application. Only added the application to the settings 
>> and updated static and media urls.
>>
>> Migration is done and super user was created.
>>
>> I have configured apache(version:2.4.29) and mod_wsgi(4.5.17) according 
>> to Authenticating against Django’s user database from Apache 
>> 
>> .
>>
>> But getting the following error in apache error log.
>>
>> Traceback (most recent call last):
>>   File "/home/User1/Documents/test/check_apache/check_apache/wsgi.py", line 
>> 13, in 
>> from django.contrib.auth.handlers.modwsgi import check_password
>>   File 
>> "/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/handlers/modwsgi.py",
>>  line 5, in 
>> UserModel = auth.get_user_model()
>>   File 
>> "/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/__init__.py",
>>  line 165, in get_user_model
>> return django_apps.get_model(settings.AUTH_USER_MODEL, 
>> require_ready=False)
>>   File 
>> "/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
>>  line 197, in get_model
>> self.check_apps_ready()
>>   File 
>> "/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
>>  line 132, in check_apps_ready
>> raise AppRegistryNotReady("Apps aren't loaded yet.")
>>
>> Please find files below wsgi.py
>>
>> import osimport mod_wsgi
>>
>> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'check_apache.settings')from 
>> django.contrib.auth.handlers.modwsgi import check_passwordfrom 
>> django.core.wsgi import get_wsgi_application
>> application = get_wsgi_application()
>>
>> Error is triggered from from django.contrib.auth.handlers.modwsgi import 
>> check_password.
>>
>>
>> apache config file 000-defaults.conf 
>> 
>>
>>
>> Authentication is enabled on the media url. So I hope the apache 
>> configuration is working fine. I have create a github repository 
>>  if you would like 
>> to check.
>>
>> I got this issue from a bigger project with many application and other 
>> django modules. But I could still reproduce the same issue with this simple 
>> project. Can you please help me to resolve this issue, thanks in advance!
>>
>

-- 
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/bfdc8e5e-d433-4467-9888-74630f4dfebf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django payment through different methods

2019-01-28 Thread Bikash Saud
Thanks Everyone for sharing your great knowledge

On Wed, Jan 23, 2019 at 12:34 AM Mario R. Osorio 
wrote:

> Take a look here: https://djangopackages.org/grids/g/payment-processing/
>
> On Monday, January 21, 2019 at 7:36:23 PM UTC-5, Bikash Saud wrote:
>>
>> I'm trying to payment from different methods like paypal, or other way. I
>> did not have idea please help me
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d6292dcb-827f-46e5-ada4-a25b0dee58dc%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/CAL6_AYVegGpj4Woa%2BPSGMPGjkgb_Ka8vbEviOLF3aJ6qy5Ah1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


RE: Admin form_url breakout problem

2019-01-28 Thread Matthew Pava
Hi Mike,
When Stripe processes the payment, you need to preventDefault on the form 
submit, then add the token from Stripe to a hidden input in your form without 
affecting any other data in the form.  Then you can do form.submit() and let 
the admin handle it from there.  Check out the Stripe documentation for some 
good examples.  I've used it myself.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Mike Dewhirst
Sent: Friday, January 25, 2019 10:26 PM
To: django-users@googlegroups.com
Subject: Re: Admin form_url breakout problem

Matthew

I think I'll back everything out and start again. There must be a basic 
blunder somewhere.

Just talking it through, I can definitely launch payment_view from the 
Admin when all the ducks are in a line. That view populates the hidden 
..._id fields and Stripe API fields in the form then calls the Stripe 
API which initiates the  Stripe javascript in the Payment template which 
resubmits the request with POST direct to Stripe so it can gather the 
card detail and send back the json containing the token which proves the 
card worked. At that point payment is made and my payment_view has lost 
all the context because Stripe made the request not Django. payment_view 
detects the Stripe response and must reconstruct the model instances 
from the data pre-placed in the hidden form fields. Once the instances 
are retrieved that payment_view code updates the subscription record, 
creates a receipt record , assembles a message for the success_view and 
sends an email to the user.

I am having trouble understanding the correct way to launch payment_view 
so that Admin doesn't get confused wanting to add payment/ to the url 
and thus keeping it all within the Admin.

Regarding your comment on using reverse to derive the link, I agree. I 
was just being somewhat paranoid and skipping the reverse code which I 
haven't taken the time to study. I will.

Thanks again

Mike


On 26/01/2019 1:59 am, Matthew Pava wrote:
>
> Based on the error message, it looks like you’re trying to call 
> reverse(‘admin’) somewhere, but that’s not in the code you shared.  
> Actually, you probably want to use a reverse call when populating 
> content[‘link’].
>
> *From:*django-users@googlegroups.com 
> [mailto:django-users@googlegroups.com] *On Behalf Of *Mike Dewhirst
> *Sent:* Friday, January 25, 2019 3:35 AM
> *To:* django-users@googlegroups.com
> *Subject:* Re: Admin form_url breakout problem
>
> On 25/01/2019 2:40 am, Matthew Pava wrote:
>
> Hi Mike,
>
> I'm not really seeing why this is throwing errors at you.  It seems like 
> you've done everything right.  Could you provide the code (or the relevant 
> parts) for the Substance Admin form?
>
> Thanks!
>
>
> Matthew
>
> I'm still in trouble and including some code. I'm not being precious 
> about it just hoping not to overwhelm you. Please ask for the next 
> instalment ...
>
> class SubstanceAdmin(admin.ModelAdmin):
>
>     def subscribe(self, sm2mi, fee_type, fullyear=False):
>     """
>     sm2mi is the substance<-ingredient m2m through record
>     fee_type determines the subscription fee amount
>     fullyear=False means calculate the fee pro-rata to 30 September
>
>     We don't need a request here so this can be imported from 
> elsewhere.
>     Only called if a fee is payable. Only returns a subscription 
> if no token or
>         fullyear == True meaning a subscription renewal is due
>     """
>     subscription, new = Subscription.objects.get_or_create(
>     licensee=sm2mi.substance.division.company,
>     ingredient=sm2mi.ingredient,
>     fee_type=fee_type,
>     )
>     if not subscription.token or fullyear:
>     return subscription
>
>     def change_view(self, request, object_id, form_url='', 
> extra_context=None):
>     """
>     For the billing system we want to include all the context data 
> so the
>     change_form populates itself properly. See collect_content
>     self = SubstanceAdmin
>     request = wsgi request object
>     object_id = substance
>     form_url = no idea!
>     extra_context = no_idea
>     """
>     sm2mis = 
> Substance_Ingredients.objects.filter(substance_id=object_id)
>     for sm2mi in sm2mis:
>     payable, fee_type = sm2mi.fee_payable()  # eg., True, 
> PAID_DATA
>     if payable:
>     subscription = self.subscribe(sm2mi, fee_type)
>     if subscription:    # we need to collect money for the 
> owner
>     self.change_form_template = 'payment.html'
>     content = collect_content(
>     sm2mi,
>     subscription,
>     )
>     return payment_view(
>     request,
>     sm2mi,
>     subscription,
>    

Re: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet with Django’s user database authentication from Apache

2019-01-28 Thread Simon Charette
Hello there,

That looks like a Django bug to me as auth.get_user_model() should only be 
performed
from within the check_password() function as it will certainly crash at the 
module level.

You should file a bug report so it gets addressed[0].

Best,
Simon

[0] https://code.djangoproject.com/newticket

Le lundi 28 janvier 2019 07:20:24 UTC-5, Binoy U a écrit :
>
> Hello,
>
> I have created a django project with only one application. I haven't made 
> any changes in the application. Only added the application to the settings 
> and updated static and media urls.
>
> Migration is done and super user was created.
>
> I have configured apache(version:2.4.29) and mod_wsgi(4.5.17) according to 
> Authenticating 
> against Django’s user database from Apache 
> 
> .
>
> But getting the following error in apache error log.
>
> Traceback (most recent call last):
>   File "/home/User1/Documents/test/check_apache/check_apache/wsgi.py", line 
> 13, in 
> from django.contrib.auth.handlers.modwsgi import check_password
>   File 
> "/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/handlers/modwsgi.py",
>  line 5, in 
> UserModel = auth.get_user_model()
>   File 
> "/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/__init__.py",
>  line 165, in get_user_model
> return django_apps.get_model(settings.AUTH_USER_MODEL, 
> require_ready=False)
>   File 
> "/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
>  line 197, in get_model
> self.check_apps_ready()
>   File 
> "/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
>  line 132, in check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
>
> Please find files below wsgi.py
>
> import osimport mod_wsgi
>
> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'check_apache.settings')from 
> django.contrib.auth.handlers.modwsgi import check_passwordfrom 
> django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
>
> Error is triggered from from django.contrib.auth.handlers.modwsgi import 
> check_password.
>
>
> apache config file 000-defaults.conf 
> 
>
>
> Authentication is enabled on the media url. So I hope the apache 
> configuration is working fine. I have create a github repository 
>  if you would like to 
> check.
>
> I got this issue from a bigger project with many application and other 
> django modules. But I could still reproduce the same issue with this simple 
> project. Can you please help me to resolve this issue, thanks in advance!
>

-- 
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/522a8365-2da0-4241-84aa-a3bd29720452%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: checkng for uniqueness of a field in django Admin

2019-01-28 Thread 'Amitesh Sahay' via Django users
If that field has unique values, probably you can use that fileld as primary 
key. 


Regards,
Amitesh Sahay91-750 797 8619 

On Monday, 28 January, 2019, 7:18:35 PM IST, 'Odile Lambert' via Django 
users  wrote:  
 
   
Hello
 
In django admin, I have a model with a model fiel "tech_number" which must be 
unique across the table. If I do not check the uniqueness, it raises a Django 
integrity error. According to the documentation it sounds normal.
 
I checked the uniqueness of the" tech_number" in the clean of the model form. 
but now it raises a validation error even in the change form. In fact it should 
ask if I needs to erase the existing one.
 
What did I miss?
 
Piscvau
 
 

-- 
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/8bf1dd1b-f42c-8d31-3331-9b112d7ca888%40laposte.net.
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/1252135655.2156351.1548683386362%40mail.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


checkng for uniqueness of a field in django Admin

2019-01-28 Thread 'Odile Lambert' via Django users

  
  
Hello
In django admin, I have a model with a model fiel "tech_number"
  which must be unique across the table. If I do not check the
  uniqueness, it raises a Django integrity error. According to the
  documentation it sounds normal.
I checked the uniqueness of the" tech_number" in the clean of the
  model form. but now it raises a validation error even in the
  change form. In fact it should ask if I needs to erase the
  existing one.
What did I miss?
Piscvau

  




-- 
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/8bf1dd1b-f42c-8d31-3331-9b112d7ca888%40laposte.net.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Mon, Jan 28, 2019 at 04:45:44AM -0800, Kevin Olbrich wrote:
> Hi Anirudh,
> 
> I am using uWSGI and not Gunicorn. At least for uWSGI, with Debug = False, 
> it only logs the HTTP status code but not exception (might be the same with 
> Gunicorn).
> I will try Sentry which provides a clean GUI and notification of new 
> problems. This also seems to work for my Celery tasks and Django admin 
> commands.

Since you're mentioning Celery, I thought it might be worth mentioning
that Celery performs some black magic ritual on the Python logging
config in its default configuration, which interferes with the way
Sentry handles errors – or at least that's been my experience. At one
point I noticed that errors happening inside Celery tasks didn't have
all the stack values, like ones from the regular request/response had.
I don't remember exactly how, and I don't have access to that code
base anymore, but I remember that we had to explicitly disable as much
of Celery's custom logging as we could in order to get that to work.
(Might be that things have improved since then, though.)

Good luck,

Michal
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCgAGBQJcTvuFAAoJEHA7T/IPM/kltD8P/0MfET5/KylfZM/BWHDz4+vn
8U7hr4Zraz5R+zzr4yq7Ow0tom4zWE0EqpYREv87A4tX7dHGITTQLbU+bCce/MNQ
tIVD2D498XsEBGRsNav0kOr6ATuWoPuJlLLSFYGbGHedCKz6UB+ftmwYhL7WOQgr
zE8LeLS37jbm02/z6DD25intYUpRbKeeSRjyqkc+6esUz2IAXVQQ1NcUtJjPbmvi
zJtyWUX/RXS3Wulrp8lwLJ7rThcFAh3wVmC/nJCHeBQFLDmmLZx08EEnV1w7uxwv
AcowzfrGPOYv7VcOK9K9KvUPCrIj3KovU4DPlffuX6xxy8FZTvIyDptJAaMnh9C+
i8So48kPL1TxBk1lPuWx8TLr+RR1y4LIy7KVwMgRyeFC5zGIdBiAFIwo9X5utdc9
1uuO07bGn9224vpk87zyizA8Q88Qeee7kco+a0v0f8+Xxz6oAKg9uf3broJ9nl99
jp6Pp9QTzlpYFnw0bjMDMI3KRLkAxbWmeuGtBt7tELKFfHoae3RtfCqNitvEhN07
rz44xC2dbwPvQdV2UMElX+jS9omk+8oEwgMNvOPXyAsf3NexwcuN0lzoo5MS2OpY
kkwbNCD0aeHtreY5BJrXgONmXd58OswZhsCbcvZXqhIJ1MxreCzasXVvF7ZNHp6z
daRHSphHWV6/sDLFFfGw
=6WLZ
-END PGP SIGNATURE-

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


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi Anirudh,

I am using uWSGI and not Gunicorn. At least for uWSGI, with Debug = False, 
it only logs the HTTP status code but not exception (might be the same with 
Gunicorn).
I will try Sentry which provides a clean GUI and notification of new 
problems. This also seems to work for my Celery tasks and Django admin 
commands.

Thank you very much for your reply!

Kevin

Am Montag, 28. Januar 2019 13:25:17 UTC+1 schrieb Anirudh Jain:
>
> You  can setup a logging and debugging logging system using gunicorn in 
> production using flags :-
>
> --log-level debug
> --access-logfile /home/ubuntu/websitelogs.log
>
> For more setting options read gunicorn documentation 
>
> https://docs.gunicorn.org/en/stable/settings.html#logging
>
> On Mon, 28 Jan 2019, 16:50 Michal Petrucha   wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA512
>>
>> On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote:
>> > Hi!
>> > 
>> > I would like to catch and send all exceptions to a logging system.
>> > When Debug is set to False, all debug related information is lost (just 
>> a 
>> > HTTP 500 error message).
>> > 
>> > While Debug False works perfectly in production, I would like to log 
>> and 
>> > send the exceptions to a backend, where I can save them.
>> > This would allow me to fix bugs, that only occur once every month 
>> (because 
>> > nobody is able to reproduce).
>> > 
>> > Similar approach was the case with Testflight on iOS, where I got a 
>> message 
>> > for every App-crash.
>> > 
>> > How can I handle this?
>> > 
>> > Kind regards
>> > Kevin
>>
>> Hi Kevin,
>>
>> You can set up your backend logging to send logs to Sentry [1], for
>> example. You can either set up your own Sentry instance, or use the
>> commercial offering [2]. If you set up sentry as one of the default
>> logging handlers, it will catch all unhandled exceptions, and you'll
>> get a fancy stack trace for each, including the values of local
>> variables in each stack frame.
>>
>> Cheers,
>>
>> Michal
>>
>>
>> [1]: https://github.com/getsentry/sentry
>> [2]: https://sentry.io/
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1
>>
>> iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/
>> hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D
>> 3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV
>> MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR
>> py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d
>> mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+
>> 6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx
>> GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA
>> 4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p
>> V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg
>> 9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh
>> VRcuK/Cf70seqQEarfXL
>> =HFoa
>> -END PGP SIGNATURE-
>>
>> -- 
>> 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/20190128112004.GD10973%40konk.org
>> .
>> 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/9c197ce1-54d1-4291-9cc4-22b3cb5b58fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi Michal,

looks very promissing. I read the SDK guide for Django and I realy like it.
Thank you!

Kevin

Am Montag, 28. Januar 2019 12:20:35 UTC+1 schrieb Michal Petrucha:
>
> -BEGIN PGP SIGNED MESSAGE- 
> Hash: SHA512 
>
> On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote: 
> > Hi! 
> > 
> > I would like to catch and send all exceptions to a logging system. 
> > When Debug is set to False, all debug related information is lost (just 
> a 
> > HTTP 500 error message). 
> > 
> > While Debug False works perfectly in production, I would like to log and 
> > send the exceptions to a backend, where I can save them. 
> > This would allow me to fix bugs, that only occur once every month 
> (because 
> > nobody is able to reproduce). 
> > 
> > Similar approach was the case with Testflight on iOS, where I got a 
> message 
> > for every App-crash. 
> > 
> > How can I handle this? 
> > 
> > Kind regards 
> > Kevin 
>
> Hi Kevin, 
>
> You can set up your backend logging to send logs to Sentry [1], for 
> example. You can either set up your own Sentry instance, or use the 
> commercial offering [2]. If you set up sentry as one of the default 
> logging handlers, it will catch all unhandled exceptions, and you'll 
> get a fancy stack trace for each, including the values of local 
> variables in each stack frame. 
>
> Cheers, 
>
> Michal 
>
>
> [1]: https://github.com/getsentry/sentry 
> [2]: https://sentry.io/ 
> -BEGIN PGP SIGNATURE- 
> Version: GnuPG v1 
>
> iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/ 
> hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D 
> 3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV 
> MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR 
> py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d 
> mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+ 
> 6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx 
> GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA 
> 4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p 
> V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg 
> 9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh 
> VRcuK/Cf70seqQEarfXL 
> =HFoa 
> -END PGP SIGNATURE- 
>

-- 
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/ab6a1998-b9ac-4dbb-adac-76aa4b3c7855%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Anirudh Jain
You  can setup a logging and debugging logging system using gunicorn in
production using flags :-

--log-level debug
--access-logfile /home/ubuntu/websitelogs.log

For more setting options read gunicorn documentation

https://docs.gunicorn.org/en/stable/settings.html#logging

On Mon, 28 Jan 2019, 16:50 Michal Petrucha  -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote:
> > Hi!
> >
> > I would like to catch and send all exceptions to a logging system.
> > When Debug is set to False, all debug related information is lost (just
> a
> > HTTP 500 error message).
> >
> > While Debug False works perfectly in production, I would like to log and
> > send the exceptions to a backend, where I can save them.
> > This would allow me to fix bugs, that only occur once every month
> (because
> > nobody is able to reproduce).
> >
> > Similar approach was the case with Testflight on iOS, where I got a
> message
> > for every App-crash.
> >
> > How can I handle this?
> >
> > Kind regards
> > Kevin
>
> Hi Kevin,
>
> You can set up your backend logging to send logs to Sentry [1], for
> example. You can either set up your own Sentry instance, or use the
> commercial offering [2]. If you set up sentry as one of the default
> logging handlers, it will catch all unhandled exceptions, and you'll
> get a fancy stack trace for each, including the values of local
> variables in each stack frame.
>
> Cheers,
>
> Michal
>
>
> [1]: https://github.com/getsentry/sentry
> [2]: https://sentry.io/
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/
> hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D
> 3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV
> MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR
> py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d
> mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+
> 6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx
> GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA
> 4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p
> V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg
> 9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh
> VRcuK/Cf70seqQEarfXL
> =HFoa
> -END PGP SIGNATURE-
>
> --
> 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/20190128112004.GD10973%40konk.org
> .
> 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/CAC3mK7c9q%3D%2BZSF9AHGjKFnKtTBgCAswEV%2Bkdja8XQXqDV7pQYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Channels

2019-01-28 Thread mahesh boini
path('chat//',views.room,name='room')  replace this and try
i just added "/"

On Sun, Jan 27, 2019 at 11:36 PM Vaibhav Kumar Chaudhary <
vaibhavkumar...@gmail.com> wrote:

> I am trying to create a chat app with Django Channels and facing a bit
> problem here.
> when I type chat room's name is the form it redirects with to that link
> but my urls .py can not match that url and can not connect me to my views
>
> here is urls.py
> from django.urls import path
> from django.conf.urls import url
> from . import views
> urlpatterns=[
>path('chat',views.index,name='index'),
>path('chat/',views.room,name='room'),
>
> ]
>
>
> for example, if I enter lobby it should redirect me to /chat/lobby/
>
> this is my javascript code to redirecting
> document.querySelector('#room-name-submit').onclick = function(e) {
>var roomName = document.querySelector('#room-name-input').value
> ;
>window.location.pathname = '/chat/' + roomName + '/';
>};
>
> Please help me where I am wrong
>
> --
> 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/16083864-abac-47ae-b0ec-601d1912220b%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/CANR2Zjv-PUyNucJoWn9CySY8ZKx63YT94-QHQOXKuDxQK-RXfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ValueError at /news/ Value: None must be instance of Model:

2019-01-28 Thread mahesh boini
import proper package you were importing "djongo" it should be "django".

On Sat, Jan 26, 2019 at 8:13 PM  wrote:

> This usually happens when you have added and EmbeddedModel and not passing
> any value to that field while creation.
> Hope this helps.
>
> On Sunday, 19 August 2018 19:32:49 UTC+5:30, Sagar wrote:
>>
>> Hi,
>> I'm trying to create embedded documents in mongodb using django. I'm
>> facing this error when I tried to insert a post in database.
>> "ValueError at /post/Value: None must be instance of Model: > 'django.db.models.base.Model'>"
>> Here is my code.
>> models.py
>> from djongo import models
>>
>>
>> # Schema for comments collection which include in belonging post
>> class Comments(models.Model):
>> username = models.CharField(max_length=25, blank=False)
>> comment = models.TextField()
>> time_stamp = models.DateTimeField(auto_now_add=True)
>>
>>
>> # Schema for post collection
>> class Post(models.Model):
>> username = models.CharField(max_length=25, blank=False)
>> title = models.CharField(max_length=100, blank=False)
>> post = models.TextField()
>> time_stamp = models.DateTimeField(auto_now_add=True)
>> comments = models.EmbeddedModelField('Comments')
>>
>> # allows to use all functionality of django orm
>> objects = models.DjongoManager()
>>
>> def __str__(self):
>> return self.post
>>
>> serializers.py
>>
>> from rest_framework import serializers
>> from models import Post, Comments
>>
>>
>> class PostSerializer(serializers.ModelSerializer):
>> class Meta:
>> model = Post
>> fields = ('id', 'username', 'title', 'post', 'time_stamp')
>>
>>
>> class CommentsSerializer(serializers.ModelSerializer):
>> class Meta:
>> model = Comments
>> fields = '__all__'
>>
>> views.py
>> from rest_framework_mongoengine import generics
>> from serializers import PostSerializer, CommentsSerializer
>> from models import Post, Comments
>>
>>
>> class PostAPIView(generics.CreateAPIView):
>> lookup_field = 'id'
>> serializer_class = PostSerializer
>>
>> def get_queryset(self):
>> return Post.__objects.all()
>>
>>
>> class CommentsAPIView(generics.CreateAPIView):
>> lookup_field = 'id'
>> serializer_class = CommentsSerializer
>>
>> def get_queryset(self):
>> return Comments.__objects.all()
>>
>> what is the problem with the code? Is this right method to create
>> embedded documents in mongodb?
>> I used python3.6.4, django2.1, djongo1.2.29 and other libraries like
>> pymongo and mongoengine
>>
> --
> 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/f0069400-e4e4-41a4-8503-6662a7f624c7%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/CANR2ZjuXJmdUw6aRWAExUnLKXBk8i%3Dsg_5BJcb7Sy1VWHvu5Kg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet with Django’s user database authentication from Apache

2019-01-28 Thread Binoy U
Hello,

I have created a django project with only one application. I haven't made 
any changes in the application. Only added the application to the settings 
and updated static and media urls.

Migration is done and super user was created.

I have configured apache(version:2.4.29) and mod_wsgi(4.5.17) according to 
Authenticating 
against Django’s user database from Apache 
.

But getting the following error in apache error log.

Traceback (most recent call last):
  File "/home/User1/Documents/test/check_apache/check_apache/wsgi.py", line 13, 
in 
from django.contrib.auth.handlers.modwsgi import check_password
  File 
"/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/handlers/modwsgi.py",
 line 5, in 
UserModel = auth.get_user_model()
  File 
"/home/User1/Documents/test/lib/python3.6/site-packages/django/contrib/auth/__init__.py",
 line 165, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL, require_ready=False)
  File 
"/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
 line 197, in get_model
self.check_apps_ready()
  File 
"/home/User1/Documents/test/lib/python3.6/site-packages/django/apps/registry.py",
 line 132, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")

Please find files below wsgi.py

import osimport mod_wsgi

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'check_apache.settings')from 
django.contrib.auth.handlers.modwsgi import check_passwordfrom django.core.wsgi 
import get_wsgi_application
application = get_wsgi_application()

Error is triggered from from django.contrib.auth.handlers.modwsgi import 
check_password.


apache config file 000-defaults.conf 



Authentication is enabled on the media url. So I hope the apache 
configuration is working fine. I have create a github repository 
 if you would like to 
check.

I got this issue from a bigger project with many application and other 
django modules. But I could still reproduce the same issue with this simple 
project. Can you please help me to resolve this issue, thanks in advance!

-- 
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/add15d87-e8e1-4135-bfe4-7ba93177adfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Logging of full trace with Debug set to False

2019-01-28 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Mon, Jan 28, 2019 at 02:53:55AM -0800, Kevin Olbrich wrote:
> Hi!
> 
> I would like to catch and send all exceptions to a logging system.
> When Debug is set to False, all debug related information is lost (just a 
> HTTP 500 error message).
> 
> While Debug False works perfectly in production, I would like to log and 
> send the exceptions to a backend, where I can save them.
> This would allow me to fix bugs, that only occur once every month (because 
> nobody is able to reproduce).
> 
> Similar approach was the case with Testflight on iOS, where I got a message 
> for every App-crash.
> 
> How can I handle this?
> 
> Kind regards
> Kevin

Hi Kevin,

You can set up your backend logging to send logs to Sentry [1], for
example. You can either set up your own Sentry instance, or use the
commercial offering [2]. If you set up sentry as one of the default
logging handlers, it will catch all unhandled exceptions, and you'll
get a fancy stack trace for each, including the values of local
variables in each stack frame.

Cheers,

Michal


[1]: https://github.com/getsentry/sentry
[2]: https://sentry.io/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCgAGBQJcTuVkAAoJEHA7T/IPM/kl5skQAOVvT+gu33Cn9YuM5152LaN/
hO8jQ5qC85k62+Z+3ptx8xsLOSPpbivdrAWOEW2asgRUFpSzdvsvDpF5ARWUlO9D
3s7bTfNqnPATDjEdiBep4ZQd5eWtkw7aMhHOS6gnwl60zEqlH62MIqOj9NFRL5YV
MMsCTAnqcB2IqXsiGmpxUvc5c20WHac4ODwOkOBAY4CPd1O6s1bf44LtD2bTaJTR
py7KvwKJ+4wkhM89cjnP5etIhdsnPbv+hKry40rji/J/k8VAz2w702jnRc5W6a8d
mPlBYfdZS/tfnNDx+TO+fKgwny1xrrE55vXabVgyt3nQF+KQluf2Zw2Q4HzDhhZ+
6L0QU2xR+EzFHsXCdhUAVF9+0h6guJzNQ7qsSz9KlZoGB5a2Jdk8Q4ji/RBVaORx
GEZpRw/VWTn7/mLvCdOxOH8J/IMf9avyEm+CK8K23BMFqO7ydmtUIboN/MVQ1UJA
4Xjp3vm1zB5hcaS9AjAJ5/vn9ySPjE9deoBxqUuN7I30Vug/EqqDhBhqOCiiwp4p
V6OwPMqhhZig3cvmigvwhZoT+WXUQwrGAGodleBon8ajIUcB1dxyxbPnbeIzSKPg
9lNot8WLlQEwYN7HWVQRMTc0NtLRg4YTI7UZWcwAneznxrCwKyzdQV3PhiN5A1Kh
VRcuK/Cf70seqQEarfXL
=HFoa
-END PGP SIGNATURE-

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


Re: Adding default rows to Django admin inlines

2019-01-28 Thread Kevin Olbrich
Hi!

Maybe I did not fully understand but it seems we indeed don't talk about 
the same.
I already got M2M relation.
If I access the "Jobs" admin-page, I have the option to add inline-options.
On a new object, there are no lines but I can add new.
I would like to add lines for the attributes from M2M relation of (Actions 
-> Attributes).
Every action has a different set of attributes that needs to be defined. If 
I open the admin page for Jobs, it would need to refresh (or AJAX) the form 
to display the correct default set of attributes in the inline area, as 
soon as I choose / change the Action type.

Pseudo: With HTML and JS I would listen for a change event, then AJAX an 
API for the attributes. Then I would clear the inline-area and add new rows 
for each mandatory attribute.

I wonder if this is possible with Django alone, without building a view.

Kind regards
Kevin


Am Samstag, 19. Januar 2019 21:47:45 UTC+1 schrieb Mohammad Etemaddar:
>
> If I get you right you need to add m2m objects with a default value.
> In this situation, you can create an intermediate model to build m2m.
> For example:
> JobActionRel:
> job = fk
> action = fk-to-actions (default=Action.objects.get...)
>
> And use it as through model:
>
> https://docs.djangoproject.com/en/2.1/topics/db/models/#extra-fields-on-many-to-many-relationships
>
> Now, in admin you see the default action.
> Remember, before making it through, create JobActionRels from previous m2m 
> objects.
>
>

-- 
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/871c12e5-909e-49ab-9f33-a480607e6490%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Logging of full trace with Debug set to False

2019-01-28 Thread Kevin Olbrich
Hi!

I would like to catch and send all exceptions to a logging system.
When Debug is set to False, all debug related information is lost (just a 
HTTP 500 error message).

While Debug False works perfectly in production, I would like to log and 
send the exceptions to a backend, where I can save them.
This would allow me to fix bugs, that only occur once every month (because 
nobody is able to reproduce).

Similar approach was the case with Testflight on iOS, where I got a message 
for every App-crash.

How can I handle this?

Kind regards
Kevin

-- 
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/3d10c100-6674-491d-b88f-2a1f2d92fcbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.