Unable to load Google Tag Manager in my Django admin app

2019-02-01 Thread prateek gupta
Hi All,

I am trying to use Google Tag Manager(GTM) in my Django 2.0.6 application 
by following below url-
https://github.com/Lacrymology/django-google-tag-manager

In GTM console I have set my app but when I preview my app, GTM is not 
loading.
I suspect I am missing something with respect to my templates.

Below is my project structure-

[image: django_project.JPG]

In base.html I have put following code-

{% load gtm_tags %}



{% gtm_head %}
GTM testing




{% gtm_body %}



GTM Testing Page




 {% block content %}
 {% endblock %}







In authorize_geoplugin.html I have put following lines-

{% extends 'base.html' %}

{% block content %}

ABCDEFGHIJUTLOPP


{% endblock %}


And in settings.py I have added the package as below-

[image: settings.JPG]

It's a basic templates setup I have done just for GTM.

Can anyone please tell me what I am doing wrong here?

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/7a9c254f-454d-4f61-89b6-2974efc88706%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to load Google Tag Manager in my Django admin app

2019-02-01 Thread prateek gupta
Here my aim was to use geoplugin with GTM in my Django app.
For this I need to hit following url first to get authorize in geoplugin 
site-
http://www.MYDJANGO.com/geoplugin_activation.html  
<http://www.MYDJANGO.com/geoplugin_activation.html>

That's why I have created two html files.

On Friday, February 1, 2019 at 3:39:57 PM UTC+5:30, prateek gupta wrote:
>
> Hi All,
>
> I am trying to use Google Tag Manager(GTM) in my Django 2.0.6 application 
> by following below url-
> https://github.com/Lacrymology/django-google-tag-manager
>
> In GTM console I have set my app but when I preview my app, GTM is not 
> loading.
> I suspect I am missing something with respect to my templates.
>
> Below is my project structure-
>
> [image: django_project.JPG]
>
> In base.html I have put following code-
>
> {% load gtm_tags %}
>
> 
> 
> {% gtm_head %}
> GTM testing
>  href="/static/admin/css/base.css" />
>  href="/static/admin/css/login.css" />
> 
> 
> {% gtm_body %}
> 
> 
> 
> GTM Testing Page
> 
> 
> 
> 
>  {% block content %}
>  {% endblock %}
> 
> 
> 
> 
> 
>
>
> In authorize_geoplugin.html I have put following lines-
>
> {% extends 'base.html' %}
>
> {% block content %}
> 
> ABCDEFGHIJUTLOPP
> 
>
> {% endblock %}
>
>
> And in settings.py I have added the package as below-
>
> [image: settings.JPG]
>
> It's a basic templates setup I have done just for GTM.
>
> Can anyone please tell me what I am doing wrong here?
>
> 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/4ce04497-b004-49d5-8d10-815c8fb25c77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connecting a model of deep learning to website built in django.

2019-02-01 Thread prateek gupta
Hi,

I have found django-ai  which 
you can use to integrate your deep learning model in your django project.

On Thursday, January 31, 2019 at 4:54:16 PM UTC+5:30, Bushra Tayyaba wrote:
>
> I have built a model in deep learning and want to use this model or deploy 
> this model through website. I am django and do not know how to do this. Can 
> Someone Explain.
>

-- 
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/f8cc8442-5b0d-4d62-a021-14c77103d06b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting django.db.utils.OperationalError: (2005, "Unknown MySQL server host error with AWS

2018-06-15 Thread prateek gupta
Hi All,

I am trying to connect with AWS and when I run the server I get following 
error-
django.db.utils.OperationalError: (2005, "Unknown MySQL server 
host 'psdbuat.chmnxeoa2hhd.ap-southeast-1.rds.amazonaws.com' (0)")

I checked the connection in mysql workbench and details are fine.
My settings.py is as below-

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'myschema',
'USER': 'admin',
'PASSWORD': 'aadmin',
'HOST': 'psdbuat.chmnxeoa2hhd.ap-southeast-1.rds.amazonaws.com',
'PORT': '3306',
}
}


I googled and found it is issue with AWS but did not find any solution.

Can anyone please share teh solution for it?

-- 
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/5558daa2-89c7-44aa-9553-a5441e904b71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting django.db.utils.OperationalError: (2005, "Unknown MySQL server host error with AWS

2018-06-15 Thread prateek gupta
Thanks, I will verify.

On Friday, June 15, 2018 at 7:55:10 PM UTC+5:30, Andréas Kühne wrote:
>
> As Jason stated you probably have an issue with security groups. Make sure 
> that your EC2 instance is in a security group that can access the mysql 
> server. Otherwise you won't be able to connect. And the error you have is 
> what you get when the security groups aren't correct.
>
> See here:
>
> https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/TUT_WebAppWithRDS.html
>
> Regards,
>
> Andréas
>
> 2018-06-15 15:11 GMT+02:00 Jason >:
>
>> have you checked your security settings in the aws console to make sure 
>> the port is open?
>>
>> also have you seen https://stackoverflow.com/a/45792248/214892
>>
>> -- 
>> 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/ff00ed62-d489-42b7-90de-a835e4f57da2%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/f5afb193-5ba0-4db2-907c-a1eba457a522%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting django.db.utils.OperationalError: (2005, "Unknown MySQL server host error with AWS

2018-06-15 Thread prateek gupta
Thanks Json, I will check this.

On Friday, June 15, 2018 at 6:41:42 PM UTC+5:30, Jason wrote:
>
> have you checked your security settings in the aws console to make sure 
> the port is open?
>
> also have you seen https://stackoverflow.com/a/45792248/214892
>

-- 
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/568b8f4f-5f07-4745-a72f-2652e8b7832b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


facing aws s3 image file path issue?

2018-06-18 Thread prateek gupta
Hi All,

I have created a bitbucket and some folders inside that with following 
path: my_bucket\merchant\logos\
I am trying to upload a image file inside the my_bucket\merchant\logos 
folder but it is saving inside the my-merchant folder instead of logos.
PFB my code snippet-

config.json-

{
  "AWS_STORAGE_BUCKET_NAME": "my_bucket",
  "AWS_ACCESS_KEY_ID": "MY_KEY",
  "AWS_SECRET_ACCESS_KEY": "SECRET_KEY",
  "S3DIRECT_REGION": "us-east-1",
}


settings.py-

AWS_STORAGE_BUCKET_NAME = ENV_TOKENS.get('AWS_STORAGE_BUCKET_NAME')
AWS_ACCESS_KEY_ID = ENV_TOKENS.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = ENV_TOKENS.get('AWS_SECRET_ACCESS_KEY')
AWS_BASE_DOMAIN = 's3.amazonaws.com'
AWS_S3_CUSTOM_DOMAIN = '%s.%s' % (AWS_STORAGE_BUCKET_NAME, AWS_BASE_DOMAIN)
STATIC_URL = '/static/'
MEDIA_FILES_LOCATION = 'merchant'
MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, MEDIA_FILES_LOCATION)


models.py-

def logo(self):
logo_name = '{}{}'.format(self.name, '.png')
s3_key_name = os.path.join(settings.MEDIA_FILES_LOCATION, 'logos', 
logo_name)
print("s3_key_name::",s3_key_name)
# Generate file URL
bucket_name = settings.AWS_STORAGE_BUCKET_NAME
s3_endpoint = settings.AWS_BASE_DOMAIN
file_url = 'https://{}/{}/{}'.format(s3_endpoint, bucket_name, s3_key_name)
print("file_url::",file_url)

return file_url


The print values in above functions are-

s3_key_name:: merchant\logos\example.png
file_url:: https://s3.amazonaws.com/my_bucket/merchant\logos\example.png


Can anyone please help me to solve how the set the path correct and instead of 
saving image url how to save actual image?

-- 
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/1de2f3d3-0e5e-433e-9e95-3c8aa293fcb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Please correct my aws s3 path for image loading in Django 2.0.6!

2018-06-18 Thread prateek gupta
Hi Experts!

I am trying to upload an image inside the following AWS S3 path:
*pg-merchant/merchant/logos*
But the image is uploading inside the following path:*pg-merchant* instead 
of storing inside the *logos *folder; pfa screen of the same.



I am suspecting there must be a mistake in my code but I am unable to find 
it out so need your help here.
PFB my code snippet-

*config.json*-

{
  "AWS_STORAGE_BUCKET_NAME": "pg-merchant",
  "AWS_ACCESS_KEY_ID": "",
  "AWS_SECRET_ACCESS_KEY": "",
  "S3DIRECT_REGION": "us-east-1",
}




*settings.py*-

AWS_STORAGE_BUCKET_NAME = ENV_TOKENS.get('AWS_STORAGE_BUCKET_NAME')
AWS_ACCESS_KEY_ID = ENV_TOKENS.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = ENV_TOKENS.get('AWS_SECRET_ACCESS_KEY')
AWS_BASE_DOMAIN = 's3.amazonaws.com'
AWS_S3_CUSTOM_DOMAIN = '%s.%s' % (AWS_STORAGE_BUCKET_NAME, AWS_BASE_DOMAIN)
STATIC_URL = '/static/'
MEDIA_FILES_LOCATION = 'merchant'
MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, MEDIA_FILES_LOCATION)
DEFAULT_FILE_STORAGE = 'ps_cms.custom_storages.MediaStorage'




*models.py*-

@property
def logo(self):
logo_name = '{}{}'.format(self.name, '.png')
s3_key_name = os.path.join(settings.MEDIA_FILES_LOCATION, 'logos', 
logo_name)

# Generate file URL
bucket_name = settings.AWS_STORAGE_BUCKET_NAME
s3_endpoint = settings.AWS_BASE_DOMAIN
file_url = 'https://{}/{}/{}'.format(s3_endpoint, bucket_name, s3_key_name)

return file_url



forms.py-

def _upload_logo(self, logo, merchant_name):
ext = os.path.splitext(logo.name)[1]  # [0] returns path+filename
logo_name = '{}{}'.format(merchant_name, ext)

s3_client = self._get_s3_client()
s3_key_name = os.path.join(settings.MEDIA_FILES_LOCATION, 'logos', 
logo_name)
s3_client.upload_fileobj(logo, settings.AWS_STORAGE_BUCKET_NAME, 
s3_key_name)

