IPN Notifications from PayPal

2018-03-09 Thread anas . devriani
i use ngrock to host my website , and when i did a payment using my paypal 
acount i didn't received any IPN notifications  to my admin dashboard my 
django version is : 1.10 this is my payment signals code 
https://pastebin.com/ng7GqHiv 

 , 
and this is my payment process view https://pastebin.com/GLErSzR2 

 please 
help .

-- 
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/f1a42e1b-af34-4f8e-a53e-0dcb37f06589%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


GROUP BY behavior change in Django 2.0 with annotate/extra

2018-03-09 Thread Michael Soderstrom
In a 1.11 branch I had a complex raw sql snippet added to a query set via 
annotate.  

When I updated Django to 2.0, the query set behavior changed to include the 
raw sql in the GROUP BY which destroyed the performance.

The same behavior occurred using annotate and extra.

I was able to hack around it by overwriting the get_group_by_cols on my 
RawSQL instance to return an empty list, but that seems wrong.

Is the new behavior a bug or a feature and is there a less hacky way of 
handling 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/61299273-2bc4-41f1-8338-fd7aefb2d765%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels: channel_layer appears to time out

2018-03-09 Thread toby @ tobyz
Update: there was an issue, and running the stock Ubuntu 16.04 Python was the 
cause; 3.5.2. 

I’ve provisioned 3.6.4, and channels is doing exactly what I ask of it.

> On 2 Mar 2018, at 12:13, opera...@tobyz.net wrote:
> 
> Andrew,
> 
> Thanks for taking the time to reply. 
> 
> In classic fashion, the issue has gone away and I'm not entirely sure why. I 
> suspect there might have been a page with older code buried somewhere, trying 
> to do websocket things wrongly, and that was throwing things off. I'm sure it 
> will rear it's head again, and if it does I will try and get a reproducible 
> test case.
> 
> Toby
> 
> On Thursday, March 1, 2018 at 9:48:59 PM UTC, Andrew Godwin wrote:
> Hi Toby,
> 
> Do you have the latest versions of daphne, channels, asgiref and 
> channels_redis? This sounds supiciously like a bug I fixed a couple weeks ago.
> 
> Andrew
> 
> On Thu, Mar 1, 2018 at 5:45 AM,  wrote:
> Hello,
> 
> I have a project that uses Channels as a worker queue, with a SyncConsumer 
> that runs a heavy computation task. This works great.
> 
> I transitioned the project to have a 'task in process' page that opens a 
> websocket and through the magic of channel's groups it gets pushed the 
> computation updates as they happen. This works great.
> 
> I'm now transitioning the project to be a single-page-app that communicates 
> via a websocket. Using `runserver`, this works great, the websocket stays 
> open. However, the messages from the SyncConsumer stop after a few seconds. 
> I've established that time is whatever the value of 
> `websocket_handshake_timeout` is, but this doesn't make sense to me AFAIK as 
> the channel_layer is independent from the JsonWebsocketConsumer instance, and 
> the websocket is happily connected and still passing messages.
> 
> Any ideas? Is this a bug or am I doing something wrong? 
> 
> Thanks,
> 
> Toby
> 
> -- 
> 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/a329b26e-89f5-42d1-86b2-28ad1c85bb90%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "Django users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/django-users/TBWZGjwOVPA/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/64436f7a-18d7-452b-a9cf-3580d7636b73%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/C644F7A8-D94C-4CD3-9E5D-14D1D11F663C%40tobyz.net.
For more options, visit https://groups.google.com/d/optout.


When to create a new app

2018-03-09 Thread Cictani
Hello,

I have problem to figure out when I should create a new app in my Django 
project. Can you give me some Tipps?

Best regards

Andreas

-- 
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/be81b68a-8a0a-436a-8115-c97166348e9b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Create table rows by an entered number

2018-03-09 Thread Jani Tiainen
Hi.

Surely you can. Django template language has everything you need to create
tables by arbitrary rows and columns.


9.3.2018 17.23 "Ondra Baumrt"  kirjoitti:

> Hi,
> is there any possibility how to create a table with as many rows as is an
> entered number. In example: I have in DB an integer number 5 which means
> that I want to create table with 5 rows. Can I create table for any entered
> number using for-cycle or otherwise?
> Thanks for your help
>
> --
> 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/93e5c2a3-b53c-47ba-b260-455d4f4dfd44%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/CAHn91oeeZ1QbZFQriFRASrhxeUvfDf4j1xwimAy3R7eLNEj9Jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Create table rows by an entered number

2018-03-09 Thread Ondra Baumrt
Hi, 
is there any possibility how to create a table with as many rows as is an 
entered number. In example: I have in DB an integer number 5 which means 
that I want to create table with 5 rows. Can I create table for any entered 
number using for-cycle or otherwise? 
Thanks for your help

-- 
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/93e5c2a3-b53c-47ba-b260-455d4f4dfd44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to populate DB from PDF extracted data

2018-03-09 Thread Jaap van Wingerde
Use 'pdftohtml - xml' to convert the pdf in an xml-file and use per
line in de xml-file regulair expressions to extract the data.

