Re: Hi django

2021-06-24 Thread DJANGO DEVELOPER
muhammad haris salamat just make a form in your template, then have a
name='any name here' and then make a view in which you have to get the name
in the following way.
query = request.POST.get('any name here')
and then do this:
value = ModelName.objects.filter(Q(model_field = query)


On Thu, Jun 24, 2021 at 10:31 PM muhammad haris salamat <
harissalama...@gmail.com> wrote:

> Hi all can u help me plz how I can use filter with Contain query in Django
> I wanna fetch all data from my database with the help of filter query
>
> On Thu, 24 Jun 2021, 9:17 pm Richard Dushime, 
> wrote:
>
>> THANK U I HAVE DONE TO FIX IT ITS NOW WORKING
>>
>> On Thu, Jun 24, 2021 at 6:04 PM Julio Cojom 
>> wrote:
>>
>>> Django framework uses urls to math the html files. This work with the
>>> same syntax of static files, you would use {% url 'app:viewname' %} to
>>> render any page with Django.
>>>
>>> You should check the docs of urls to understand how it works and get
>>> this done.
>>>
>>> Regards
>>>
>>> El jue., 24 de junio de 2021 9:00 a. m., Richard Dushime <
>>> mudaherar...@gmail.com> escribió:
>>>
 i have a problem on my navigation bar on the index.html link when i
 click on it its showing me the error (see error.png)  or everything apart
 that its working fine  need ur help
 >>> "{% static 'assets/img/hero-logo.png' %}" alt="">
   
 >>> "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
   

   
 
   Home
   About
 
   About Us
   Team
 
   
   Services

   >>> "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">

   Portfolio
   Pricing
   Contact

 
   


 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAJCm56L%2BG%3D8tLZ%3D3sZ0%3Dh%3Ds-w5AXaLroU3nkgoKZO6Fj8xqFBw%40mail.gmail.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAHRQUHmOdq-yXfQdkDRcvjdf727U1Wr1HogjVpP1bw0o7rN61w%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJCm56Jn1WOtp-hGbFoDS6uYy8A5ZSom7fD6j_UG%3D-oM4WQWng%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2BOEwHsNuBGuH8fr3LoooK6K78F%2BZJb0OhBMxJcCuTG-K9Zkbw%40mail.gmail.com
> 
> .
>

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


Re: Hi django

2021-06-24 Thread muhammad haris salamat
Hi all can u help me plz how I can use filter with Contain query in Django
I wanna fetch all data from my database with the help of filter query

On Thu, 24 Jun 2021, 9:17 pm Richard Dushime, 
wrote:

> THANK U I HAVE DONE TO FIX IT ITS NOW WORKING
>
> On Thu, Jun 24, 2021 at 6:04 PM Julio Cojom 
> wrote:
>
>> Django framework uses urls to math the html files. This work with the
>> same syntax of static files, you would use {% url 'app:viewname' %} to
>> render any page with Django.
>>
>> You should check the docs of urls to understand how it works and get this
>> done.
>>
>> Regards
>>
>> El jue., 24 de junio de 2021 9:00 a. m., Richard Dushime <
>> mudaherar...@gmail.com> escribió:
>>
>>> i have a problem on my navigation bar on the index.html link when i
>>> click on it its showing me the error (see error.png)  or everything apart
>>> that its working fine  need ur help
>>> >> "{% static 'assets/img/hero-logo.png' %}" alt="">
>>>   
>>> >> "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
>>>   
>>>
>>>   
>>> 
>>>   Home
>>>   About
>>> 
>>>   About Us
>>>   Team
>>> 
>>>   
>>>   Services
>>>
>>>   >> "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
>>>
>>>   Portfolio
>>>   Pricing
>>>   Contact
>>>
>>> 
>>>   
>>>
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAJCm56L%2BG%3D8tLZ%3D3sZ0%3Dh%3Ds-w5AXaLroU3nkgoKZO6Fj8xqFBw%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAHRQUHmOdq-yXfQdkDRcvjdf727U1Wr1HogjVpP1bw0o7rN61w%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJCm56Jn1WOtp-hGbFoDS6uYy8A5ZSom7fD6j_UG%3D-oM4WQWng%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BOEwHsNuBGuH8fr3LoooK6K78F%2BZJb0OhBMxJcCuTG-K9Zkbw%40mail.gmail.com.


Re: Hi django

2021-06-24 Thread Richard Dushime
THANK U I HAVE DONE TO FIX IT ITS NOW WORKING

On Thu, Jun 24, 2021 at 6:04 PM Julio Cojom 
wrote:

> Django framework uses urls to math the html files. This work with the same
> syntax of static files, you would use {% url 'app:viewname' %} to render
> any page with Django.
>
> You should check the docs of urls to understand how it works and get this
> done.
>
> Regards
>
> El jue., 24 de junio de 2021 9:00 a. m., Richard Dushime <
> mudaherar...@gmail.com> escribió:
>
>> i have a problem on my navigation bar on the index.html link when i click
>> on it its showing me the error (see error.png)  or everything apart that
>> its working fine  need ur help
>> > "{% static 'assets/img/hero-logo.png' %}" alt="">
>>   
>> > "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
>>   
>>
>>   
>> 
>>   Home
>>   About
>> 
>>   About Us
>>   Team
>> 
>>   
>>   Services
>>
>>   > "{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
>>
>>   Portfolio
>>   Pricing
>>   Contact
>>
>> 
>>   
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJCm56L%2BG%3D8tLZ%3D3sZ0%3Dh%3Ds-w5AXaLroU3nkgoKZO6Fj8xqFBw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHRQUHmOdq-yXfQdkDRcvjdf727U1Wr1HogjVpP1bw0o7rN61w%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJCm56Jn1WOtp-hGbFoDS6uYy8A5ZSom7fD6j_UG%3D-oM4WQWng%40mail.gmail.com.


Re: Hi django

2021-06-24 Thread Julio Cojom
Django framework uses urls to math the html files. This work with the same
syntax of static files, you would use {% url 'app:viewname' %} to render
any page with Django.

You should check the docs of urls to understand how it works and get this
done.

Regards

El jue., 24 de junio de 2021 9:00 a. m., Richard Dushime <
mudaherar...@gmail.com> escribió:

> i have a problem on my navigation bar on the index.html link when i click
> on it its showing me the error (see error.png)  or everything apart that
> its working fine  need ur help
>  "{% static 'assets/img/hero-logo.png' %}" alt="">
>   
>   alt="" class="img-fluid">
>   
>
>   
> 
>   Home
>   About
> 
>   About Us
>   Team
> 
>   
>   Services
>
>"{% static 'assets/img/logo.png' %}" alt="" class="img-fluid">
>
>   Portfolio
>   Pricing
>   Contact
>
> 
>   
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJCm56L%2BG%3D8tLZ%3D3sZ0%3Dh%3Ds-w5AXaLroU3nkgoKZO6Fj8xqFBw%40mail.gmail.com
> 
> .
>

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


Hi django

2021-06-24 Thread Richard Dushime
i have a problem on my navigation bar on the index.html link when i click
on it its showing me the error (see error.png)  or everything apart that
its working fine  need ur help

  

  

  

  Home
  About

  About Us
  Team

  
  Services

  

  Portfolio
  Pricing
  Contact


  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJCm56L%2BG%3D8tLZ%3D3sZ0%3Dh%3Ds-w5AXaLroU3nkgoKZO6Fj8xqFBw%40mail.gmail.com.


Re: hi [django-users]How to define the response?

2013-06-26 Thread Sandro Dutra
Did you test this code? I think this code has errors...

If your objective is parse html/xml/json I think you've to check if the
application doesn't provide an API, and use the correct python library to
parse. If you need to parse by force, I think you can use BeautifulSoup.


2013/6/26 lx 

> hi :
>I'm a new one. I want to fix a question.Like this:
>
> 
> from django.http import HttpResponse
> import datetime
> def current_datetime(request):
>   now = datetime.datetime.now()
>   if now == 2013:
>   html = "It is now %s."
> % now
>   return HttpResponse(html)
>   else:
>  # giva a response first
>  urllib.urlopen(message)
>  # do something
>  print 'not 2013'
>  sys.exit(0)
>
> 
>
> How to use " urllib.urlopen(message)" instead of "HttpResponse()" ?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-26 Thread Michael Anckaert
On 25/06/13 12:35, lx wrote:
> hi all:
>   I want to do someing after "return HttpResponse(html)".
> for example
> ""
> from django.http import HttpResponse
> import datetime
> def current_datetime(request):
>   now = datetime.datetime.now()
>   html = "It is now %s." % now
>   return HttpResponse(html)
> "
>
> Actually, I have a question that I need first give a response to the
> client, second I do something else.
> How to solve this?
>
> Thank you
>
>
You can't do anything after your view (= python function) returns.
If you need to perform a task but don't want to keep the user waiting,
you should look into Celery. This is a Distributed Task Queue: you can
start a task that a worker will execute in the backend. Your view can
return immediately, being very responsive to the user. In the meanwhile
the worker will perform the extra work in the background.

--
Kind regards
Michael Anckaert




signature.asc
Description: OpenPGP digital signature


hi [django-users]How to define the response?

2013-06-25 Thread lx
hi :
   I'm a new one. I want to fix a question.Like this:


from django.http import HttpResponse
import datetime
def current_datetime(request):
  now = datetime.datetime.now()
  if now == 2013:
  html = "It is now %s."
% now
  return HttpResponse(html)
  else:
 # giva a response first
 urllib.urlopen(message)
 # do something
 print 'not 2013'
 sys.exit(0)



How to use " urllib.urlopen(message)" instead of "HttpResponse()" ?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
Thank you.
But I want to fix it like this, because the time of "do something" is not
long.
###

from django.http import HttpResponseimport datetimedef
current_datetime(request):
  now = datetime.datetime.now()
  if now == 2013:
  html = "It is now %s." % now
  return HttpResponse(html)
  else:
 # giva a response first
 urllib.urlopen(message)
 # do something
 print 'not 2013'
 sys.exit(0)


###


2013/6/25 Hector Armando Vela Santos 

> You can use Celery for that, I've done something similar, just with a CSV
> instead of a XML, check this
> http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
>
> once installed and configured, its as simple as:
>
> from celery import task
>
> if (the xml format is ERROR) == True:
> return HttpResponse(ERROR FORMAT")
> else:
> do_something.delay(the_xml_file)
> return HttpResponse(RIGHT FORMAT")
> #I must give a response first, And do other thing. Because the spend
> time of do_something() may be long.
>
> @task(ignore_result=True)
> def do_something(xml):
> #do something time consuming
>
>
> and the do_something function will be called in second plane, and the user
> will get an instant response, even if the parsing file process takes half
> an hour
>
>
> On Tuesday, June 25, 2013 8:32:59 AM UTC-5, lx wrote:
>
>> Thank you.
>>
>> The real demand is:
>>
>> 1.
>> receive the xml file from client.
>>
>> 2.
>> if (the xml format is ERROR) == True:
>> return HttpResponse(ERROR FORMAT")
>> else:
>> return HttpResponse(RIGHT FORMAT")
>> #I must give a response first, And do other thing. Because the spend
>> time of do_something() may be long.
>> do_something(the xml file)
>>
>>
>>
>>
>>
>>
>> 2013/6/25 Sandro Dutra 
>>
>>> The question is: What you're trying to do?
>>>
>>> 1. You can do any other process before the return line, the return will
>>> be the same... for example:
>>>
>>> from django.http import HttpResponse
>>> from datetime import datetime
>>> def current_datetime(request):
>>>   now = datetime.now()
>>>   html = "It is now %s." % now
>>>   year = now.year()
>>>   return HttpResponse(html)
>>>
>>>
>>> 2. You can use a conditional to have multiple returns:
>>> from django.http import HttpResponse
>>> from datetime import datetime
>>> def current_datetime(request):
>>>   now = datetime.now()
>>>   html = "It is now %s." % now
>>>   year = now.year()
>>>   if year == 2013:
>>>   return HttpResponse(html)
>>>  else:
>>>   return HttpResponse(Sorry it's not
>>> 2013.")
>>>
>>>
>>> 2013/6/25 Timster 
>>>
 You cannot do something after the "return" line. This is Python
 functionality. When you return, the function exits and does not process
 anything else.

 What exactly are you trying to do? There is probably another way to
 accomplish 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...@**googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.

 Visit this group at 
 http://groups.google.com/**group/django-users
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_out
 .



>>>
>>>  --
>>> 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 
>>> http://groups.google.com/**group/django-users
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop 

Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Hector Armando Vela Santos
You can use Celery for that, I've done something similar, just with a CSV 
instead of a XML, check 
this http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

once installed and configured, its as simple as:

from celery import task

if (the xml format is ERROR) == True:
return HttpResponse(ERROR FORMAT")
else:
do_something.delay(the_xml_file)
return HttpResponse(RIGHT FORMAT")
#I must give a response first, And do other thing. Because the spend 
time of do_something() may be long.

@task(ignore_result=True)
def do_something(xml):
#do something time consuming


and the do_something function will be called in second plane, and the user 
will get an instant response, even if the parsing file process takes half 
an hour

On Tuesday, June 25, 2013 8:32:59 AM UTC-5, lx wrote:
>
> Thank you.
>
> The real demand is:
>
> 1.
> receive the xml file from client.
>
> 2.
> if (the xml format is ERROR) == True:
> return HttpResponse(ERROR FORMAT")
> else:
> return HttpResponse(RIGHT FORMAT")
> #I must give a response first, And do other thing. Because the spend 
> time of do_something() may be long.
> do_something(the xml file)
>
>
>
>
>
>
> 2013/6/25 Sandro Dutra 
>
>> The question is: What you're trying to do?
>>
>> 1. You can do any other process before the return line, the return will 
>> be the same... for example:
>>
>> from django.http import HttpResponse
>> from datetime import datetime
>> def current_datetime(request):
>>   now = datetime.now()
>>   html = "It is now %s." % now
>>   year = now.year()
>>   return HttpResponse(html)
>>
>>
>> 2. You can use a conditional to have multiple returns:
>> from django.http import HttpResponse
>> from datetime import datetime
>> def current_datetime(request):
>>   now = datetime.now()
>>   html = "It is now %s." % now
>>   year = now.year()
>>   if year == 2013:
>>   return HttpResponse(html)
>>  else:
>>   return HttpResponse(Sorry it's not 
>> 2013.")
>>
>>
>> 2013/6/25 Timster 
>>
>>> You cannot do something after the "return" line. This is Python 
>>> functionality. When you return, the function exits and does not process 
>>> anything else.
>>>
>>> What exactly are you trying to do? There is probably another way to 
>>> accomplish 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...@googlegroups.com .
>>> To post to this group, send email to django...@googlegroups.com
>>> .
>>> Visit this group at http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>  -- 
>> 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 http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Sandro Dutra
If the "do_something" will take a long time to finish, you've 2 options:
Find a better (optimized) way to "do_something" or inform your client the
application is doing something and he will have to wait a little.

So, I can't see any advantage to say to your client there's something was
ok if the application is not finish his work. If something goes wrong while
"do_something" is working, your client will think everything was ok, but
you'll an ocult error.


2013/6/25 lx 

> Thank you.
>
> The real demand is:
>
> 1.
> receive the xml file from client.
>
> 2.
> if (the xml format is ERROR) == True:
> return HttpResponse(ERROR FORMAT")
> else:
> return HttpResponse(RIGHT FORMAT")
> #I must give a response first, And do other thing. Because the spend
> time of do_something() may be long.
> do_something(the xml file)
>
>
>
>
>
>
> 2013/6/25 Sandro Dutra 
>
>> The question is: What you're trying to do?
>>
>> 1. You can do any other process before the return line, the return will
>> be the same... for example:
>>
>> from django.http import HttpResponse
>> from datetime import datetime
>> def current_datetime(request):
>>   now = datetime.now()
>>   html = "It is now %s." % now
>>   year = now.year()
>>   return HttpResponse(html)
>>
>>
>> 2. You can use a conditional to have multiple returns:
>> from django.http import HttpResponse
>> from datetime import datetime
>> def current_datetime(request):
>>   now = datetime.now()
>>   html = "It is now %s." % now
>>   year = now.year()
>>   if year == 2013:
>>   return HttpResponse(html)
>>  else:
>>   return HttpResponse(Sorry it's not
>> 2013.")
>>
>>
>> 2013/6/25 Timster 
>>
>>> You cannot do something after the "return" line. This is Python
>>> functionality. When you return, the function exits and does not process
>>> anything else.
>>>
>>> What exactly are you trying to do? There is probably another way to
>>> accomplish 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 http://groups.google.com/group/django-users.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>  --
>> 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 http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
Thank you.

The real demand is:

1.
receive the xml file from client.

2.
if (the xml format is ERROR) == True:
return HttpResponse(ERROR FORMAT")
else:
return HttpResponse(RIGHT FORMAT")
#I must give a response first, And do other thing. Because the spend
time of do_something() may be long.
do_something(the xml file)






2013/6/25 Sandro Dutra 

> The question is: What you're trying to do?
>
> 1. You can do any other process before the return line, the return will be
> the same... for example:
>
> from django.http import HttpResponse
> from datetime import datetime
> def current_datetime(request):
>   now = datetime.now()
>   html = "It is now %s." % now
>   year = now.year()
>   return HttpResponse(html)
>
>
> 2. You can use a conditional to have multiple returns:
> from django.http import HttpResponse
> from datetime import datetime
> def current_datetime(request):
>   now = datetime.now()
>   html = "It is now %s." % now
>   year = now.year()
>   if year == 2013:
>   return HttpResponse(html)
>  else:
>   return HttpResponse(Sorry it's not
> 2013.")
>
>
> 2013/6/25 Timster 
>
>> You cannot do something after the "return" line. This is Python
>> functionality. When you return, the function exits and does not process
>> anything else.
>>
>> What exactly are you trying to do? There is probably another way to
>> accomplish 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 http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Sandro Dutra
The question is: What you're trying to do?

1. You can do any other process before the return line, the return will be
the same... for example:

from django.http import HttpResponse
from datetime import datetime
def current_datetime(request):
  now = datetime.now()
  html = "It is now %s." % now
  year = now.year()
  return HttpResponse(html)


2. You can use a conditional to have multiple returns:
from django.http import HttpResponse
from datetime import datetime
def current_datetime(request):
  now = datetime.now()
  html = "It is now %s." % now
  year = now.year()
  if year == 2013:
  return HttpResponse(html)
 else:
  return HttpResponse(Sorry it's not
2013.")


2013/6/25 Timster 

> You cannot do something after the "return" line. This is Python
> functionality. When you return, the function exits and does not process
> anything else.
>
> What exactly are you trying to do? There is probably another way to
> accomplish 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 http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread Timster
You cannot do something after the "return" line. This is Python 
functionality. When you return, the function exits and does not process 
anything else.

What exactly are you trying to do? There is probably another way to 
accomplish 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




hi [django-users] How to do something after "return HttpResponse(html)"?

2013-06-25 Thread lx
hi all:
  I want to do someing after "return HttpResponse(html)".
for example
""
from django.http import HttpResponse
import datetime
def current_datetime(request):
  now = datetime.datetime.now()
  html = "It is now %s." % now
  return HttpResponse(html)
"

Actually, I have a question that I need first give a response to the
client, second I do something else.
How to solve this?

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.