# Generate file URL
bucket_name = settings.AWS_STORAGE_BUCKET_NAME
s3_endpoint = settings.AWS_BASE_DOMAIN
new_file_url = 'https://{}/{}/{}'.format(s3_endpoint, bucket_name, 
s3_key_name)

return new_file_url


-- 
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/f319a0d4-9d68-4e6f-962f-346534a7d7ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can I use django-location-field module in Production?

2018-06-18 Thread prateek gupta
Hi All,

I am auto populating latitude and longitude fields once user entered the 
address in a address form.
For this task I am using https://pypi.org/project/django-location-field/

from location_field.models.plain import PlainLocationField


I need to know can I use same module in Production? Is there any license 
issue for using this in Production?
If yes, what is the alternate of 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/02af1679-acb6-47c7-b678-bbf8092a6846%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please correct my aws s3 path for image loading in Django 2.0.6!

2018-06-18 Thread prateek gupta
Thanks Jason, this was the exact issue and now I am able to fix this by 
using below loc-

s3_key_name = posixpath.join(settings.MEDIA_FILES_LOCATION, 'logos', logo_name)


On Monday, June 18, 2018 at 5:04:24 PM UTC+5:30, Jason wrote:
>
> I think the issue is s3_key_name
>
> S3 is *not* a file based structure, it is simply a key-value object 
> store.  Much like a python dictionary.  However, there are some 
> abstractions to mimic folders and paths with S3, and that's indicated by 
> using / in the key name.  Your key name is using slashes in the other 
> direction, which aren't processed by S3 as folder names.
>

-- 
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/d001420a-68a1-431e-9663-d738ac09e885%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to auto fill latitude and longitude fields in Django2.0.6?

2018-06-18 Thread prateek gupta


Hi All,


I have created a store address form using Django2.0.6+Mysql+Python3.6.

Currently user has to manually fill latitude and longitude for the store 
address.

I want to auto-fill both fields once user entered the address.

Below is my current code-

models.py-

class Store(models.Model):
building = models.ForeignKey(Building, related_name='building', 
on_delete=models.SET_NULL, blank=True, null=True)
name = models.CharField(max_length=100)
postal_code = models.CharField(max_length=6)
address = models.TextField()
latitude = models.FloatField(validators=[MinValueValidator(-90.0), 
MaxValueValidator(90.0)])
longitude = models.FloatField(validators=[MinValueValidator(-180.0), 
MaxValueValidator(180.0)])
class Meta:
managed = False
db_table = 'store'


admin.py-

class StoreAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'postal_code', 'address', 'latitude', 
 'longitude')


Can anyone please help me how to achieve this requirement?

-- 
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/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to auto fill latitude and longitude fields in Django2.0.6?

2018-06-19 Thread prateek gupta
It seems for this I need to use API key from google.
Have you heard about this python package- from location_field.models.plain 
import 
PlainLocationField?

I tried with this one but getting some issues-
Issue while using PlainLocationField 
<https://stackoverflow.com/questions/50915074/getting-strange-value-error-in-django-while-using-the-plainlocationfield-library>
On Tuesday, June 19, 2018 at 12:15:54 PM UTC+5:30, johnf wrote:
>
> I use pygeocoder.py and something like this!
>
> johnf
>
> class Getlatitudelongitude(dObject):
> ###
> #   gmaps.py
> ###
>
> import urllib
> from time import sleep
> import pygeocoder
>
>
> key = "here_goes_your_key"
>
> def location2latlong(self, query, key="here_goes_your_key" ):
> """pass a complete address
> 18 Tadlock Place Woodland, CA 95776"""
> """Get the ( latitute, longitude ) coordinates corresponding
> to the query. If something goes wrong return None."""
> import urllib
> from time import sleep
> import pygeocoder
>
> #output = 'csv'
>
> #params = { }
> ### The key below was generated by accessing google 
> http://code.google.com/apis/maps/signup.html
> #params[ 'key' ] = 
> 'ABQILTR1FL24DycBouLv0t9q3xTEP5gmNW-Z6UMR8J4ewevcZqC8sxRRfI_D2-yrCM4YXmAZEPFdIzSijA'
>  
> #key
> #params[ 'output' ] = output
> #params[ 'q' ] = query
>
> #params = urllib.urlencode( params )
> #print params
> a_geo_class = pygeocoder.Geocoder()
>
> try:
> #f = urllib.urlopen( "http://maps.google.com/maps/geo?%s"; % 
> params )
> f = a_geo_class.geocode(query)
>     response = f.coordinates
> latitude = response[0]
> longitude = response[1]
> #f.close()
> return latitude, longitude
> except pygeocoder.GeocoderError as err:
> return None
>
> On 06/18/2018 10:45 PM, prateek gupta wrote:
>
> Hi All,
>
>
> I have created a store address form using Django2.0.6+Mysql+Python3.6.
>
> Currently user has to manually fill latitude and longitude for the store 
> address.
>
> I want to auto-fill both fields once user entered the address.
>
> Below is my current code-
>
> models.py-
>
> class Store(models.Model):
> building = models.ForeignKey(Building, related_name='building', 
> on_delete=models.SET_NULL, blank=True, null=True)
> name = models.CharField(max_length=100)
> postal_code = models.CharField(max_length=6)
> address = models.TextField()
> latitude = models.FloatField(validators=[MinValueValidator(-90.0), 
> MaxValueValidator(90.0)])
> longitude = models.FloatField(validators=[MinValueValidator(-180.0), 
> MaxValueValidator(180.0)])
> class Meta:
> managed = False
> db_table = 'store'
>
>
> admin.py-
>
> class StoreAdmin(admin.ModelAdmin):
> list_display = ('id', 'name', 'postal_code', 'address', 'latitude', 
>  'longitude')
>
>
> Can anyone please help me how to achieve this requirement?
> -- 
> 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/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com?utm_medium=email&utm_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+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/1d9b006f-e1bc-47e5-8812-4841a41c1b86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to auto fill latitude and longitude fields in Django2.0.6?

2018-06-20 Thread prateek gupta
I am working in Singapore and trying to store details of different 
merchants of Singapore.
So if any merchant wants to add a new store, I am giving him this option 
build on Django.
So once he entered his store address, the lat/long fields will be auto-fill 
and location field will show the map.
The implementation part I have already covered above, you can check what 
package I am using for this functionality.

On Wednesday, June 20, 2018 at 12:37:03 PM UTC+5:30, TonyF-UK wrote:
>
> You need access to a service (or data set) which translates addresses to 
> latitude/longitude.
>
> It will depend on your country whether this information is available 
> and/or whether you need to pay for access to that service, and how that 
> service 
>
> Which countries will your application cover - maybe with some extra 
> information someone can give you some more details.
>
> There is nothing in django that provides this capability.
>
> Question - why do you need latitude and longitude ?
>
> -- 
> -- Anthony Flury
> email : *anthon...@btinternet.com *
> Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*
>  
> -- 
> Anthony Flury
> anthon...@btinternet.com 
>
>
> --
> *From:* prateek gupta >
> *To:* Django users > 
> *Sent:* Tuesday, June 19, 2018 6:45 AM
> *Subject:* How to auto fill latitude and longitude fields in Django2.0.6?
>
> Hi All,
>
> I have created a store address form using Django2.0.6+Mysql+Python3.6.
> Currently user has to manually fill latitude and longitude for the store 
> address.
> I want to auto-fill both fields once user entered the address.
> Below is my current code-
> models.py-
>
> class Store(models.Model):
> building = models.ForeignKey(Building, related_name='building', 
> on_delete=models.SET_NULL, blank=True, null=True)
> name = models.CharField(max_length=100)
> postal_code = models.CharField(max_length=6)
> address = models.TextField()
> latitude = models.FloatField(validators=[MinValueValidator(-90.0), 
> MaxValueValidator(90.0)])
> longitude = models.FloatField(validators=[MinValueValidator(-180.0), 
> MaxValueValidator(180.0)])
> class Meta:
> managed = False
> db_table = 'store'
>
>
> admin.py-
>
> class StoreAdmin(admin.ModelAdmin):
> list_display = ('id', 'name', 'postal_code', 'address', 'latitude', 
>  'longitude')
>
>
> Can anyone please help me how to achieve this requirement?
> -- 
> 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/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/56497a07-9c46-4413-9fab-db3f17298146%40googlegroups.com?utm_medium=email&utm_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+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/143e186c-2bcb-4e16-a117-4b1ae0fd4e1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to fetch latitude and longitude from location field and save them separately in db (Django 2.0.6+Python3.6)?

2018-06-20 Thread prateek gupta
Hi All,

I have created a model in Django 2.0.6+Python 3.6 which maps to a table in 
Database i.e. store table
This store table has columns- id, name, address, location, latitude, 
longitude.

Currently user don't have to manually fill the location field, it is filled 
with latitude,longitude based on the address entered. For this purpose I am 
using following package in Django- django-location-field 


I need to fetch the values of latitude/longitude from this location field 
and save into respective latitude and longitude columns in db.
Currently in DB only location field is saved with latitude,longitude values.

How can I achieve this?

My Code is as below-

models.py:
from location_field.models.plain import PlainLocationField
class Store(OwnedModel):
   name = models.CharField(max_length=100)
   address = models.TextField(default='Mumbai')
   location = PlainLocationField(based_fields=['address'], zoom=7, null=True
)
class Meta:
   managed = False
   db_table = 'store'

admin.py:
class StoreAdmin(admin.ModelAdmin):
   list_display = ('id', 'name', 'address')


-- 
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/c2dc13d9-3c0b-4bb0-845e-82f05f8d7ad6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Why some Django fields are not saved in database?

2018-06-21 Thread prateek gupta
Hi All,

I have a store address form in Django which have fields like- name, 
address, location, latitude, longitude etc.

I am autofilling the latitude, longitude fields based on address with the 
help of django package-https://github.com/caioariede/django-location-field


In django view after the form submisson I am able to see both fields values-





Issue is in database , latitude/longitude values are blank.

What I am doing wrong here?


models.py-

