Friday, June 1, 2018

Re: Call to method that takes in a request

Hi Yufenyuy,

You just instantiate the object and call the function. Something like

created_object = MyModel(field='some_value')
view = MyView()
view.get(request, created_object.pk)

If you want to create a request object, you can use RequestFactory: https://docs.djangoproject.com/en/2.0/topics/testing/advanced/#the-request-factory


On Fri, Jun 1, 2018 at 8:02 AM, Yufenyuy Veyeh Didier <yveyeh@gmail.com> wrote:
Hello,
I wish to know  how I can call a method that takes in a request as one of its parameters such as 

def get(self, request, pk):

#I am writing a test method to test the above method too.

--
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+unsubscribe@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/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com.
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+unsubscribe@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/CAEM7gE3bFhJ5runouLCWMZw%2BkR13d3Bu9h42i849NuOLvE1eAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: dumpdata fails with crytpic error

All sorted, thanks for the tips.

Bernd Wechner wrote:
Just tried this:

$ python3 manage.py dumpdata --format json --indent 4 > data.json
CommandError: Unable to serialize database: 'NoneType' object has no attribute 'is_authenticated'

Anyone seen this before. How does one diagnose this given the vague nature of the message? I mean I presume it's complaining because there's an illegal value in a field in the database. But you think it's mention which field in which model on which record? Is there a quick way to find out?

Regards,

Bernd.
--
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/A6pI5pwvMpA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@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/32b8f2a7-cbe2-420d-baee-5101e00a7038%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Implementing a 'please wait' page

you can with celery, just make a view that checks the task ID of the task and if its PENDING, return 'waiting', which would be used by your browser.

also consider the fact that servers will require you to specifically override the connection timeout setting.  with finite numbers of connections the server has, imagine if 100 users hit your server for tasks and have to wait 15 minutes.  your original method won't scale at all beyond a handful of users.

--
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+unsubscribe@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/a087bbd2-bde4-4740-838a-e7d870dcf6e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Call to method that takes in a request

Hello,
I wish to know  how I can call a method that takes in a request as one of its parameters such as 

def get(self, request, pk):

#I am writing a test method to test the above method too.

--
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+unsubscribe@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/8740fe0d-e6b3-4caf-b35e-a442ee05e209%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Implementing a 'please wait' page

Thanks Mark! I will surely have a look at them. 

But I was hoping if there was a way of getting this done using ajax or jquery.

Mohammed Noor

On Fri, Jun 1, 2018 at 11:55 AM, Mark Phillips <mark@phillipsmarketing.biz> wrote:
Have you looked at celery (http://www.celeryproject.org/) to handle the long running process? Perhaps in conjunction with redis (https://redis.io/)?

If you passed the long running process to celery, then you could change the page to "say please wait....".

Mark

On Thu, May 31, 2018 at 4:35 PM, Mohammed Noor <snmk195@gmail.com> wrote:
Hello Guys,

I currently have a process running on my django application which takes about 10-15 minutes to complete.

Currently, the user clicks on a 'submit' button and this process starts. The web page remains in a hung state for the complete time this process takes to run and after say 10-15 mins another 'results' page is displayed.


I want to be able to display a page saying 'please wait for <lenght of time taken to complete process>'  after submit button is clicked. Can you please give me any ideas on how to implement this.


Here is a rough representation of my code flow:

Main function ():
    -lots of code
    -call to sub function() //this is the guy taking 10-15 mins to execute
    -if sub function() returns true then proceed else break and exit.
     -remaining code of Main function()

As you might have guessed, I want to be able to change the display when this sub function () is hit. Btw, main function () is executed when user clicks on submit button.


Appreciate your help!

Thanks and Have a great day,
Mohammed Noor

--
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+unsubscribe@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/5CF991C0-FB63-47BA-9A2A-47224E468D0B%40gmail.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+unsubscribe@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/CAEqej2OTHwsOe5svxqbd31h1NSniROe9pnmbDm%2BN3vPGtUPTSw%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+unsubscribe@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/CABANScQyp9rDr8sD8Gxf-y%2BFJ1RawBOAZuRNJ9LPwfUToWw%3DOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: URL Concatenation Issue

On vrijdag 1 juni 2018 00:14:32 CEST John Regis, Jr. wrote:

 

> I have *href="about/"*. Also tried *href="./about/"* and same result.

 

Please revisit this section in the tutorial. If you haven't done the tutorial at all, please do it before trying a project on your own. You are missing a few fundamentals the tutorial touches upon, such as the basics of URLs and URL paths.

--

Melvyn Sopacua

Re: dumpdata fails with crytpic error

On vrijdag 1 juni 2018 06:22:43 CEST Bernd Wechner wrote:

> Anyone seen this before. How does one diagnose this given the vague nature
> of the message?

Using the --traceback flag.

--
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+unsubscribe@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/2720311.AXnXxhnEOH%40fritzbook.
For more options, visit https://groups.google.com/d/optout.