Re: Serving static files (admin panel and others)

2014-12-13 Thread Muhammed Tüfekyapan
I find the problem. 


Problem was the file dir nginx looking for static file is different than I 
used for static file.

I changed the files location and it solved.


Thanks for response.

On Sunday, December 14, 2014 4:31:49 AM UTC+2, Florian Schweikert wrote:
>
> On 14/12/14 00:55, Muhammed Tüfekyapan wrote: 
> > I try many things to serve .css files but I can't do that. How can i 
> > serve .css and .js files in Django 1.7? 
> > 
> > 
> > I typed django manage.py collectstatic but still my admin panel don't 
> > load css. 
> > 
> > What can i do? 
>
> did you follow the howto in the documentation? 
>
> https://docs.djangoproject.com/en/1.7/howto/static-files/ 
>
> -- Florian 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1477ffe3-5d07-4556-b125-c6b5f2ad52f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Serving static files (admin panel and others)

2014-12-13 Thread Muhammed Tüfekyapan
Hello everyone,


I try many things to serve .css files but I can't do that. How can i serve 
.css and .js files in Django 1.7?


I typed django manage.py collectstatic but still my admin panel don't load 
css.

What can i do?



Best.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a9616735-fd97-40ef-8b39-976f2b4974c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Working with Google Analytics API

2014-10-22 Thread Muhammed Tüfekyapan
Hi Everyone,



I want to make an app. User come on site, they signed in and give access to 
their google analytics account.

And I generate some reports for them.

I try to use Google Analytics API but I think I use the wrong one. 
https://developers.google.com/analytics/


Which one I should use? Is there any library for that?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f2ad4ecb-7f90-4898-9cd2-b91ea9adef51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Closing modal when user sign up or login

2014-10-08 Thread Muhammed Tüfekyapan
Hello everyone,