from location_field.models.plain import PlainLocationFieldclass 
Store(OwnedModel):
  address = models.TextField(default='Mumbai')
  location = PlainLocationField(based_fields=['address'], zoom=7, null=True)

  @property
  def latitude(self):
  if not self.location:
  return
  latitude, _ = self.location.split(',')
  return latitude

  @property
  def longitude(self):
  if not self.location:
  return
  _, longitude = self.location.split(',')
  return longitude

  class Meta:
  managed = False
  db_table = 'store'


admin.py-

class StoreAdmin(admin.ModelAdmin):
  list_display = ( 'address', 'latitude','longitude')
  readonly_fields = ('latitude', 'longitude',)


I am using Django2.0.6,Python3.6,Mysql

-- 
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/e4d3a1f7-c618-4f2b-979c-3e258f0c5bec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why some Django fields are not saved in database?

2018-06-21 Thread prateek gupta
Thanks for reviewing the code.

I am new to Django and just tried to put logic from googling to achieve my 
goal.
That's why I don't understand my code completely.

Can you please point out where I am doing this and how can I change this 
behaviour?


On Thursday, June 21, 2018 at 2:48:46 PM UTC+5:30, Melvyn Sopacua wrote:
>
> On donderdag 21 juni 2018 10:42:09 CEST prateek gupta wrote: 
>
> > Issue is in database , latitude/longitude values are blank. 
> > 
> > What I am doing wrong here? 
>
> Why do you not understand your own code? How did you get that code - you 
> explicitly code it so that it they do NOT end up in the database. So why 
> are 
> you asking why? 
>
> -- 
> 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/3cbfcc76-dca5-4cfe-860c-23a407dc21d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread prateek gupta
Hi All,

I need your help in one task.
I have created a address form in Django 2.0.6 + Python3.6.
In this form once user entered the address, the location field is auto 
filled with latitude,longitude as below screen shot-



Now I want to write a python function which can fetch Latitude and 
Longitude values from the Location field and can save them in respective 
Latitude/Longitude fields.

My models.py code is as below:
class Store(models.Model):
postal_code = models.CharField(max_length=6)
address = models.TextField()
location = PlainLocationField(based_fields=['address'], zoom=7, 
null=True)
phone = models.CharField(max_length=60, blank=True, null=True)
latitude = models.FloatField()
longitude = models.FloatField()
class Meta:
managed = False
db_table = 'store'

admin.py:

class StoreAdmin(admin.ModelAdmin):
list_display = ('postal_code', 'address','phone', 'latitude', 'longitude')


Can anyone help me to achieve this functionality?

-- 
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/c453ba82-7e0a-4fc1-8c8e-0a588b857627%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Why some Django fields are not saved in database?

2018-06-21 Thread prateek gupta
Thanks for sharing this, I will do the same first.

On Thursday, June 21, 2018 at 5:55:42 PM UTC+5:30, Melvyn Sopacua wrote:
>
> On donderdag 21 juni 2018 11:31:26 CEST prateek gupta wrote:
>
>  
>
> > Thanks for reviewing the code.
>
> > 
>
> > I am new to Django and just tried to put logic from googling to achieve 
> my
>
> > goal.
>
> > That's why I don't understand my code completely.
>
>  
>
> Try to understand it before applying. The main issue you're facing is the 
> difference between class attributes and model fields.
>
>  
>
> A model field is a special class attribute that Django stores in the 
> database. You have to declare them using one of the field types 
> <https://docs.djangoproject.com/en/2.0/ref/models/fields/> that Django 
> supports.
>
> Everything else is not saved in the database.
>
>  
>
> You're using a custom model field 
> <https://docs.djangoproject.com/en/2.0/howto/custom-model-fields/> for 
> the location in your model. Part of that field is that it stores in the 
> lon/lat information for you, so that you don't have to worry about it. What 
> it doesn't provide is a solid way for you to get the location data from the 
> field. As you've figured out, it is stored as a string, which makes it 
> difficult to make queries on lon/lat coordinates.
>
>  
>
> So it's probably not the right tool for the job. But before you go looking 
> for a different package, you should really learn more about Django, for 
> example complete the tutorial and in your case it'll be helpful to go 
> through the GIS tutorial 
> <https://docs.djangoproject.com/en/2.0/ref/contrib/gis/tutorial/> as 
> well. Cause then you'd discover that other then support for Mapbox and 
> Google maps, Django already has built in most of what the DJango Location 
> Field package is offering you.
>
>  
>
> -- 
>
> 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/dc6fb244-13b7-446c-8a9a-7e4a7c09b122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread prateek gupta
Got it Jason, I will not post anymore now.

On Thursday, June 21, 2018 at 5:31:13 PM UTC+5:30, Jason wrote:
>
> You've been posting here about this regularly (at least four times) with 
> no responses.  I don't think anyone here knows how to solve your problem.  
> what else have you looked at?  eg, have you asked on stack overflow or 
> other places?
>

-- 
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/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread prateek gupta
Thanks for your reply.
I was trying to first use in built django library for that 
https://github.com/caioariede/django-location-field
It is showing me a map with location field(conaining latitude,longitude)
But I want to save the latitude/longitude values in DB so I am not seeing 
any way in this inbuild library.

Now I will try Google API.

On Thursday, June 21, 2018 at 6:04:32 PM UTC+5:30, Julio Biason wrote:
>
> Hi Prateek.
>
> You're using Google Maps for the lat/long, right?
>
> In this case, I'd suggest that, on the function you receive the data and 
> update the field, you also make a request to some URL to update the 
> lat/long of the current displayed object.
>
> On Thu, Jun 21, 2018 at 9:29 AM, prateek gupta  > wrote:
>
>> Got it Jason, I will not post anymore now.
>>
>> On Thursday, June 21, 2018 at 5:31:13 PM UTC+5:30, Jason wrote:
>>>
>>> You've been posting here about this regularly (at least four times) with 
>>> no responses.  I don't think anyone here knows how to solve your problem.  
>>> what else have you looked at?  eg, have you asked on stack overflow or 
>>> other places?
>>>
>> -- 
>> 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/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>

-- 
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/b4c346b2-1032-485e-8b96-d1131dcfcc06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fill latitude and longitude values from an existing location field in Django+Python?

2018-06-21 Thread prateek gupta
I am using Django 2.0.6 and yes I am able to use this package .
This package is currently showing a map below the address and once I enter 
the address; it fill the location field and changes the map according.

On Thursday, June 21, 2018 at 7:41:22 PM UTC+5:30, Matthew Pava wrote:
>
> Based on the information of that project, it does not support Django 
> passed version 1.10.  What version are you using?
>
> Saving of the location should be automatic based on my understanding of 
> that package.
>
> You may want to contact the author of that package to get more help.
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *prateek gupta
> *Sent:* Thursday, June 21, 2018 8:54 AM
> *To:* Django users
> *Subject:* Re: How to fill latitude and longitude values from an existing 
> location field in Django+Python?
>
>  
>
> Thanks for your reply.
>
> I was trying to first use in built django library for that 
> https://github.com/caioariede/django-location-field
>
> It is showing me a map with location field(conaining latitude,longitude)
>
> But I want to save the latitude/longitude values in DB so I am not seeing 
> any way in this inbuild library.
>
>  
>
> Now I will try Google API.
>
> On Thursday, June 21, 2018 at 6:04:32 PM UTC+5:30, Julio Biason wrote:
>
> Hi Prateek.
>
>  
>
> You're using Google Maps for the lat/long, right?
>
>  
>
> In this case, I'd suggest that, on the function you receive the data and 
> update the field, you also make a request to some URL to update the 
> lat/long of the current displayed object.
>
>  
>
> On Thu, Jun 21, 2018 at 9:29 AM, prateek gupta  wrote:
>
> Got it Jason, I will not post anymore now.
>
> On Thursday, June 21, 2018 at 5:31:13 PM UTC+5:30, Jason wrote:
>
> You've been posting here about this regularly (at least four times) with 
> no responses.  I don't think anyone here knows how to solve your problem.  
> what else have you looked at?  eg, have you asked on stack overflow or 
> other places?
>
> -- 
> 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/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> -- 
>
> *Julio Biason*, Sofware Engineer
>
> *AZION*  |  Deliver. Accelerate. Protect.
>
> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>
> -- 
> 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 djang...@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/b4c346b2-1032-485e-8b96-d1131dcfcc06%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/b4c346b2-1032-485e-8b96-d1131dcfcc06%40googlegroups.com?utm_medium=email&utm_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+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/fd219fe9-892c-4061-930b-6e8b22849b32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fill latitude and longitude values from an existinglocation field in Django+Python?

2018-06-22 Thread prateek gupta
They have mentioned that it is for Django PostGIS fields.

On Thursday, June 21, 2018 at 11:52:55 PM UTC+5:30, Himanshu Gamit wrote:
>
> Prateek,
>
>  
>
> Have you tried this module? 
> http://django-map-widgets.readthedocs.io/en/latest/
>
>  
>
> Thanks
>
> Himanshu
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for 
> Windows 10
>
>  
>
> *From: *prateek gupta 
> *Sent: *Thursday, June 21, 2018 10:32 AM
> *To: *Django users 
> *Subject: *Re: How to fill latitude and longitude values from an 
> existinglocation field in Django+Python?
>
>  
>
> I am using Django 2.0.6 and yes I am able to use this package .
>
> This package is currently showing a map below the address and once I enter 
> the address; it fill the location field and changes the map according.
>
> On Thursday, June 21, 2018 at 7:41:22 PM UTC+5:30, Matthew Pava wrote:
>
> Based on the information of that project, it does not support Django 
> passed version 1.10.  What version are you using?
>
> Saving of the location should be automatic based on my understanding of 
> that package.
>
> You may want to contact the author of that package to get more help.
>
>  
>
> *From:* django...@googlegroups.com [mailto:django...@googlegroups.com] *On 
> Behalf Of *prateek gupta
> *Sent:* Thursday, June 21, 2018 8:54 AM
> *To:* Django users
> *Subject:* Re: How to fill latitude and longitude values from an existing 
> location field in Django+Python?
>
>  
>
> Thanks for your reply.
>
> I was trying to first use in built django library for that 
> https://github.com/caioariede/django-location-field
>
> It is showing me a map with location field(conaining latitude,longitude)
>
> But I want to save the latitude/longitude values in DB so I am not seeing 
> any way in this inbuild library.
>
>  
>
> Now I will try Google API.
>
> On Thursday, June 21, 2018 at 6:04:32 PM UTC+5:30, Julio Biason wrote:
>
> Hi Prateek.
>
>  
>
> You're using Google Maps for the lat/long, right?
>
>  
>
> In this case, I'd suggest that, on the function you receive the data and 
> update the field, you also make a request to some URL to update the 
> lat/long of the current displayed object.
>
>  
>
> On Thu, Jun 21, 2018 at 9:29 AM, prateek gupta  wrote:
>
> Got it Jason, I will not post anymore now.
>
> On Thursday, June 21, 2018 at 5:31:13 PM UTC+5:30, Jason wrote:
>
> You've been posting here about this regularly (at least four times) with 
> no responses.  I don't think anyone here knows how to solve your problem.  
> what else have you looked at?  eg, have you asked on stack overflow or 
> other places?
>
> -- 
> 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/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/2c6cc9f6-1455-439c-ad78-459fcc1828ab%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> -- 
>
> *Julio Biason*, Sofware Engineer
>
> *AZION*  |  Deliver. Accelerate. Protect.
>
> Office: +55 51 3083 8101  |  Mobile: +55 51 *99907 0554*
>
> -- 
> 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 djang...@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/b4c346b2-1032-485e-8b96-d1131dcfcc06%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/b4c346b2-1032-485e-8b96-d1131dcfcc06%40googlegroups.com?utm_medium=email&utm_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...@go