[pdftohtml]
https://www.sourceforge.net/projects/pdftohtml/

Op Fri, 9 Mar 2018 00:00:39 -0800
Shazia Nusrat  schreef:

> Hi,
> 
> I am trying to work around with PDF's where user uploads PDF in image
> or filefield and then way to extract it for Django and finally update
> DB table based on it. Following are the models:
> 
> class StudentFee(models.Model):
>class_name = models.CharField(choices=CLASSES, max_lenght=200)
>fee_deposit_slip = models.ImageField(upload_to="students/")
> 
>def __unicode__(self):
>  return unicode(self.class_name)
> 
> All I need is to design a view where I can extract data from the PDF
> uploaded in the model below:
> 
> class StudentInfo(models.Model):
> first_name = models.CharField(max_length=200)
> last_name = models.CharField(max_length=200)
> email=models.EmailField()
> phone = PhoneField() #using phoneField custom field
> def __unicode__(self):
>return unicode(self.first_name)
> 
> All the fields in second model does exist in the PDF. In my Views.py
> 
> class StudentPDFReader(FormView):
>   template_name = 'pdfdata.html'
>   form_class = PDFForm
>   success_url = '/success/'
> 
>   def form_valid(self, form):
># here I need to extract and add entries to modelform
>   return super(StudentPDFReader, self).form_valid(form)
> 
> Looking for kind help.
> 
> Regards,
> Shazia
> 


-- 
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/20180309151249.0ebddf92%40jaap.custard.shrl.nl.
For more options, visit https://groups.google.com/d/optout.


Re: Printing to console from async method inside django channels

2018-03-09 Thread Chris Barry
Thanks very much, double posting the solution here just in case it helps 
anyone else:


Ah, that didn't do it, so I did a full upgrade of channels, something in 
this set of upgrades sorted it.

pip install channels -U


Installing collected packages: asgiref, autobahn, daphne, Django, setuptools
Found existing installation: asgiref 2.1.6
Uninstalling asgiref-2.1.6:
Successfully uninstalled asgiref-2.1.6
Found existing installation: autobahn 17.10.1
Uninstalling autobahn-17.10.1:
Successfully uninstalled autobahn-17.10.1
Found existing installation: daphne 2.0.4
Uninstalling daphne-2.0.4:
Successfully uninstalled daphne-2.0.4
Found existing installation: Django 2.0.2
Uninstalling Django-2.0.2:
Successfully uninstalled Django-2.0.2
Found existing installation: setuptools 38.5.1
Uninstalling setuptools-38.5.1:
Successfully uninstalled setuptools-38.5.1
Successfully installed Django-2.0.3 asgiref-2.2.0 autobahn-18.3.1 
daphne-2.1.0 setuptools-38.5.2