I have a form. All users see this form. My needs is like this;
- If user logged in, save their settings.
- If user doesn't logged in, first show him a modal
- If he login or sign up, close modal and save their settings. (settings 
shouldn't be lost.)


For now my template looks like this;

...
{% if request.user.is_authenticated %}

{% csrf_token %}
{{ form }}

###form fields

 

{% else %}
Henüz üye girişi yapmadınız yada üye değilsiniz!

  {% csrf_token %}
{{ form }}

###form fields


  Create


  
  

  

  ×Close
  Welcome


  In order to save your changes, you have to login 
or sign up!
  Login with Facebook



  Close

  

  


{% endif %}
...

How can i do that?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/da0ee366-457a-496b-9884-960e61c16fff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PostgreSQL OperationalError

2013-10-18 Thread Muhammed TÜFEKYAPAN
I restart and problem solved.

Thanks everbody.

Best.

On Friday, October 18, 2013 11:28:45 AM UTC+3, Muhammed TÜFEKYAPAN wrote:
>
> Hello,
>
>
> I just start to publish my app on web. Everything going well but I face a 
> new problem, before I never face. Site working but sometimes raise error 
> like this;
>
> OperationalError at / 
>
> fe_sendauth: no password supplied
>
>
>
> Full error looks like this;
>
> OperationalError at / 
>
> fe_sendauth: no password supplied
>
>  Request Method: GET  Request URL: http://www.domain.co/  Django Version: 
> 1.5.1  Exception Type: OperationalError  Exception Value: 
>
> fe_sendauth: no password supplied
>
>  Exception Location: /var/www/
> www.domain.co/env/local/lib/python2.7/site-packages/psycopg2/__init__.pyin 
> connect, line 164  Python 
> Executable: /var/www/www.domain.co/env/bin/python  Python Version: 2.7.3  
> Python 
> Path: 
>
> ['/var/www/www.domain.co/dictionaryproject',
>  '/var/www/www.domain.co/env/bin',
>  '/var/www/www.domain.co/env/lib/python2.7',
>  '/var/www/www.domain.co/env/lib/python2.7/plat-linux2',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-old',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-dynload',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/local/lib/python2.7/site-packages']
>
>  Server time: Fri, 18 Oct 2013 03:26:32 -0500
>
>
> What is the problem and how can I solve it?
>
>
> Best.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f6b14a90-6ab7-4bbf-a85b-670cbc8ef6c3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: PostgreSQL OperationalError

2013-10-18 Thread Muhammed TÜFEKYAPAN
Thanks for answer. But if my login and pass didn't match, it always raise
error. It just sometimes raise error, sometimes doesn't.


2013/10/18 Xavier Ordoquy 

> Hello,
>
> Your DATABASES settings aren't correct.
> fe_sendauth is about Postgresql complaining the login/password didn't
> match.
>
> Regards,
> Xavier,
> Linovia.
>
> Le 18 oct. 2013 à 10:28, Muhammed TÜFEKYAPAN  a
> écrit :
>
> Hello,
>
>
> I just start to publish my app on web. Everything going well but I face a
> new problem, before I never face. Site working but sometimes raise error
> like this;
>
> OperationalError at /
>
> fe_sendauth: no password supplied
>
>
>
> Full error looks like this;
>
> OperationalError at /
>
> fe_sendauth: no password supplied
>
>  Request Method: GET  Request URL: http://www.domain.co/  Django Version:
> 1.5.1  Exception Type: OperationalError  Exception Value:
>
> fe_sendauth: no password supplied
>
>  Exception Location: /var/www/
> www.domain.co/env/local/lib/python2.7/site-packages/psycopg2/__init__.pyin 
> connect, line 164  Python
> Executable: /var/www/www.domain.co/env/bin/python  Python Version: 2.7.3  
> Python
> Path:
>
> ['/var/www/www.domain.co/dictionaryproject',
>  '/var/www/www.domain.co/env/bin',
>  '/var/www/www.domain.co/env/lib/python2.7',
>  '/var/www/www.domain.co/env/lib/python2.7/plat-linux2',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-old',
>  '/var/www/www.domain.co/env/lib/python2.7/lib-dynload',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-linux2',
>  '/usr/lib/python2.7/lib-tk',
>  '/var/www/www.domain.co/env/local/lib/python2.7/site-packages'] 
> <http://www.domain.co/env/local/lib/python2.7/site-packages'%5D>
>
>  Server time: Fri, 18 Oct 2013 03:26:32 -0500
>
>
> What is the problem and how can I solve it?
>
>
> Best.
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/108c39f7-dc12-435f-8eb0-77a761708aa7%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> 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/oM0ayk0Mw0U/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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/25F0DFE7-2D50-48D2-A9C3-23F2872CFE85%40linovia.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Muhammed Tüfekyapan
*
*İTÜ - Tekstil Müh.*
*532 172 70 66*

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BMQMxUNZEHaoWz-aPR_ODKyr92wHefdM0SddHC6yPxf7%3D8rFg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


PostgreSQL OperationalError

2013-10-18 Thread Muhammed TÜFEKYAPAN
Hello,


I just start to publish my app on web. Everything going well but I face a 
new problem, before I never face. Site working but sometimes raise error 
like this;

OperationalError at / 

fe_sendauth: no password supplied



Full error looks like this;

OperationalError at / 

fe_sendauth: no password supplied

 Request Method: GET  Request URL: http://www.domain.co/  Django Version: 
1.5.1  Exception Type: OperationalError  Exception Value: 

fe_sendauth: no password supplied

 Exception Location: 
/var/www/www.domain.co/env/local/lib/python2.7/site-packages/psycopg2/__init__.py
 
in connect, line 164  Python Executable: 
/var/www/www.domain.co/env/bin/python  Python Version: 2.7.3  Python Path: 

['/var/www/www.domain.co/dictionaryproject',
 '/var/www/www.domain.co/env/bin',
 '/var/www/www.domain.co/env/lib/python2.7',
 '/var/www/www.domain.co/env/lib/python2.7/plat-linux2',
 '/var/www/www.domain.co/env/lib/python2.7/lib-tk',
 '/var/www/www.domain.co/env/lib/python2.7/lib-old',
 '/var/www/www.domain.co/env/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/var/www/www.domain.co/env/local/lib/python2.7/site-packages']

 Server time: Fri, 18 Oct 2013 03:26:32 -0500


What is the problem and how can I solve it?


Best.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/108c39f7-dc12-435f-8eb0-77a761708aa7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-15 Thread Muhammed TÜFEKYAPAN
Hello everyone,

Yes I know that but now my problem is our new project doesn't seen on 
services list and so I can't start it.

I use gunicorn.

How can I made it?

On Monday, October 14, 2013 10:03:22 PM UTC+3, Javier Guerra wrote:
>
> On Mon, Oct 14, 2013 at 12:17 PM, Muhammed TÜFEKYAPAN 
> > wrote: 
> > I use digitalocean as a server. I upload my django project files on my 
> > server and start to setup. Made postgresql settings etc but I can't 
> define 
> > my new project as a new service on nginx. How can I define my new 
> projest as 
> > a service and make possible to start it as "service blabla start". 
> > 
> > When I type "service --statıs-all" I can't see my new project now. 
>
>
> i think you're mixing two things and missing a third. 
>
> 1: AFAIK, nginx doesn't have "services", just serves requests via some 
> methods, either static files, internal plugins or backend servers. 
>
> 2: on most linux distros, the 'service' command manages startup 
> scripts; with start/stop commands to run daemons. 
>
> 3: nginx doesn't run python applications, you have to run them in an 
> app server.  for Django, (and most python frameworks), the best option 
> is a wsgi server.  One that runs really well with nginx is uWSGI. 
> another option is to run gunicorn as an HTTP backend server behind 
> nginx. 
>
>
> so, which is your deployment strategy? 
> (https://docs.djangoproject.com/en/1.6/howto/deployment/) 
>
>
> -- 
> Javier 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ef9db670-7a3a-4b84-837a-c9e401840452%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Defining new project as a service at nignx

2013-10-14 Thread Muhammed TÜFEKYAPAN
First of all, thanks for answer.

I read these two links but I can't find any information for my problem.

I write boot file and make required changes in the sites-avaiable folder. 
Even this, nginx don't see my project. 

I still need help.

On Monday, October 14, 2013 9:22:34 PM UTC+3, sacrac wrote:
>
> Hi you need read this 
>
> http://wiki.nginx.org/ServerBlockExample
>
> http://wiki.nginx.org/DjangoFastCGI
>
> Cheers
>
>
> On Mon, Oct 14, 2013 at 11:17 AM, Muhammed TÜFEKYAPAN 
> 
> > wrote:
>
>> Hello everybody,
>>
>>
>> I use digitalocean as a server. I upload my django project files on my 
>> server and start to setup. Made postgresql settings etc but I can't define 
>> my new project as a new service on nginx. How can I define my new projest 
>> as a service and make possible to start it as "service blabla start". 
>>
>> When I type "service --statıs-all" I can't see my new project now. 
>>
>>
>> Best.
>>  
>> -- 
>> 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.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d38d8218-5dc5-444c-be0c-b440954cd440%40googlegroups.com
>> .
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37cbcfad-fd68-4be6-83a8-b2725b7c1490%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Defining new project as a service at nignx

2013-10-14 Thread Muhammed TÜFEKYAPAN
Hello everybody,


I use digitalocean as a server. I upload my django project files on my 
server and start to setup. Made postgresql settings etc but I can't define 
my new project as a new service on nginx. How can I define my new projest 
as a service and make possible to start it as "service blabla start". 

When I type "service --statıs-all" I can't see my new project now. 


Best.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d38d8218-5dc5-444c-be0c-b440954cd440%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Gunicorn with Two Django App

2013-08-13 Thread Muhammed TÜFEKYAPAN
My django app log looks like this:

2013-08-13 20:09:20 [16822] [INFO] Handling signal: quit
2013-08-13 20:09:20 [16833] [INFO] Worker exiting (pid: 16833)
INFO:gunicorn.error:Worker exiting (pid: 16833)
2013-08-13 20:09:20 [16834] [INFO] Worker exiting (pid: 16834)
INFO:gunicorn.error:Worker exiting (pid: 16834)
2013-08-13 20:09:20 [16822] [INFO] Shutting down: Master


On Tuesday, August 13, 2013 11:11:28 PM UTC+3, Muhammed TÜFEKYAPAN wrote:
>
> I edit my port, sites enabled files etc.
>
> Now two sites run different port but i got an error: 502 Bad Gateway
>
> Also when i type "service apache2 restart" there is error "Could not 
> reliably determine the server's fully qualified domain name, using 
> 127.0.0.1 for ServerName" error. 
>
> I think real problem this.
>
>
> On Tuesday, August 13, 2013 5:31:07 PM UTC+3, Muhammed TÜFEKYAPAN wrote:
>>
>> Hello Everyone,
>>
>>
>> I use digitalocean for server and i install nginx and unicorn for django. 
>> I have one service for my project. I also want to add new django project 
>> and i made it with making new services. 
>>
>> When my one project running the other project stop. 
>>
>> How can i run two projects same time?
>>
>> 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django Gunicorn with Two Django App

2013-08-13 Thread Muhammed TÜFEKYAPAN
I edit my port, sites enabled files etc.

Now two sites run different port but i got an error: 502 Bad Gateway

Also when i type "service apache2 restart" there is error "Could not 
reliably determine the server's fully qualified domain name, using 
127.0.0.1 for ServerName" error. 

I think real problem this.


On Tuesday, August 13, 2013 5:31:07 PM UTC+3, Muhammed TÜFEKYAPAN wrote:
>
> Hello Everyone,
>
>
> I use digitalocean for server and i install nginx and unicorn for django. 
> I have one service for my project. I also want to add new django project 
> and i made it with making new services. 
>
> When my one project running the other project stop. 
>
> How can i run two projects same time?
>
> 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Django Gunicorn with Two Django App

2013-08-13 Thread Muhammed TÜFEKYAPAN
Hello Everyone,


I use digitalocean for server and i install nginx and unicorn for django. I 
have one service for my project. I also want to add new django project and 
i made it with making new services. 

When my one project running the other project stop. 

How can i run two projects same time?

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




Re: check user status

2013-08-13 Thread Muhammed TÜFEKYAPAN
What do you mean with like? Is it Facebook like or other action on your 
project?

On Tuesday, August 13, 2013 8:40:37 AM UTC+3, Tcheck wrote:
>
> Hi,
> How do i check whether a user has liked an object or not? And if yes, how 
> do block the user from liking it again? Any help will be appreciated.
> 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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Query Set and Output

2013-08-07 Thread Muhammed TÜFEKYAPAN
   "outout = Excuse.objects.order_by('?')[0]"

This works well.

Thank you.

On Wednesday, August 7, 2013 6:19:01 AM UTC+3, Muhammed TÜFEKYAPAN wrote:
>
> Hello everyone,
>
> I write a basic model in django 1.5.1
>
> My model is looks like this:
> class Excuse(models.Model):
> text = models.CharField(max_length=300)
>
> def __unicode__(self):
> return self.text
>
> And i have a basic function to get random excuse from this model.
>
> def home(request):
> output = Excuse.objects.order_by('?')[:1]
> template = loader.get_template('index.html')
> context = {'output': output}
> return HttpResponse(output)
>
> If i write my view looks like above everything works well. I get a random 
> excuse and write it on the page. But when i change this like this:
>
> def home(request):
> output = Excuse.objects.order_by('?')[:1]
> template = loader.get_template('index.html')
> context = {'output': output}
> return render(request, 'index.html', context)
>
> I get output like this: []
> i just want to blabla section and how i get away from  []
>
>
> Thanks for all!
>

-- 
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: Query Set and Output

2013-08-07 Thread Muhammed TÜFEKYAPAN
It looks like this:



   {{ output }} 



On Wednesday, August 7, 2013 6:58:17 AM UTC+3, Bulkan-Savun Evcimen wrote:
>
> Hi there,
>
> What does your template index.html look like ?
>
> Cheers
>
> http://bulkan-evcimen.com
>  
>
> On Wed, Aug 7, 2013 at 1:19 PM, Muhammed TÜFEKYAPAN 
> 
> > wrote:
>
>> Hello everyone,
>>
>> I write a basic model in django 1.5.1
>>
>> My model is looks like this:
>> class Excuse(models.Model):
>> text = models.CharField(max_length=300)
>>
>> def __unicode__(self):
>> return self.text
>>
>> And i have a basic function to get random excuse from this model.
>>
>> def home(request):
>> output = Excuse.objects.order_by('?')[:1]
>> template = loader.get_template('index.html')
>> context = {'output': output}
>> return HttpResponse(output)
>>
>> If i write my view looks like above everything works well. I get a random 
>> excuse and write it on the page. But when i change this like this:
>>
>> def home(request):
>> output = Excuse.objects.order_by('?')[:1]
>> template = loader.get_template('index.html')
>> context = {'output': output}
>> return render(request, 'index.html', context)
>>
>> I get output like this: []
>> i just want to blabla section and how i get away from  []
>>
>>
>> Thanks for all!
>>
>> -- 
>> 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.




Query Set and Output

2013-08-06 Thread Muhammed TÜFEKYAPAN
Hello everyone,

I write a basic model in django 1.5.1

My model is looks like this:
class Excuse(models.Model):
text = models.CharField(max_length=300)

def __unicode__(self):
return self.text

And i have a basic function to get random excuse from this model.

def home(request):
output = Excuse.objects.order_by('?')[:1]
template = loader.get_template('index.html')
context = {'output': output}
return HttpResponse(output)

If i write my view looks like above everything works well. I get a random 
excuse and write it on the page. But when i change this like this:

def home(request):
output = Excuse.objects.order_by('?')[:1]
template = loader.get_template('index.html')
context = {'output': output}
return render(request, 'index.html', context)

I get output like this: []
i just want to blabla section and how i get away from  []


Thanks for all!

-- 
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.