better way to create a dictionary in Django model?

2018-06-27 Thread prateek gupta
Hi All,

I am using Django 2.0.6 with Python 3.6 and MySql and created a model which 
maps the db tables to django.
In my database, I have a column 'config' of type json.
This column stores the data in a dictionary format like below- 
{"user_id": "a...@example.com", "password": "xyz"}
I need to make it editable via the Django like below screen shot-



I need your suggestion - what is the best way to achieve this?
I found a useful link for this purpose -
how-to-store-a-dictionary-on-a-django-model 

 but 
want to take your valuable guidance before proceeding so that I can 
implement with best practices.

-- 
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/eeaba88f-136a-4e03-9599-b564a596bdf8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: better way to create a dictionary in Django model?

2018-06-27 Thread prateek gupta
It has some limit- The configuration object can only be changed, there's no 
link for "add" (1)

On Wednesday, June 27, 2018 at 6:41:41 PM UTC+5:30, Egor Smolyakov wrote:
>
> Better way it to use packages like this 
> https://github.com/lazybird/django-solo
>
> On 27 June 2018 at 15:18, prateek gupta > 
> wrote:
>
>> Hi All,
>>
>> I am using Django 2.0.6 with Python 3.6 and MySql and created a model 
>> which maps the db tables to django.
>> In my database, I have a column 'config' of type json.
>> This column stores the data in a dictionary format like below- 
>> {"user_id": "a...@example.com ", "password": "xyz"}
>> I need to make it editable via the Django like below screen shot-
>>
>>
>> <https://lh3.googleusercontent.com/-KvJmUsBCPso/WzN-3u5rcyI/MTM/esDa67bBIHEpSnsW9kgYfnQEKrIKHxfuACLcBGAs/s1600/config_cms.JPG>
>>
>> I need your suggestion - what is the best way to achieve this?
>> I found a useful link for this purpose -
>> how-to-store-a-dictionary-on-a-django-model 
>> <https://stackoverflow.com/questions/402217/how-to-store-a-dictionary-on-a-django-model>
>>  but 
>> want to take your valuable guidance before proceeding so that I can 
>> implement with best practices.
>>
>> -- 
>> 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/eeaba88f-136a-4e03-9599-b564a596bdf8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/eeaba88f-136a-4e03-9599-b564a596bdf8%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Kind Regards, Yehor Smoliakov.
>
>
>
>

-- 
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/44e2b155-e62a-4724-9cb5-32437ca471d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: better way to create a dictionary in Django model?

2018-06-27 Thread prateek gupta
Thanks Mark for sharing every step! It helps a lot.

On Wednesday, June 27, 2018 at 7:57:25 PM UTC+5:30, mark wrote:
>
> The way I work with json data in the admin is rather complicated. Here are 
> a the steps I use - check the django documentation and Google for details.
>
> As an example, assume you have a table Documents with a JSON field called 
> metadata and other "normal" django fields. The metadata is a dictionary of 
> key - value pairs. Note: the "value" can be a string, list, dictionary, 
> integer, real, etc. It all depends on your needs and the field/widget you 
> define for your field.
>
> 1. Create a DocumentAdminForm(forms. ModelForm)
> 2. Override the __init__ method in the DocumentAdminForm to create all of 
> your JSON fields. I use the key as the name of the field. You will have 
> field definitions of the form
> self.fields[key] = forms.CharField( model>). You can use any field type - DateField, BooleanField, 
> ModelChoiceField, ModelMultipleChoiceField, etc. For the last two fields, 
> your value will be a list in the JSON data. You can also use any of the 
> django or admin widgets for these fields - just add them to the field 
> definition.
> 3. To initialize the field with data from your JSON field, use 
> self.fields[key].initial =  
> in the __init__ method.
> 4. In django > 1.8, be sure to have fields='__all__' in the Meta section 
> of the DocumentAdminForm
> 5. Override the clean method to validate the data you get back from the 
> form. There will be an entry in the self.cleaned_data dictionary for each 
> field in the form. You have to go through all the entries for your JSON 
> keys, validate whether the data is good or not, save them into a metadata 
> dictionary of the correct form for your JSON field, and remove that field 
> from the self.cleaned_data dictionary. At the end, the self.cleaned_data 
> should only have the fields that are defined in your model, and one 
> dictionary for your metadata JSON object. If one of the JSON fields has bad 
> data, then add a validation error to self.add_errors(key, validation_error) 
> - still remove this field info from the self.cleaned_data. 
>
> Create a DocumentAdmin(model.Admin) class. 
> 1. set the form = DocumentAdminForm
> 2. Define a fieldset just for the fields in your model (not the JSON field)
> 3. Override get_form to flatten the fieldsets:
> def get_form(self, request, obj=None, **kwargs):
> kwargs['fields'] = flatten_fieldsets(self.fieldsets)
> return super(DocumentAdmin, self).get_form(request, obj, **kwargs)
>
>  4. Override get_fieldsets(self, request, obj=None) to add a fieldset 
> definition for your keys in the JSON object to the fieldsets object you 
> defined in step 2. Same keys used to define the fields in the form.
>
> And that is about it! The admin page for your model will have a widget for 
> each of your keys in your JSON data. I can't post the code I use, but this 
> outline should give you enough pointers to look in the Django docs and get 
> some examples from Google. 
>
> Good luck!
>
> Mark
>
> On Wed, Jun 27, 2018 at 6:23 AM, prateek gupta  > wrote:
>
>> It has some limit- The configuration object can only be changed, there's 
>> no link for "add" (1)
>>
>> On Wednesday, June 27, 2018 at 6:41:41 PM UTC+5:30, Egor Smolyakov wrote:
>>>
>>> Better way it to use packages like this 
>>> https://github.com/lazybird/django-solo
>>>
>>> On 27 June 2018 at 15:18, prateek gupta  wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am using Django 2.0.6 with Python 3.6 and MySql and created a model 
>>>> which maps the db tables to django.
>>>> In my database, I have a column 'config' of type json.
>>>> This column stores the data in a dictionary format like below- 
>>>> {"user_id": "a...@example.com", "password": "xyz"}
>>>> I need to make it editable via the Django like below screen shot-
>>>>
>>>>
>>>> <https://lh3.googleusercontent.com/-KvJmUsBCPso/WzN-3u5rcyI/MTM/esDa67bBIHEpSnsW9kgYfnQEKrIKHxfuACLcBGAs/s1600/config_cms.JPG>
>>>>
>>>> I need your suggestion - what is the best way to achieve this?
>>>> I found a useful link for this purpose -
>>>> how-to-store-a-dictionary-on-a-django-model 
>>>> <https://stackoverflow.com/questions/402217/how-to-store-a-dictionary-on-a-django-model>
>>>>  but 
>>>> want to take your valuable guidance before proceeding so that I can 
>>>> implement with bes

Django log error email configuration?

2018-06-29 Thread prateek gupta
Hi All,

I am using Django 2.0.6, Python 3.6 and MySql 5.7.

For sending an email to the admin user in case of any error, I did 
following settings in my settings.py file-
DEBUG = False
# email configurations
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL = ""
SERVER_EMAIL = ""
EMAIL_HOST = ""
EMAIL_HOST_USER = ""
EMAIL_HOST_PASSWORD = ""
EMAIL_PORT = ""
DEFAULT_FROM_EMAIL = ""

# send server errors to admin
ADMINS = (('admin', 'ad...@example.com'),)
MANAGERS = ADMINS

# Logging configuration for production
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
%(funcName)s() : %(message)s'
},
'simple': {
'format': '%(asctime)s [%(levelname)s] : %(message)s'
},
},
'handlers': {
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': 'error.log',
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'formatter': 'simple'
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
},
}

This configuration makes error.log file in my code base but I am not seeing 
any logs related to email here.
I have checked and email credentials,host,server etc all are correct.

Please share your suggestion how to make it works!



-- 
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/c3d93b4e-6cf7-40ed-a259-80fa14a5f7c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How can I save uploaded image's url in a column of database?

2018-07-01 Thread prateek gupta
Hi All,

I am using Django2.0.6, Python3.6 and MySql.
I have a table Brand in db which have fields- id, name, description, 
image_url.
>From django admin I am uploading an image to s3 bucket.

For this I have created a class Brand in models.py as below-

class Brand(models.Model):
name = models.CharField(max_length=60)
description = models.TextField(blank=True, null=True)

@property
def logo(self):
return get_logo(self.name, 'brand')

class Meta:
managed = False
db_table = 'brand'

def __str__(self):
return self.name


def get_logo(logo_name, folder):
logo_name_with_ext = '{}{}'.format(logo_name, '.png')
logo_url = '{}/{}'.format(IMAGE_PATH, os.path.join(folder, 
logo_name_with_ext))
return mark_safe(''.format(logo_url))