On Friday, 9 March 2018 12:31:32 UTC, Andrew Godwin wrote:
>
> Hi Chris,
>
> Since you also posted this to GitHub (
> https://github.com/django/channels/issues/967), I will answer there.
>
> Andrew
>
> On Thu, Mar 8, 2018 at 8:17 PM, Chris Barry  > wrote:
>
>> I'm trying to print inside these methods in from this example in django 
>> channels:
>>
>>
>> https://github.com/andrewgodwin/channels-examples/blob/master/multichat/chat/consumers.py
>>
>> But nothing is coming through to the console.
>>
>> I haven't worked with python Async before, so I'm not sure if I'm doing 
>> something really stupid? The examples in the python docs seem to show 
>> prints working no problem
>>
>> -- 
>> 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/abc849e2-11fe-49ca-a936-7dfaf5b811b6%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/7ac42fd6-8d24-45be-aa32-1012cde8c1a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Printing to console from async method inside django channels

2018-03-09 Thread Andrew Godwin
Hi Chris,

Since you also posted this to GitHub (
https://github.com/django/channels/issues/967), I will answer there.

Andrew

On Thu, Mar 8, 2018 at 8:17 PM, Chris Barry  wrote:

> I'm trying to print inside these methods in from this example in django
> channels:
>
> https://github.com/andrewgodwin/channels-examples/blob/master/
> multichat/chat/consumers.py
>
> But nothing is coming through to the console.
>
> I haven't worked with python Async before, so I'm not sure if I'm doing
> something really stupid? The examples in the python docs seem to show
> prints working no problem
>
> --
> 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/abc849e2-11fe-49ca-a936-7dfaf5b811b6%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/CAFwN1uqNjFOcPwO4F%3D8PodCiVd6ApQVxbtDbFyW%2BWqfR7AGw1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Customizing mode loading ...

2018-03-09 Thread Bernd Wechner
Well, not a single reply. So I'll reply with confirmation that the strategy 
below seems to work just fine! Have implemented what I need using that. 
Three distinct methods through which django loads a model instance (object) 
from database and overriding these provides a hook into making an object 
modification on load. Combined with the very awesome django-cuser which 
makes request.use available to these methods you can make mods tot he 
object based on the logged in user, at load time, so before it reaches any 
view. Important if you want one change to apply to a multitude of views. I 
use this to enforce privacy on certain fields, marke them appropriately and 
overrride save() to similarly not save private fields. And it all works 
like a charm!

On Monday, 5 March 2018 14:53:15 UTC+11, Bernd Wechner wrote:
>
> Found this lovely doc:
>
>
> https://docs.djangoproject.com/en/2.0/ref/models/instances/#customizing-model-loading
>
> But it leaves me with a thirst for more knowledge. My conclusion form 
> reading it is, that if I wanted to put a hook into some custom code that 
> always ran after data was loaded from the database, and after the model 
> instance is created (populated with data) I would need to dos something 
> like:
>
> class Book(models.Model):
> title = models.CharField(max_length=100)
>
> @classmethod
> def create(cls, title):
> book = super().create(cls, title)
> # hook to custom code here
> return book
>
> @classmethod
> def from_db(cls, db, field_names, values):
> book = super().from_db(cls, db, field_names, values)
> # hook to custom code here
> return book
>
> def refresh_from_db(self, using=None, fields=None, **kwargs):
> super().refresh_from_db(using, fields, **kwargs)
> # hook to custom code here
>
> Taking note that the last of these is an instance method and the first two 
> are class methods and returns nothing.
>
> The documentation is not very clear in this space.
>
> If that hook took the simple form of:
>
> if hasattr(book_or_self, "_post_load") and callable(book_or_self._post_load):
>  book_or_self._post_load(book_or_self)
>
> Then defining a model method _post_load(self) would provide a place to put 
> code that ran reliably before any other code could inspect the instance?
>
> It seems a little clunky almost as if it would be neater if there were a 
> signal issued at that point in time by django base, but could be tidied up by 
> writing 
> a new model class that derives from models.Model, like ModelWithPostLoadHooks 
> and deriving a model from that if it wanted to have such hooks.
>
> Musing here, and wondering if I have it right. 
>
> Bernd.
>
>

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


Re: How to populate DB from PDF extracted data

2018-03-09 Thread Jason
PDF processing is very difficult, because the entire standard is a dumpster 
fire.  For example, it has no concept of structure like headings, 
paragraphs or sentences because each and every character is just a 
character, location coordinate, font size and font type.

In order to process the document and try to extract some of the structure 
out, its required to use heuristics.  Check out 
https://github.com/pdfminer/pdfminer.six and as Mike said above, good 
luck.  It is not a simple task.

-- 
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/01e467e3-c34a-4054-a88d-d3fa22e20881%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to populate DB from PDF extracted data

2018-03-09 Thread m1chael
Good luck.

Best case scenario in my opinion is using the utility pdf2text and regex,
and this will be painful.



On Fri, Mar 9, 2018, 3:01 AM Shazia Nusrat  wrote:

> Hi,
>
> I am trying to work around with PDF's where user uploads PDF in image or
> filefield and then way to extract it for Django and finally update DB table
> based on it. Following are the models:
>
> class StudentFee(models.Model):
>class_name = models.CharField(choices=CLASSES, max_lenght=200)
>fee_deposit_slip = models.ImageField(upload_to="students/")
>
>def __unicode__(self):
>  return unicode(self.class_name)
>
> All I need is to design a view where I can extract data from the PDF
> uploaded in the model below:
>
> class StudentInfo(models.Model):
> first_name = models.CharField(max_length=200)
> last_name = models.CharField(max_length=200)
> email=models.EmailField()
> phone = PhoneField() #using phoneField custom field
> def __unicode__(self):
>return unicode(self.first_name)
>
> All the fields in second model does exist in the PDF. In my Views.py
>
> class StudentPDFReader(FormView):
>   template_name = 'pdfdata.html'
>   form_class = PDFForm
>   success_url = '/success/'
>
>   def form_valid(self, form):
># here I need to extract and add entries to modelform
>   return super(StudentPDFReader, self).form_valid(form)
>
> Looking for kind help.
>
> Regards,
> Shazia
>
>
> --
> 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/CAD83tOyHABrpfn48EwMgjbvCB5y1U4AwwL_%2BS1EnCb6WebyWKw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


How to populate DB from PDF extracted data

2018-03-09 Thread Shazia Nusrat
Hi,

I am trying to work around with PDF's where user uploads PDF in image or
filefield and then way to extract it for Django and finally update DB table
based on it. Following are the models:

class StudentFee(models.Model):
   class_name = models.CharField(choices=CLASSES, max_lenght=200)
   fee_deposit_slip = models.ImageField(upload_to="students/")

   def __unicode__(self):
 return unicode(self.class_name)

All I need is to design a view where I can extract data from the PDF
uploaded in the model below:

class StudentInfo(models.Model):
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
email=models.EmailField()
phone = PhoneField() #using phoneField custom field
def __unicode__(self):
   return unicode(self.first_name)

All the fields in second model does exist in the PDF. In my Views.py

class StudentPDFReader(FormView):
  template_name = 'pdfdata.html'
  form_class = PDFForm
  success_url = '/success/'

  def form_valid(self, form):
   # here I need to extract and add entries to modelform
  return super(StudentPDFReader, self).form_valid(form)

Looking for kind help.

Regards,
Shazia

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