The image is uploading in S3 successfully.

But I want to save the same uploaded image's url to database also; inside 
'image_url' column of Brand table.
How can I do that? What change should I make here?


-- 
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/62af3866-8ab5-4aac-b10c-645e08742e00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Need your help to fix IntegrityError in my Django code.

2018-07-02 Thread prateek gupta
Hi All,

I have created a simple database admin panel 
(Django2..6+Python3.6+Mysql5.7) where admin can operate create/edit/delete 
operations of database.
I am facing following IntegrityError  error when I try to Merge two 
products and click on Preview from my Django admin panel-
2018-07-02 16:17:56,428 [ERROR] exception.py:118 
handle_uncaught_exception() : Internal Server Error: 
/where2buy/merchantproduct/
Traceback (most recent call last):
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\django\db\backends\utils.py",
 
line 85, in _execute
return self.cursor.execute(sql, params)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\django\db\backends\mysql\base.py",
 
line 71, in execute
return self.cursor.execute(query, args)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\cursors.py",
 
line 250, in execute
self.errorhandler(self, exc, value)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\connections.py",
 
line 50, in defaulterrorhandler
raise errorvalue
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\cursors.py",
 
line 247, in execute
res = self._query(query)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\cursors.py",
 
line 411, in _query
rowcount = self._do_query(q)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\cursors.py",
 
line 374, in _do_query
db.query(q)
  File 
"C:\Users\prateek1.gupta\AppData\Local\Continuum\anaconda3\lib\site-packages\MySQLdb\connections.py",
 
line 277, in query
_mysql.connection.query(self, query)
_mysql_exceptions.IntegrityError: (1451, 'Cannot delete or update a parent 
row: a foreign key constraint fails (`productsearchv2`.`feed`, CONSTRAINT 
`feed_mproduct_id_fk` FOREIGN KEY (`merchant_id`, `merchant_product_id`) 
REFERENCES `merchant_product` (`merchant_id`, `merchant_product_id`) ON 
DELETE NO )')

I think issue is may be wrong relationship settings in my model file but 
couldn't able to find exact issue.
Can anyone please help me to find the issue? My code is as below-

class MerchantProduct(models.Model):
merchant = models.ForeignKey(Merchant, on_delete=models.CASCADE)
product = models.ForeignKey(Product, on_delete=models.SET_NULL, blank=True, 
null=True)
merchant_product_id = models.CharField(max_length=100)
gtin = models.CharField(max_length=15, blank=True, null=True)
merchant_group_id = models.CharField(max_length=100, blank=True, null=True)
name = models.CharField(max_length=300)
description = models.TextField(blank=True, null=True)
image_urls = models.TextField(blank=True, null=True)
image_phashes = models.TextField(blank=True, null=True)
web_url = models.URLField(blank=True, null=True)
brand = models.CharField(max_length=100, blank=True, null=True)
category = models.CharField(max_length=150, blank=True, null=True)
color = models.CharField(max_length=100, blank=True, null=True)
size = models.CharField(max_length=100, blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
unique_together = (('merchant', 'merchant_product_id'),)
managed = False
db_table = 'merchant_product'

def __str__(self):
return self.name

class Product(models.Model):
merchants = models.ManyToManyField(Merchant, through='MerchantProduct')
brand = models.ForeignKey(Brand, related_name='brand', 
on_delete=models.SET_NULL, blank=True, null=True)
category = models.ForeignKey(Category, related_name='category', 
on_delete=models.SET_NULL, blank=True, null=True)
group = models.ForeignKey('self', related_name='ID', 
on_delete=models.SET_NULL, blank=True, null=True)
gtin = models.CharField(max_length=15, blank=True, null=True)
name = models.CharField(max_length=300)
description = models.TextField()
image_urls = models.TextField()
image_phashes = models.CharField(max_length=200, blank=True, null=True)
color = models.CharField(max_length=100, blank=True, null=True)
size = models.CharField(max_length=100, blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
managed = False
db_table = 'product'

def __str__(self):
return self.name


class Merchant(models.Model):
DATA_QUALITY_CHOICES = (
('approx', 'Approximate'),
('exact', 'Exact'),
)
name = models.CharField(unique=True, max_length=45)
display_name = models.CharField(unique=True, max_length=255)
url_name = models.CharField(unique=True, max_length=255)
data_quality = models.CharField(default='approx', max_l

How to see every activity in logs of Django 2.0.6?

2018-07-25 Thread prateek gupta
Hi Experts,

I am facing a strange issue in my Django2.0.6+Mysql application.

In my settings ,py I have set Debug=True, but in logs I am not seeing any 
info/warning/error.

Currently I am merging two products into one to remove duplicate products 
from Django admin panel but when I click on Preview button page is just 
refreshed; no any error in logs.

So I need to investigate the cause but unable to find since not getting any 
logs.

Can anyone please tell me how can enable logs here?

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/58ad3976-6228-4690-8763-740a3e2483cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
PFB my settings-
# Reading data from the environment file
ENV_FILE_PATH = os.path.join(BASE_DIR, 'config.json')
try:
with open(ENV_FILE_PATH) as env_file:
ENV_TOKENS = json.load(env_file)
except IOError:
logger = logging.getLogger(__name__)
logger.warning('Couldn\'t find the env file! You running on '
   'absolute dummy configurations.')
ENV_TOKENS = {}

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True



On Thursday, July 26, 2018 at 4:11:27 PM UTC+5:30, Jason wrote:
>
> sounds like you have a misconfiguration with your logging.  post your 
> LOGGING dict in your settings
>
> On Thursday, July 26, 2018 at 1:20:07 AM UTC-4, prateek gupta wrote:
>>
>> Hi Experts,
>>
>> I am facing a strange issue in my Django2.0.6+Mysql application.
>>
>> In my settings ,py I have set Debug=True, but in logs I am not seeing any 
>> info/warning/error.
>>
>> Currently I am merging two products into one to remove duplicate products 
>> from Django admin panel but when I click on Preview button page is just 
>> refreshed; no any error in logs.
>>
>> So I need to investigate the cause but unable to find since not getting 
>> any logs.
>>
>> Can anyone please tell me how can enable logs here?
>>
>> 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/80a3b816-2539-4f36-ae1e-7789f17ec0d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I forgot to mentions, I am using logger also as below-

# send server errors to admin
ADMINS = (('admin', 'ad...@example.com'),)
MANAGERS = ADMINS

# Logging configuration for production
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
%(funcName)s() : %(message)s'
},
'simple': {
'format': '%(asctime)s [%(levelname)s] : %(message)s'
},
},
'handlers': {
'file': {
'level': 'ERROR',
'class': 'logging.FileHandler',
'filename': 'error.log',
'formatter': 'verbose'
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'formatter': 'simple'
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'ERROR',
'propagate': True,
},
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
},
}




On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
>
> ok, so you don't even have any logging configuration at all, no wonder you 
> don't see anything.
>
> I suggest you look in the docs for this:  
> https://docs.djangoproject.com/en/2.0/topics/logging/
>
> decent example  
> https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7
>
> more reading  https://lincolnloop.com/blog/django-logging-right-way/
>

-- 
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/9f5d530e-4dcc-4082-a8a8-321ff8c03a7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I tried with below one to include warning also but no any warning or error 
in logs-

LOGGING_CONFIG = None

LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 6:06:16 PM UTC+5:30, Jason wrote:
>
> OK, that's helpful.  Your loggers are set to handle error and above, 
> right?  So Django's blocked from doing any logging below that, even with 
> DEBUG = True
>
> On Thursday, July 26, 2018 at 7:46:19 AM UTC-4, prateek gupta wrote:
>>
>> I forgot to mentions, I am using logger also as below-
>>
>> # send server errors to admin
>> ADMINS = (('admin', 'ad...@example.com'),)
>> MANAGERS = ADMINS
>>
>> # Logging configuration for production
>> LOGGING = {
>> 'version': 1,
>> 'disable_existing_loggers': False,
>> 'formatters': {
>> 'verbose': {
>> 'format': '%(asctime)s [%(levelname)s] %(filename)s:%(lineno)s 
>> %(funcName)s() : %(message)s'
>> },
>> 'simple': {
>> 'format': '%(asctime)s [%(levelname)s] : %(message)s'
>> },
>> },
>> 'handlers': {
>> 'file': {
>> 'level': 'ERROR',
>> 'class': 'logging.FileHandler',
>> 'filename': 'error.log',
>> 'formatter': 'verbose'
>> },
>> 'mail_admins': {
>> 'level': 'ERROR',
>> 'class': 'django.utils.log.AdminEmailHandler',
>> 'formatter': 'simple'
>> },
>> },
>> 'loggers': {
>> 'django': {
>> 'handlers': ['file'],
>> 'level': 'ERROR',
>> 'propagate': True,
>> },
>> 'django.request': {
>> 'handlers': ['mail_admins'],
>> 'level': 'ERROR',
>> 'propagate': True,
>> },
>> },
>> }
>>
>>
>>
>>
>> On Thursday, July 26, 2018 at 4:47:18 PM UTC+5:30, Jason wrote:
>>>
>>> ok, so you don't even have any logging configuration at all, no wonder 
>>> you don't see anything.
>>>
>>> I suggest you look in the docs for this:  
>>> https://docs.djangoproject.com/en/2.0/topics/logging/
>>>
>>> decent example  
>>> https://gist.github.com/ipmb/0618f44dc5270f9a2be2826d0d933ed7
>>>
>>> more reading  https://lincolnloop.com/blog/django-logging-right-way/
>>>
>>

-- 
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/ff6f8a29-0bcb-4cbe-a42f-15b6d424d366%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I have changes like below but does not have any affect-

import logging
# Disable Django's logging setup
LOGGING_CONFIG = None

LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 6:22:45 PM UTC+5:30, Jason wrote:
>
> You need to add the logging config to `LOGGING` in the settings for django 
> to pick it up.   logging.config.dictConfig   doesn't do it.
>
>

-- 
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/3eec4623-e36e-4a09-a070-ad93659bf054%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
then it says -
File "", line 219, in _call_with_frames_removed
  File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
TypeError: 'module' object is not callable



On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>
> no, I mean like this:
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'default': {
> # exact format is not important, this is the minimum 
> information
> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
> %(message)s',
> },
> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
> },
> 'handlers': {
> # console logs to stderr
> 'console': {
> 'class': 'logging.StreamHandler',
> 'formatter': 'default',
> },
> # Add Handler for Sentry for `warning` and above
> 'sentry': {
> 'level': 'WARNING',
> 'class': 
> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
> },
> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
> },
> 'loggers': {
> # default for all undefined Python modules
> '': {
> 'level': 'WARNING',
> 'handlers': ['console', 'sentry'],
> },
> # Our application code
> 'app': {
> 'level': LOGLEVEL,
> 'handlers': ['console', 'sentry'],
> # Avoid double logging because of root logger
> 'propagate': False,
> },
> # Prevent noisy modules from logging to Sentry
> 'noisy_module': {
> 'level': 'ERROR',
> 'handlers': ['console'],
> 'propagate': False,
> },
> # Default runserver request logging
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> },
> }
>

-- 
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/8c7a601f-903e-43b9-b69b-207702983fb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
I am using like below-

logging({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'default': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
},
'django.server': DEFAULT_LOGGING['formatters']['django.server'],
},
'handlers': {
# console logs to stderr
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
},
# Add Handler for Sentry for `warning` and above
'sentry': {
'level': 'WARNING',
'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
},
'django.server': DEFAULT_LOGGING['handlers']['django.server'],
},
'loggers': {
# default for all undefined Python modules
'': {
'level': 'WARNING',
'handlers': ['console', 'sentry'],
},
# Our application code
'app': {
'level': LOGLEVEL,
'handlers': ['console', 'sentry'],
# Avoid double logging because of root logger
'propagate': False,
},
# Prevent noisy modules from logging to Sentry
'noisy_module': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
# Default runserver request logging
'django.server': DEFAULT_LOGGING['loggers']['django.server'],
},
})




On Thursday, July 26, 2018 at 7:11:22 PM UTC+5:30, prateek gupta wrote:
>
> then it says -
> File "", line 219, in 
> _call_with_frames_removed
>   File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> TypeError: 'module' object is not callable
>
>
>
> On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>>
>> no, I mean like this:
>>
>> LOGGING = {
>> 'version': 1,
>> 'disable_existing_loggers': False,
>> 'formatters': {
>> 'default': {
>> # exact format is not important, this is the minimum 
>> information
>> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
>> %(message)s',
>> },
>> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
>> },
>> 'handlers': {
>> # console logs to stderr
>> 'console': {
>> 'class': 'logging.StreamHandler',
>> 'formatter': 'default',
>> },
>> # Add Handler for Sentry for `warning` and above
>> 'sentry': {
>> 'level': 'WARNING',
>> 'class': 
>> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
>> },
>> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
>> },
>> 'loggers': {
>> # default for all undefined Python modules
>> '': {
>> 'level': 'WARNING',
>> 'handlers': ['console', 'sentry'],
>> },
>> # Our application code
>> 'app': {
>> 'level': LOGLEVEL,
>> 'handlers': ['console', 'sentry'],
>> # Avoid double logging because of root logger
>> 'propagate': False,
>> },
>> # Prevent noisy modules from logging to Sentry
>> 'noisy_module': {
>> 'level': 'ERROR',
>> 'handlers': ['console'],
>> 'propagate': False,
>> },
>> # Default runserver request logging
>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>> },
>> }
>>
>

-- 
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/132215aa-cd10-471a-914c-4b0d0a4c8670%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to see every activity in logs of Django 2.0.6?

2018-07-26 Thread prateek gupta
If I use as yours then there is no any trace in logs.

On Thursday, July 26, 2018 at 7:12:31 PM UTC+5:30, prateek gupta wrote:
>
> I am using like below-
>
> logging({
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'default': {
> # exact format is not important, this is the minimum information
> 'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
> },
> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
> },
> 'handlers': {
> # console logs to stderr
> 'console': {
> 'class': 'logging.StreamHandler',
> 'formatter': 'default',
> },
> # Add Handler for Sentry for `warning` and above
> 'sentry': {
> 'level': 'WARNING',
> 'class': 
> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
> },
> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
> },
> 'loggers': {
> # default for all undefined Python modules
> '': {
> 'level': 'WARNING',
> 'handlers': ['console', 'sentry'],
> },
> # Our application code
> 'app': {
> 'level': LOGLEVEL,
> 'handlers': ['console', 'sentry'],
> # Avoid double logging because of root logger
> 'propagate': False,
> },
> # Prevent noisy modules from logging to Sentry
> 'noisy_module': {
> 'level': 'ERROR',
> 'handlers': ['console'],
> 'propagate': False,
> },
> # Default runserver request logging
> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
> },
> })
>
>
>
>
> On Thursday, July 26, 2018 at 7:11:22 PM UTC+5:30, prateek gupta wrote:
>>
>> then it says -
>> File "", line 219, in 
>> _call_with_frames_removed
>>   File "E:\cms-app\ps-cms\ps_cms\settings.py", line 256, in 
>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>> TypeError: 'module' object is not callable
>>
>>
>>
>> On Thursday, July 26, 2018 at 7:06:10 PM UTC+5:30, Jason wrote:
>>>
>>> no, I mean like this:
>>>
>>> LOGGING = {
>>> 'version': 1,
>>> 'disable_existing_loggers': False,
>>> 'formatters': {
>>> 'default': {
>>> # exact format is not important, this is the minimum 
>>> information
>>> 'format': '%(asctime)s %(name)-12s %(levelname)-8s 
>>> %(message)s',
>>> },
>>> 'django.server': DEFAULT_LOGGING['formatters']['django.server'],
>>> },
>>> 'handlers': {
>>> # console logs to stderr
>>> 'console': {
>>> 'class': 'logging.StreamHandler',
>>> 'formatter': 'default',
>>> },
>>> # Add Handler for Sentry for `warning` and above
>>> 'sentry': {
>>> 'level': 'WARNING',
>>> 'class': 
>>> 'raven.contrib.django.raven_compat.handlers.SentryHandler',
>>> },
>>> 'django.server': DEFAULT_LOGGING['handlers']['django.server'],
>>> },
>>> 'loggers': {
>>> # default for all undefined Python modules
>>> '': {
>>> 'level': 'WARNING',
>>> 'handlers': ['console', 'sentry'],
>>> },
>>> # Our application code
>>> 'app': {
>>> 'level': LOGLEVEL,
>>> 'handlers': ['console', 'sentry'],
>>> # Avoid double logging because of root logger
>>> 'propagate': False,
>>> },
>>> # Prevent noisy modules from logging to Sentry
>>> 'noisy_module': {
>>> 'level': 'ERROR',
>>> 'handlers': ['console'],
>>> 'propagate': False,
>>> },
>>> # Default runserver request logging
>>> 'django.server': DEFAULT_LOGGING['loggers']['django.server'],
>>> },
>>> }
>>>
>>

-- 
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/014e5f82-87cd-4c85-9e21-1248ed83ce28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
Hi All,

I am using Django 2.0.6, Python 3.6. For connecting with Mysql 5.7 I am 
using mysqlclient 1.3.12.
Using above environment I have created an admin panel for CRUD operations.
When I select a tabel for viewing it's content following error shows-

django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server 
during query')

The above error comes only for one table, rest all are working fine.

I tried to set the max_allowed_packet=67108864 in mysql configuration file 
and in settings.py I have set the CONN_MAX_AGE=6000 but it is not working.

Have anyone faced the same issue?
Let me know if anyone knows how to solve this.

Thanks,
Prateek

-- 
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/26050b0b-164e-41d1-bd25-7a5d5c29f003%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
Thanks Jason!
I have restarted teh server and updated the mysqlclient to 1.3.13 and the 
issue got resolved now.

On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>
> also, you might want to update your mysqlclient package.  1.3.12 was 
> released over a year ago, and 1.3.13 was pushed out late June of this year.
>

-- 
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/b8f0cc45-418d-4b55-aeed-92f2b114c80d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to fix (2027, 'Malformed packet') exception?

2018-11-14 Thread prateek gupta
Hi All,

I am facing a strange issue in my pre-prod server (in dev and uat it's 
working fine).
Whenever I login in django admin and click on any table, it shows me 
following error- (2027, 'Malformed packet')

[image: db_error.JPG]

Is there any db setting I am missing here or its is related to server 
settings?
Has anyone faced this issue?

Thanks,
Prateek

-- 
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/7fade990-6b6f-4691-a9c5-dd63c6cdaebb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-14 Thread prateek gupta
It is strange again, now I am getting the same error.
Till morning it was working fine but now it is again showing same error.

On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>
> also, you might want to update your mysqlclient package.  1.3.12 was 
> released over a year ago, and 1.3.13 was pushed out late June of this year.
>

-- 
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/9bd1c72a-7c97-49b5-8a37-646e49dbc785%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to solve django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')?

2018-11-15 Thread prateek gupta
Hi,

My all db have 20 gb of size.

On Thursday, November 15, 2018 at 12:27:27 PM UTC+5:30, Krishnasagar 
Subhedarpage wrote:
>
> Hi Prateek,
>
> Did you check disk info of server instance? What's disk consumption?
>
> Regards, 
> Krishnasagar Subhedarpage
>
>
>
>
> On Thu, 15 Nov 2018 at 12:09, prateek gupta  > wrote:
>
>> It is strange again, now I am getting the same error.
>> Till morning it was working fine but now it is again showing same error.
>>
>> On Wednesday, November 14, 2018 at 7:07:46 PM UTC+5:30, Jason wrote:
>>>
>>> also, you might want to update your mysqlclient package.  1.3.12 was 
>>> released over a year ago, and 1.3.13 was pushed out late June of this year.
>>>
>> -- 
>> 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/9bd1c72a-7c97-49b5-8a37-646e49dbc785%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/9bd1c72a-7c97-49b5-8a37-646e49dbc785%40googlegroups.com?utm_medium=email&utm_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+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/cf5bdd99-6e58-430f-85bd-6df249378f2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to fix (2027, 'Malformed packet') exception?

2018-11-15 Thread prateek gupta
I am using mysqlclient 1.3.12.

On Thu 15 Nov, 2018, 6:20 PM Jason  its an issue with your mysql connection lib.  which one are you using?
>
> On Thursday, November 15, 2018 at 1:02:20 AM UTC-5, prateek gupta wrote:
>>
>> Hi All,
>>
>> I am facing a strange issue in my pre-prod server (in dev and uat it's
>> working fine).
>> Whenever I login in django admin and click on any table, it shows me
>> following error- (2027, 'Malformed packet')
>>
>> [image: db_error.JPG]
>>
>> Is there any db setting I am missing here or its is related to server
>> settings?
>> Has anyone faced this issue?
>>
>> Thanks,
>> Prateek
>>
> --
> 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/IDzHy2KEMg0/unsubscribe.
> To unsubscribe from this group and all its topics, 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/f810fe7a-7c66-4c70-98bd-372f712b387c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f810fe7a-7c66-4c70-98bd-372f712b387c%40googlegroups.com?utm_medium=email&utm_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+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/CAF44VH7SRr3zCwLuDUk%2B7HWFsHtUV2iSuFv-xjjTPL9c9-wpxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Hi All,

I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.

In this panel I have a field 'PIN' described in models.py like below-
class MerchantStores(models.Model):
store_id = models.AutoField(primary_key=True)
pin = models.CharField(unique=True, max_length=45, blank=True, 
null=True)

Currently admin has to fill manually this Pin.

Now, I have to change this PIN text box to a button and on click of this 
button a post request will be sent to an api.
This button will be enabled once admin will edit the form (since Pin 
generation required store id and a store id will be generated only after 
first creating a new store)

The end point of this api will contain the store_id at the end and will 
have some required input parameters like api id etc.

Since this api itself saves the new Pin in database , so I don't need to 
save this field myself. I just need to show a button and on click this 
button make a call to api.

So for this requirement I am going to use Django Rest Framework but before 
that I need your suggestion to implement it with a better way.
Please suggest me how can I make a button field instead of text,then  how 
can I append the store_id to the end point and post my request to the api 
successfully?

Thanks,
Prateek Gupta

-- 
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/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Thanks @Yavin for your suggestion.
I thought I will have to use Django Rest Framework for this functionality, 
never thought that from front end I can do that :)

On Tuesday, November 20, 2018 at 5:17:35 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Hi Prateek,
>
> I think your best option is using javascript on the front end - leveraging 
> an ajax post call.
>
> On Tue, 20 Nov 2018 at 13:24, prateek gupta  > wrote:
>
>> Hi All,
>>
>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>
>> In this panel I have a field 'PIN' described in models.py like below-
>> class MerchantStores(models.Model):
>> store_id = models.AutoField(primary_key=True)
>> pin = models.CharField(unique=True, max_length=45, blank=True, 
>> null=True)
>>
>> Currently admin has to fill manually this Pin.
>>
>> Now, I have to change this PIN text box to a button and on click of this 
>> button a post request will be sent to an api.
>> This button will be enabled once admin will edit the form (since Pin 
>> generation required store id and a store id will be generated only after 
>> first creating a new store)
>>
>> The end point of this api will contain the store_id at the end and will 
>> have some required input parameters like api id etc.
>>
>> Since this api itself saves the new Pin in database , so I don't need to 
>> save this field myself. I just need to show a button and on click this 
>> button make a call to api.
>>
>> So for this requirement I am going to use Django Rest Framework but 
>> before that I need your suggestion to implement it with a better way.
>> Please suggest me how can I make a button field instead of text,then  how 
>> can I append the store_id to the end point and post my request to the api 
>> successfully?
>>
>> Thanks,
>> Prateek Gupta
>>
>> -- 
>> 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/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com?utm_medium=email&utm_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+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/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Hi @MTS S BOUR,
I am not using forms.pr currently. These forms fields are from models.py 
only.
That's I w had not thought about html form.

On Tuesday, November 20, 2018 at 5:18:54 PM UTC+5:30, MTS BOUR wrote:
>
> I didn't really understand what you mean, why not use method Post in a 
> boutton in an Html form ?
>
> Le mar. 20 nov. 2018 à 12:24, prateek gupta  > a écrit :
>
>> Hi All,
>>
>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>
>> In this panel I have a field 'PIN' described in models.py like below-
>> class MerchantStores(models.Model):
>> store_id = models.AutoField(primary_key=True)
>> pin = models.CharField(unique=True, max_length=45, blank=True, 
>> null=True)
>>
>> Currently admin has to fill manually this Pin.
>>
>> Now, I have to change this PIN text box to a button and on click of this 
>> button a post request will be sent to an api.
>> This button will be enabled once admin will edit the form (since Pin 
>> generation required store id and a store id will be generated only after 
>> first creating a new store)
>>
>> The end point of this api will contain the store_id at the end and will 
>> have some required input parameters like api id etc.
>>
>> Since this api itself saves the new Pin in database , so I don't need to 
>> save this field myself. I just need to show a button and on click this 
>> button make a call to api.
>>
>> So for this requirement I am going to use Django Rest Framework but 
>> before that I need your suggestion to implement it with a better way.
>> Please suggest me how can I make a button field instead of text,then  how 
>> can I append the store_id to the end point and post my request to the api 
>> successfully?
>>
>> Thanks,
>> Prateek Gupta
>>
>> -- 
>> 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/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com?utm_medium=email&utm_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+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/a3af9b7a-a127-4821-ac97-4f057251505b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Approach to implement a Rest call functionality

2018-11-20 Thread prateek gupta
Got it, I will try to do the same.

On Tuesday, November 20, 2018 at 6:12:20 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Not sure if we're a bit confused on the use case here. REST framework is a 
> server side platform which can help you implement apis fast, it's a good 
> idea to use if you don't have an endpoint and want fast CRUD 
> implementation. As for having a button on the client side - you can use 
> HTML forms or ajax etc. I think JS\Ajax is the way to go since you can 
> extract stuff from the document with greater ease and send it away to an 
> endpoint. 
>
> On Tue, 20 Nov 2018 at 14:09, prateek gupta  > wrote:
>
>> Thanks @Yavin for your suggestion.
>> I thought I will have to use Django Rest Framework for this 
>> functionality, never thought that from front end I can do that :)
>>
>> On Tuesday, November 20, 2018 at 5:17:35 PM UTC+5:30, Yavin Aalto Arba 
>> wrote:
>>>
>>> Hi Prateek,
>>>
>>> I think your best option is using javascript on the front end - 
>>> leveraging an ajax post call.
>>>
>>> On Tue, 20 Nov 2018 at 13:24, prateek gupta  wrote:
>>>
>>>> Hi All,
>>>>
>>>> I have an admin panel built on Django 2.0.6, MySql 5.7 and Python 3.6.
>>>>
>>>> In this panel I have a field 'PIN' described in models.py like below-
>>>> class MerchantStores(models.Model):
>>>> store_id = models.AutoField(primary_key=True)
>>>> pin = models.CharField(unique=True, max_length=45, blank=True, 
>>>> null=True)
>>>>
>>>> Currently admin has to fill manually this Pin.
>>>>
>>>> Now, I have to change this PIN text box to a button and on click of 
>>>> this button a post request will be sent to an api.
>>>> This button will be enabled once admin will edit the form (since Pin 
>>>> generation required store id and a store id will be generated only after 
>>>> first creating a new store)
>>>>
>>>> The end point of this api will contain the store_id at the end and will 
>>>> have some required input parameters like api id etc.
>>>>
>>>> Since this api itself saves the new Pin in database , so I don't need 
>>>> to save this field myself. I just need to show a button and on click this 
>>>> button make a call to api.
>>>>
>>>> So for this requirement I am going to use Django Rest Framework but 
>>>> before that I need your suggestion to implement it with a better way.
>>>> Please suggest me how can I make a button field instead of text,then  
>>>> how can I append the store_id to the end point and post my request to the 
>>>> api successfully?
>>>>
>>>> Thanks,
>>>> Prateek Gupta
>>>>
>>>> -- 
>>>> 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/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/16480a91-3284-44e7-8e6f-7492b4fb8c73%40googlegroups.com?utm_medium=email&utm_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/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e9b96409-90c8-41e6-9da1-d3645e92a9ad%40googlegroups.com?utm_medium=email&utm_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+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/5b0d4f79-35b0-42c1-aa32-ec5b4d19f2b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to correct my signals call?

2018-11-21 Thread prateek gupta
Hi All,

I have an admin panel built on Django 2.0.6, Mysql 5.7 and Python 3.6.

Now I have written following signal code in signals.py-
from .models import MerchantStores
from django.db.models.signals import post_save
from django.dispatch import receiver

@receiver(post_save, sender = MerchantStores, weak=False)
def ensure_store_id_exists(sender, **kwargs):
   print ("check fucntion")
   ex = kwargs.get("instance").store_id
   print ("store id:",ex)
   import requests
   URL = "http://example.cloud/rmsservice/resetPin?storeId="+str(ex)
   print("url:",URL)
   data = {'Content-Type': 'application/json',
   'app-id': 'APP_ID',
   'secret-key': 'SECRET_KEY',
   'aid': 'PG'}

   r = requests.post(url=URL, headers=data)
   response_text = r.text
   print(response_text)

And in apps.py I have done following settings-

from django.apps import AppConfig

class AdminappConfig(AppConfig):
name = 'adminapp'

def ready(self):
import adminapp.signals


In above signals I am sending a post request to resetPin api.
I need to send the request once form is saved but my signal is posting 
request before the save method.
I confirmed the above from server logs. Following is the logs I am getting-
[21/Nov/2018 14:18:03] "GET /jsi18n/ HTTP/1.1" 200 3185
check fucntion
store id: 1533
url: http://example/rmsservice/resetPin?storeId=1533
{"success":false,"code":"8050","message":"Merchant not 
active","response":null}
[21/Nov/2018 14:18:29] "POST /adminapp/merchantstores/add/ HTTP/1.1" 302 0
[21/Nov/2018 14:18:32] "GET /adminapp/merchantstores/ HTTP/1.1" 200 12659
[21/Nov/2018 14:18:34] "GET /jsi18n/ HTTP/1.1" 200 3185

As per above log, my signal is invoked before teh save() method but it 
should be after the save() method.
Can anyone please help my to find out what I am doing wrong here?

Thanks,
Prateek

-- 
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/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to correct my signals call?

2018-11-21 Thread prateek gupta
@Yavin Aalto Arba

I am using models.py, admin.py for my view, no any customized forms or view.

[image: screen_3.JPG]

[image: screen_2.JPG]

[image: screen_1.JPG]
PFA screen shot for the same.

On Wednesday, November 21, 2018 at 2:46:41 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Can you show us the view where the save() is invoked?
>
> On Wed, 21 Nov 2018 at 10:57, prateek gupta  > wrote:
>
>> Hi All,
>>
>> I have an admin panel built on Django 2.0.6, Mysql 5.7 and Python 3.6.
>>
>> Now I have written following signal code in signals.py-
>> from .models import MerchantStores
>> from django.db.models.signals import post_save
>> from django.dispatch import receiver
>>
>> @receiver(post_save, sender = MerchantStores, weak=False)
>> def ensure_store_id_exists(sender, **kwargs):
>>print ("check fucntion")
>>ex = kwargs.get("instance").store_id
>>print ("store id:",ex)
>>import requests
>>URL = "http://example.cloud/rmsservice/resetPin?storeId="+str(ex)
>>print("url:",URL)
>>data = {'Content-Type': 'application/json',
>>'app-id': 'APP_ID',
>>'secret-key': 'SECRET_KEY',
>>'aid': 'PG'}
>>
>>r = requests.post(url=URL, headers=data)
>>response_text = r.text
>>print(response_text)
>>
>> And in apps.py I have done following settings-
>>
>> from django.apps import AppConfig
>>
>> class AdminappConfig(AppConfig):
>> name = 'adminapp'
>>
>> def ready(self):
>> import adminapp.signals
>>
>>
>> In above signals I am sending a post request to resetPin api.
>> I need to send the request once form is saved but my signal is posting 
>> request before the save method.
>> I confirmed the above from server logs. Following is the logs I am 
>> getting-
>> [21/Nov/2018 14:18:03] "GET /jsi18n/ HTTP/1.1" 200 3185
>> check fucntion
>> store id: 1533
>> url: http://example/rmsservice/resetPin?storeId=1533
>> {"success":false,"code":"8050","message":"Merchant not 
>> active","response":null}
>> [21/Nov/2018 14:18:29] "POST /adminapp/merchantstores/add/ HTTP/1.1" 302 0
>> [21/Nov/2018 14:18:32] "GET /adminapp/merchantstores/ HTTP/1.1" 200 12659
>> [21/Nov/2018 14:18:34] "GET /jsi18n/ HTTP/1.1" 200 3185
>>
>> As per above log, my signal is invoked before teh save() method but it 
>> should be after the save() method.
>> Can anyone please help my to find out what I am doing wrong here?
>>
>> Thanks,
>> Prateek
>>
>> -- 
>> 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/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com?utm_medium=email&utm_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+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/92aa3ade-9525-4f99-a85f-aef4c57172ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to correct my signals call?

2018-11-21 Thread prateek gupta
Can you please clear where you saw ["created"] keyword?

On Wednesday, November 21, 2018 at 3:19:56 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Something doesn't add up. Can you check the ["created"] keyword? What does 
> it say?
>
> On Wed, 21 Nov 2018 at 11:26, prateek gupta  > wrote:
>
>> @Yavin Aalto Arba
>>
>> I am using models.py, admin.py for my view, no any customized forms or 
>> view.
>>
>> [image: screen_3.JPG]
>>
>> [image: screen_2.JPG]
>>
>> [image: screen_1.JPG]
>> PFA screen shot for the same.
>>
>> On Wednesday, November 21, 2018 at 2:46:41 PM UTC+5:30, Yavin Aalto Arba 
>> wrote:
>>>
>>> Can you show us the view where the save() is invoked?
>>>
>>> On Wed, 21 Nov 2018 at 10:57, prateek gupta  wrote:
>>>
>>>> Hi All,
>>>>
>>>> I have an admin panel built on Django 2.0.6, Mysql 5.7 and Python 3.6.
>>>>
>>>> Now I have written following signal code in signals.py-
>>>> from .models import MerchantStores
>>>> from django.db.models.signals import post_save
>>>> from django.dispatch import receiver
>>>>
>>>> @receiver(post_save, sender = MerchantStores, weak=False)
>>>> def ensure_store_id_exists(sender, **kwargs):
>>>>print ("check fucntion")
>>>>ex = kwargs.get("instance").store_id
>>>>print ("store id:",ex)
>>>>import requests
>>>>URL = "http://example.cloud/rmsservice/resetPin?storeId="+str(ex)
>>>>print("url:",URL)
>>>>data = {'Content-Type': 'application/json',
>>>>'app-id': 'APP_ID',
>>>>'secret-key': 'SECRET_KEY',
>>>>'aid': 'PG'}
>>>>
>>>>r = requests.post(url=URL, headers=data)
>>>>response_text = r.text
>>>>print(response_text)
>>>>
>>>> And in apps.py I have done following settings-
>>>>
>>>> from django.apps import AppConfig
>>>>
>>>> class AdminappConfig(AppConfig):
>>>> name = 'adminapp'
>>>>
>>>> def ready(self):
>>>> import adminapp.signals
>>>>
>>>>
>>>> In above signals I am sending a post request to resetPin api.
>>>> I need to send the request once form is saved but my signal is posting 
>>>> request before the save method.
>>>> I confirmed the above from server logs. Following is the logs I am 
>>>> getting-
>>>> [21/Nov/2018 14:18:03] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>> check fucntion
>>>> store id: 1533
>>>> url: http://example/rmsservice/resetPin?storeId=1533
>>>> {"success":false,"code":"8050","message":"Merchant not 
>>>> active","response":null}
>>>> [21/Nov/2018 14:18:29] "POST /adminapp/merchantstores/add/ HTTP/1.1" 
>>>> 302 0
>>>> [21/Nov/2018 14:18:32] "GET /adminapp/merchantstores/ HTTP/1.1" 200 
>>>> 12659
>>>> [21/Nov/2018 14:18:34] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>>
>>>> As per above log, my signal is invoked before teh save() method but it 
>>>> should be after the save() method.
>>>> Can anyone please help my to find out what I am doing wrong here?
>>>>
>>>> Thanks,
>>>> Prateek
>>>>
>>>> -- 
>>>> 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/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com?utm_medium=email&utm_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/92aa3ade-9525-4f99-a85f-aef4c57172ba%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/92aa3ade-9525-4f99-a85f-aef4c57172ba%40googlegroups.com?utm_medium=email&utm_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+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/9c3f051a-d5a8-4488-a53c-d4372a057b73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to correct my signals call?

2018-11-21 Thread prateek gupta
I just printed the value of created as 

kwargs.get("created")


And it''s vaulue is True.

On Wednesday, November 21, 2018 at 3:19:56 PM UTC+5:30, Yavin Aalto Arba 
wrote:
>
> Something doesn't add up. Can you check the ["created"] keyword? What does 
> it say?
>
> On Wed, 21 Nov 2018 at 11:26, prateek gupta  > wrote:
>
>> @Yavin Aalto Arba
>>
>> I am using models.py, admin.py for my view, no any customized forms or 
>> view.
>>
>> [image: screen_3.JPG]
>>
>> [image: screen_2.JPG]
>>
>> [image: screen_1.JPG]
>> PFA screen shot for the same.
>>
>> On Wednesday, November 21, 2018 at 2:46:41 PM UTC+5:30, Yavin Aalto Arba 
>> wrote:
>>>
>>> Can you show us the view where the save() is invoked?
>>>
>>> On Wed, 21 Nov 2018 at 10:57, prateek gupta  wrote:
>>>
>>>> Hi All,
>>>>
>>>> I have an admin panel built on Django 2.0.6, Mysql 5.7 and Python 3.6.
>>>>
>>>> Now I have written following signal code in signals.py-
>>>> from .models import MerchantStores
>>>> from django.db.models.signals import post_save
>>>> from django.dispatch import receiver
>>>>
>>>> @receiver(post_save, sender = MerchantStores, weak=False)
>>>> def ensure_store_id_exists(sender, **kwargs):
>>>>print ("check fucntion")
>>>>ex = kwargs.get("instance").store_id
>>>>print ("store id:",ex)
>>>>import requests
>>>>URL = "http://example.cloud/rmsservice/resetPin?storeId="+str(ex)
>>>>print("url:",URL)
>>>>data = {'Content-Type': 'application/json',
>>>>'app-id': 'APP_ID',
>>>>'secret-key': 'SECRET_KEY',
>>>>'aid': 'PG'}
>>>>
>>>>r = requests.post(url=URL, headers=data)
>>>>response_text = r.text
>>>>print(response_text)
>>>>
>>>> And in apps.py I have done following settings-
>>>>
>>>> from django.apps import AppConfig
>>>>
>>>> class AdminappConfig(AppConfig):
>>>> name = 'adminapp'
>>>>
>>>> def ready(self):
>>>> import adminapp.signals
>>>>
>>>>
>>>> In above signals I am sending a post request to resetPin api.
>>>> I need to send the request once form is saved but my signal is posting 
>>>> request before the save method.
>>>> I confirmed the above from server logs. Following is the logs I am 
>>>> getting-
>>>> [21/Nov/2018 14:18:03] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>> check fucntion
>>>> store id: 1533
>>>> url: http://example/rmsservice/resetPin?storeId=1533
>>>> {"success":false,"code":"8050","message":"Merchant not 
>>>> active","response":null}
>>>> [21/Nov/2018 14:18:29] "POST /adminapp/merchantstores/add/ HTTP/1.1" 
>>>> 302 0
>>>> [21/Nov/2018 14:18:32] "GET /adminapp/merchantstores/ HTTP/1.1" 200 
>>>> 12659
>>>> [21/Nov/2018 14:18:34] "GET /jsi18n/ HTTP/1.1" 200 3185
>>>>
>>>> As per above log, my signal is invoked before teh save() method but it 
>>>> should be after the save() method.
>>>> Can anyone please help my to find out what I am doing wrong here?
>>>>
>>>> Thanks,
>>>> Prateek
>>>>
>>>> -- 
>>>> 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/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/django-users/9edd586b-604b-4734-ab1d-28f7fda9d527%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.goo