Re: List of available Jinja2 global symbols

2015-11-22 Thread Jirka Vejrazka
  Hi there, I'm not a Jinja2 user, but standard Django templates get these variables via context processors‎. Check out https://docs.djangoproject.com/en/1.8/topics/templates/#context-processors HTH   JirkaFrom: Patrick SpencerSent: neděle, 22. listopadu 2015 5:45To: Django usersReply To: django-users@googlegroups.comSubject: List of available Jinja2 global symbolsI'm using Django 1.8.6 with the built in JInja2 support. I spent a while trying to figure out how to pass a csrf token to a JInja2 template. After a while I realized one could just write {{ csrf_token }} in the template, without passing this value through a view, and it would just print out the token. I also realized you could reference a request object without passing it through the view i.e. {{ request.user }} returns the current user. Is there a place in the documentation with all the available global symbols one can use in a Jinja2 template?



-- 
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/537bd366-180e-4876-8b91-5791f8e22d44%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20151122121713.6680662.74484.1734%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Search Engine using Django-Python

2015-07-24 Thread jirka . vejrazka
Hi Manoj,

  I'm very happy with django-watson + PostgreSQL combination. It's a relatively 
low-tech option, but works very well for me.

  HTH

Jirka

-Original Message-
From: Manoj Bawane 
Sender: django-users@googlegroups.com
Date: Mon, 6 Jul 2015 08:25:57 
To: 
Reply-To: django-users@googlegroups.com
Subject: Search Engine using Django-Python

Hi All,

I am planning to create a search engine for my city. Can you please suggest 
me Which technology I should prefer? I am new with Django, before that I 
have work with some web application using Java Spring. But now, I recently 
working in one project where I found Django is also nice framework to 
develop search engine sites. So Please any one suggest me,

   1. How should I proceed to do this project using Django,
   2. What other technology associated with Django which helps to make 
   searching faster.
   3. Which Open Source database will better
   4. Where I can deploy my search engine, (will it need dedicated or 
   shared host server).

Please suggest your valuable opinion.


Thanks to everyone.

-- 
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/564fdc15-391d-4829-bdb2-96d189d73499%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1244930142-1437734052-cardhu_decombobulator_blackberry.rim.net-145460872-%40b18.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: how to mock REST calls during development?

2015-05-27 Thread Jirka Vejrazka
Hi Abraham,

  I guess my advantage is that my applications are quite tightly coupled,
so I can set some flags in settings.py.

  The key point is that I'm importing class instance from my API code. That
instance represents either the real endpoint or mocked endpoint based on
some flags in settings.py

  I've pasted relevant code here: http://dpaste.com/00DCQT6

  HTH

Jirka

On 27 May 2015 at 17:33, Abraham Varricatt  wrote:

> Hello Jirka,
>
> That's right. I'd forgotten that the settings.py could be used to
> initialize something like this! (facepalm!) But since you mentioned it, ..
> how would you initialize (or call mock_setup()) from your app or model? I
> can't recollect any entry point which can be used.
>
> -Abraham V.
>
>
> On Monday, 25 May 2015 19:47:26 UTC+5:30, JirkaV wrote:
>>
>> Hi Abraham,
>>
>>   I needed to solve this a few months ago, decided to use
>> https://github.com/getsentry/responses
>>
>>   The way I did this is that I have a function that sets all required
>> responses (using the endpoint URL and the expected response in a file).
>> Then I detect in the application setup (apps, models, settings - whatever
>> you prefer) if I'm on a development machine and call that "mock_setup()" in
>> that case.
>>
>>   Relatively simple code and no change required to my production views.
>>
>>   Small sample at http://dpaste.com/0E1PNVQ
>>
>>   HTH
>>
>>Jirka
>>
>>
>>
>> On 25 May 2015 at 14:47, Avraham Serour  wrote:
>>
>>> I used https://pypi.python.org/pypi/requests-mock, but the mocking was
>>> done on the testCase class, the view was written without if DEBUG or
>>> anything similar
>>>
>>> On Mon, May 25, 2015 at 3:33 PM, Abraham Varricatt <
>>> abraham@googlemail.com> wrote:
>>>
 Hello everyone,

 I'm working on a Django application which needs to communicate with a
 3rd-party REST API. In production the flow would be like this;

1. end-user browser sends a request to my django server
2. my server makes a remote REST call to 3rd party server
3. 3rd party server responds
4. my server sends back response to end-user's browser

 I'm simulating the above flow during development by using the Httpretty
 mocking library. Here is how my view looks like;

 import httpretty

 THIRD_PARTY_SERVER = http://api.gitlab.com/

 def my_view(request):
 if settings.DEBUG:
 httpretty.enable()
 httpretty.register_uri(httpretty.GET, THIRD_PARTY_SERVER, 
 body='{some_mock_response_here}')

 partner_response = requests.get(THIRD_PARTY_SERVER)

 if settings.DEBUG:
 httpretty.disable()
 httpretty.reset()

 # Do some stuff here
 # ...

 return render(request, 'template.html', context)



 For the most part, the above works. I can experiment around without
 hitting the 3rd-party API. But it doesn't feel good. My mocking code is now
 part of the view function - not what I consider a good design. Problem is,
 I'm not sure how else this can be done? Does anyone have any better ideas?
 Note - I'm not doing any testing here. Just need a way to mock 3rd-party
 REST responses during development when I run "python manage.py runserver"
 for debugging/experimentation.

 Ideally, I'd like to move all the mocking code to it's own file and
 away from my views. This should somehow get activated when I start
 'runserver' and work for all my views.

 Puzzled,
 Abraham V.






  --
 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/59821a72-3471-4a9a-affd-3875d28e3a03%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...@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/CAFWa6tJkyPUex%2BzdErn3nnozeYtaM-fbdqoZfEq04b%3D3t2CtsQ%40mail.gmail.com
>>> 

Re: how to mock REST calls during development?

2015-05-25 Thread Jirka Vejrazka
Hi Abraham,

  I needed to solve this a few months ago, decided to use
https://github.com/getsentry/responses

  The way I did this is that I have a function that sets all required
responses (using the endpoint URL and the expected response in a file).
Then I detect in the application setup (apps, models, settings - whatever
you prefer) if I'm on a development machine and call that "mock_setup()" in
that case.

  Relatively simple code and no change required to my production views.

  Small sample at http://dpaste.com/0E1PNVQ

  HTH

   Jirka



On 25 May 2015 at 14:47, Avraham Serour  wrote:

> I used https://pypi.python.org/pypi/requests-mock, but the mocking was
> done on the testCase class, the view was written without if DEBUG or
> anything similar
>
> On Mon, May 25, 2015 at 3:33 PM, Abraham Varricatt <
> abraham.varric...@googlemail.com> wrote:
>
>> Hello everyone,
>>
>> I'm working on a Django application which needs to communicate with a
>> 3rd-party REST API. In production the flow would be like this;
>>
>>1. end-user browser sends a request to my django server
>>2. my server makes a remote REST call to 3rd party server
>>3. 3rd party server responds
>>4. my server sends back response to end-user's browser
>>
>> I'm simulating the above flow during development by using the Httpretty
>> mocking library. Here is how my view looks like;
>>
>> import httpretty
>>
>> THIRD_PARTY_SERVER = http://api.gitlab.com/
>>
>> def my_view(request):
>> if settings.DEBUG:
>> httpretty.enable()
>> httpretty.register_uri(httpretty.GET, THIRD_PARTY_SERVER, 
>> body='{some_mock_response_here}')
>>
>> partner_response = requests.get(THIRD_PARTY_SERVER)
>>
>> if settings.DEBUG:
>> httpretty.disable()
>> httpretty.reset()
>>
>> # Do some stuff here
>> # ...
>>
>> return render(request, 'template.html', context)
>>
>>
>>
>> For the most part, the above works. I can experiment around without
>> hitting the 3rd-party API. But it doesn't feel good. My mocking code is now
>> part of the view function - not what I consider a good design. Problem is,
>> I'm not sure how else this can be done? Does anyone have any better ideas?
>> Note - I'm not doing any testing here. Just need a way to mock 3rd-party
>> REST responses during development when I run "python manage.py runserver"
>> for debugging/experimentation.
>>
>> Ideally, I'd like to move all the mocking code to it's own file and away
>> from my views. This should somehow get activated when I start 'runserver'
>> and work for all my views.
>>
>> Puzzled,
>> Abraham V.
>>
>>
>>
>>
>>
>>
>>  --
>> 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/59821a72-3471-4a9a-affd-3875d28e3a03%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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFWa6tJkyPUex%2BzdErn3nnozeYtaM-fbdqoZfEq04b%3D3t2CtsQ%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhEBEAjVypPg5c6aEr6ysGjJNwY6rF4e%3DmY18s7Jfuwqv%2BfrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: TIMEZONE

2015-04-08 Thread Jirka Vejrazka
Hello there,

  you probably need to take a look at the USE_TZ setting too. If it's True,
then Django will store all times in the UTC timezone and only use the one
you configured in views and templates (and a few other places).

  In most cases, that's what you want anyway as it's the most reliable way
to do this.

  HTH

Jirka

On 8 April 2015 at 14:18,  wrote:

> Hi to all ,
>
> Previously my settings.py file was having time zone as
>
> TIME_ZONE = 'America/Chicago'
>
> now i have changed to
> TIME_ZONE = 'Europe/London'
>
> that not getting reflected means date and time are getting stored in
> database as of previous timezone...
>
>
> Please suggest.
>
> --
> 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/2f325769-40db-480d-afbc-336dc948878e%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhEBEDsjdvQZy4P0hKpzdQ%2BmBjrxt8WY3xWRdyt8Dn9cEJJTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread jirka . vejrazka
It's very likely that the actual user running the webserver process(es) does 
not have "ping" on the executables path...

  HTH

Jirka
-Original Message-
From: dk 
Sender: django-users@googlegroups.com
Date: Tue, 31 Mar 2015 08:12:03 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: subprocess behave diferent in the server than in the client.

playing a littlie bit more, I found out that does work if I am using the 
manage.py runserver.
but doesn't work using the production django =(.



On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote:

> hi, I have a button in my webpage that lunch a subprocess and check the 
> ping of the computer and save the information in a text file. that's it,  
> very basic stuff.
>
> If I am doing my click in the server computer  everything works,
> the subprocess will ping the computer, make the file and save the 
> information. 
> and go back the corresponding view.
>
>
> but if I do it from a client computer,  does all the script,  return the 
> view that needs to return, but it never lunched the subprocess =(.   is 
> like that line was commented or something doesn't even complain or spits 
> errors =(
>
> have any one got an issue like 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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb43b536-352e-4eb0-b32a-485860d19e13%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1427155839-1427828537-cardhu_decombobulator_blackberry.rim.net-201002000-%40b3.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: DateTimeField: Hide clock

2014-10-23 Thread jirka . vejrazka
Look at the "date" filter in template documentation, allows you to customize 
the output.

   HTH

Jirka
-Original Message-
From: Oskar Lyrstrand 
Sender: django-users@googlegroups.com
Date: Thu, 23 Oct 2014 03:28:10 
To: 
Reply-To: django-users@googlegroups.com
Subject: DateTimeField: Hide clock

models.py:
class Post(models.Model):
pub_date = models.DateTimeField

template.html:
{{ post.pub_date }}

output:
 23 october 2014 19:25

Problem is I dont want "19:25" to show. What can I do?

-- 
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/bd6c974f-5762-48c1-92c3-65b338345b85%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2058625486-1414064952-cardhu_decombobulator_blackberry.rim.net-197163-%40b2.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: how to query max count

2014-10-13 Thread Jirka Vejrazka
Hi there,

  you could do it manually by counting occurrences or you could take a look
at aggregation functions here:
https://docs.djangoproject.com/en/1.7/topics/db/aggregation/

  Do as it suits your use case.

  HTH

Jirka

On 13 October 2014 06:30, dk  wrote:

> I am storing the information in the database like this.
>
> class Choice(models.Model):
> restaurant = models.ForeignKey(Restaurant)
> person = models.ForeignKey(Person)
> date = models.DateField("time published")
> time = models.TimeField("date published")
>
>
> that way I can get the person and the restaurant.   and will look like in
> the attached pictures, now how can I query.
> the max repeated restaurant id, for today date.
>
> I want to know today what restaurant won.   =)  (I am trying to
> even think on how to get this in a regular sql command)
>
> thanks guys.
>
> --
> 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/1628cbb6-f8ee-491b-a031-ad7aec787178%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFhEBEBRzGUQMD2nXM_%3DM-s0KMa63ontYPXJoCG63pKquFVmww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: running script in django database

2014-07-30 Thread jirka . vejrazka
Hi Mohammad,

  this can be easily achieved using a custom management command - check the 
Django documentation.

  HTH

Jirka
 
-Original Message-
From: alghafli 
Sender: django-users@googlegroups.com
Date: Wed, 30 Jul 2014 07:02:59 
To: 
Reply-To: django-users@googlegroups.com
Subject: running script in django database

Hello,
I made a library application using django 1.6. currently I only need to 
populate the database. at the beginning, it is easier to write the 
information in a csv file and import it using a script.

the script is running fine if I use manage.py shell and import the 
necessary file and call the necessary function. however, I want to make 
the script run from the system commandline rather than from the python 
interpreter since it is easier to pass arguments to it. I could not find 
a way in the manage.py documentation page.

Is it possible?

thank you,
Mohammad

-- 
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/53D86E73.9060806%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+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/417657233-1406705276-cardhu_decombobulator_blackberry.rim.net-1073591500-%40b4.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: Full text search available on PostgreSQL?

2014-07-08 Thread jirka . vejrazka
Also, not directly tied to ModelAdmin, but you might want to take a look at 
django-watson.

 HTH

   Jirka

-Original Message-
From: Johannes Schneider 
Sender: django-users@googlegroups.com
Date: Tue, 08 Jul 2014 09:26:07 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Full text search available on PostgreSQL?

you could have a look at djorm-ext-pgfulltex.

bg,
Johannes

On 28.06.2014 18:15, Bastian Kuberek wrote:
> Hi,
>
> Just saw that django.contrib.admin.ModelAdmin.search_fields
> 
>  full
> text search only support MySQL.
>
> Are there plans on any progress towards getting this functionality on
> PostgreSQL?
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f0071b4f-a368-4512-a6f7-79d921e32141%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.


-- 
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

-- 
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/53BB9D0F.6050403%40galileo-press.de.
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1509172023-1404852641-cardhu_decombobulator_blackberry.rim.net-509912240-%40b4.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql DB local socket access errors with mod_wsgi

2014-05-28 Thread jirka . vejrazka
It's very likely a permissions problem. Webserver processes tend to run under a 
special username (e.g. www-data) with very limited permissions - it's likely 
that this user does not have access to the socket file.

  HTH

   Jirka

-Original Message-
From: Henning Sprang 
Sender: django-users@googlegroups.com
Date: Wed, 28 May 2014 11:28:00 
To: 
Reply-To: django-users@googlegroups.com
Subject: Mysql DB local socket access errors with mod_wsgi

Hi,

I'm trying to setup a django production environment with mod_wsgi, and
a local mysql  which I want to connect via the socket file.

Without wsgi the app runs and connects to the database.

When running it via wsgi, I get:

OperationalError

(2002, "Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (13)")

It might be relevant that I'm running the app and the db in Docker
containers, sharing the directory with the socket file in between
them. On the other hand, as running the app manually with runserver
works well, I guess it must be something else.

I tried every imaginable configuration, from the simplest described in
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/
to just about anything described there, the socket file defintely
exists at this path, and I also tried to explicitly allow apache
access with a directory/files directive in apache - no success.

Any ideas?

-- 
Henning Sprang
http://www.sprang.de

-- 
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/CAB10%2BLu%3DJwCgLv46FDpE3-4Tu6b%2B7C15rf1vcEBsmFXB%2B44NCA%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2097542386-1401286725-cardhu_decombobulator_blackberry.rim.net-540712219-%40b1.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Re: How to combine multiple querysets and remove duplicates?

2014-01-09 Thread Jirka Vejrazka
Hi Lewis,

  looks like you already got the answer - using Q() objects helps a lot.
I'll just add two things that might help:

  - it's possible to prepare filters in advance which helps readability and
code structure. I often do something similar to this:

from django.db.models import Q
filters = []
# search for tags
filters.append(tag='sometag')
# handle item title
filters.append(title__icontains='someword')
# only list active users
filters.append(is_active=True)

found = Resources.objects.filter(*filters)

  - you might also want to check out for existing solutions if your case
allows. I've recently switched most of my search functionality to
django-watson and would not go back. There are other solutions avaliable of
course, varying in complexity and capabilities.

  Cheers

 Jirka


On 9 January 2014 13:18, Erik Cederstrand  wrote:

> Den 09/01/2014 kl. 08.29 skrev Rodney Lewis :
>
> > Please help with my question I posted to StackOverflow:
> >
> >
> http://stackoverflow.com/questions/21013973/how-to-combine-multiple-querysets-and-remove-duplicates
>
> If the answer you got there doesn’t solve your problem, then please add a
> comment on SO describing why.
>
> Erik
>
> --
> 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/0D4BD660-FF97-44C2-9541-19CE66636D1B%40cederstrand.dk
> .
> 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/CAFhEBEDJNpdkmQcFcRCDNoznMi_HG1H1Dj9rsCKdTdAr%2BFTXHA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Save the user from one model to the another model

2013-12-03 Thread jirka . vejrazka
You're probably looking for something along the lines of:

thread = Thread.objects.get(id=)
msg = Message.objects.get(id=)

thread.user.add(msg.sender)

Look at add() and remove() methods in documentation (search for related 
managers).

FYI - it's a good practice to name fields that use ManyToMany field in plural, 
i.e. Thread.users would be better than Thread.user

  HTH

Jirka

-Original Message-
From: Aamu Padi 
Sender: django-users@googlegroups.com
Date: Tue, 3 Dec 2013 04:19:55 
To: 
Reply-To: django-users@googlegroups.com
Subject: Save the user from one model to the another model

What I want to do is, whenever I create a new message, I want the *sender *of
the *Message* to be added to the *user *of the *Thread.* How do I do that?


> class Thread(models.Model):
> user = models.ManyToManyField(User)
> is_hidden = models.ManyToManyField(User, related_name='hidden_thread',
> blank=True)
>
> def __unicode__(self):
> return unicode(self.id)
>
> class Message(models.Model):
> thread = models.ForeignKey(Thread)
> sent_date = models.DateTimeField(default=datetime.now)
> sender = models.ForeignKey(User)
> body = models.TextField()
> is_hidden = models.ManyToManyField(User,
> related_name='hidden_message', blank=True)
>
> def __unicode__(self):
> return "%s - %s" % (unicode(self.thread.id), self.body)
>
>

-- 
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/CAHSNPWveL8rqDLenDLayGrtC_RAwQ-Pfp0SYravr7%2BuJzhBhXw%40mail.gmail.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/495305343-1386058174-cardhu_decombobulator_blackberry.rim.net-1176089190-%40b17.c3.bise7.blackberry.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best practice for server-generated downloads?

2013-10-02 Thread Jirka Vejrazka
Hi Thomas,

 I'm doing exactly this - allowing users to download (graphically simple)
XLSx files from my web app, it also needs to be available for download
weeks later.

  As Russell pointed out, you don't need to store data on this if you have
a way of getting the same set of data later, you can always regenerate the
same Excel file. You don't even need to use StringIO for that.

 I'm using the save_virtual_notebook() in openpyxl package to generate the
Excel file straight from database upon each (infrequent) request.

  HTH

Jirka


On Wed, Oct 2, 2013 at 9:36 AM, Russell Keith-Magee  wrote:

>
> On Wed, Oct 2, 2013 at 2:33 PM, DJ-Tom  wrote:
>
>> Hi,
>>
>> this is quite easy to answer - those reports need to be archived - users
>> must be able to download them days or weeks later.
>>
>> So I will create a record in a database for each report that is created
>> so users can access it later - maybe this can be seen as "uploading" a file
>> to the server that acts as a document repository, with the only difference
>> that the file is not uploaded, but produced by the server.
>>
>
> Well, if you need archival, there are two alternatives:
>
> 1. Write the file to disk at the same time it is being generated. There's
> no reason you have to serve the file from where it was generated --
> generate it, write it, and serve it.
>
> 2. Make sure the report will always be generated the same way. An analog
> here -- if you request a page from a web server, it probably isn't saved on
> disk like that (unless it's a genuinely static page) -- the server knows
> how to reproduce the same page every time you request a specific URL. Make
> the reports the same -- if you request /report/September-2013, you generate
> the same report every time.
>
> The second approach depends on whether you have well time-bucketed data,
> but it's certainly possible to do.
>
>>
>> I don't see how I could use the xlsxwriter object in the way it is
>> described here https://docs.djangoproject.**com/en/1.5/howto/outputting-*
>> *pdf/  -
>> how could I pass the httpresponse object to xlsxWriter?
>> (Maybe I have not yet found how this might work - but it is not what I
>> need anyways...)
>>
>
> I haven't used xlsxwriter myself, but the key part of the PDF example is
> that StringIO is an object that adheres to the python File API, but doesn't
> actually involve a file. So, you open a StringIO object, "write" to it,
> then dump the contents as the HTTP response.
>
> So - whatever API endpoint on xlsxwriter lets you pass in a file object --
> pass in a StringIO instance instead.
>
> Yours,
> Russ Magee %-)
>
>
>
> Thomas
>>
>> Am Mittwoch, 2. Oktober 2013 02:11:21 UTC+2 schrieb Russell Keith-Magee:
>>
>>>
>>> On Tue, Oct 1, 2013 at 9:49 PM, DJ-Tom  wrote:
>>>
 Hi,

 I need to create database report downloads in Excel format (via
 xlsxwriter) and I'm wondering if there is any standard or best practice as
 to where those downloads should be located.

 Especially helpful would be if there was a portable way of managing the
 file system location and web request url in a way so that I don't have to
 change settings between the development and production server.

 Is this -> 
 https://docs.djangoproject.**com/en/1.5/topics/files/the
  way to go?

 If they're sever generated, why do they need to hit the file system at
>>> all?
>>>
>>> The following example in the docs:
>>>
>>> https://docs.djangoproject.**com/en/1.5/howto/outputting-**pdf/
>>>
>>> shows how you can stream a report directly to the end user. The example
>>> uses reportlab to produce a PDF, but the same approach will work for a tool
>>> writing to a different format.
>>>
>>> Yours,
>>> Russ Magee %-)
>>>
>>>
>>  --
>> 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/93413618-01d4-4fc0-a4d0-94fa67efe371%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/dj

Re: implement gmail type address adding functionality in django

2013-08-05 Thread jirka . vejrazka
(not on a PC now)

  You're looking for quite common functionality - search you favourite search 
engine for combination of Django, Ajax and "typeahead"

 HTH

Jirka

-Original Message-
From: roopasingh...@gmail.com
Sender: django-users@googlegroups.com
Date: Mon, 5 Aug 2013 00:50:06 
To: 
Reply-To: django-users@googlegroups.com
Subject: implement gmail type address adding functionality in django



I want to implement the functionality available for adding email address in 
gmail in my application.

In gmail,in compose mail if we type the 1st character of the email 
address,it will show the list of suggested email address.The same concept,i 
want to implement in django for contact name.The list of names are saved in 
database,so typing any letter of the name,it should show the list of 
suggested names and from that user can select the name.

I need some post or blog to get an idea to do this.


Cheers!

Roopa 

-- 
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: Getting URL root

2013-07-02 Thread Jirka Vejrazka
> I know them, but I need to programmatically get it in a way that works
everywhere.

Sorry, you can't. You might be able to do in in some circumstances, but not
reliably "everywhere". There is too many unknowns involved if you are out
of the request-response cycle (e.g. named virtual hosts, CNAME aliases in
DNS, ...)

  So you need to have a setting some (in local_settings.py, in a database,
...) that will keep track of what's the root URL for a given
customer/install. That has to be configured manually.

  HTH

Jirka


On Tue, Jul 2, 2013 at 3:02 PM, Larry Martell wrote:

> On Tue, Jul 2, 2013 at 6:46 AM, Mike Dewhirst 
> wrote:
> > On 2/07/2013 4:43pm, Larry Martell wrote:
> >>
> >> On Mon, Jul 1, 2013 at 7:55 PM, Sithembewena Lloyd Dube
> >>  wrote:
> >>>
> >>> It sounds like you want to get the subdomain. Havew a look at the
> >>> urlparse
> >>> module and its usage.
> >>>
> >>>
> >>>
> http://stackoverflow.com/questions/6925825/get-subdomain-from-url-using-python
> >>
> >>
> >>
> >> Perhaps I wasn't clear. I don't know the URL - I'm not trying to parse
> >> it, I need to find out what it is.
> >>
> >>
> >>
> >>> On Tue, Jul 2, 2013 at 2:09 AM, Larry Martell  >
> >>> wrote:
> 
> 
>  I have an app I distribute to clients.
> 
>  When I run the app on my local machine I connect to
> http://127.0.0.1/...
>  When I'm VPN-ed into a client site I connect to the app on their
>  machine with http://xx.xx.xx.xx/...
>  When a client is running locally at their site they connect with
>  http://myappsname.company.com/
> >
> >
> > Do you know the IP address of the client's server running your app??
>
> I know them, but I need to programmatically get it in a way that works
> everywhere.
>
> > Does your client know the URL?
>
> Yes, they know what to use and they type it in or have it bookmarked.
>
> > In any case, there must be a lookup somewhere - either in the internal
> DNS,
> > an external DNS or in all the users' hosts files.
>
> Yes, it's in their local DNS but I don't have a way of generically
> knowing what to look for. It has different names at different clients.
> What I think I'll do is put something in the settings file that I can
> pick up. This will become part of the installation procedure. I don't
> love it, but I can't think of any other way.
>
> > I'm losing concentration here. Past my bedtime.
>
> I appreciate the help. Go get some sleep.
>
>
> 
>  I need to get that initial part of the URL from the python side. Is
>  there some way to do that? (I may be using the wrong terminology here
>  when I say 'url root'.)
> 
>  --
>  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.
> 
> 
> >>>
> >>>
> >>>
> >>> --
> >>> Regards,
> >>> Sithu Lloyd Dube
> >>>
> >>> --
> >>> 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 optio

Re: Getting URL root

2013-07-02 Thread Jirka Vejrazka
If you need it when you already have a request object, (i.e. not during
initial setup/install), check out request.META options in the documentation.

  HTH

Jirka


On Tue, Jul 2, 2013 at 8:43 AM, Larry Martell wrote:

> On Mon, Jul 1, 2013 at 7:55 PM, Sithembewena Lloyd Dube
>  wrote:
> > It sounds like you want to get the subdomain. Havew a look at the
> urlparse
> > module and its usage.
> >
> >
> http://stackoverflow.com/questions/6925825/get-subdomain-from-url-using-python
>
>
> Perhaps I wasn't clear. I don't know the URL - I'm not trying to parse
> it, I need to find out what it is.
>
>
>
> > On Tue, Jul 2, 2013 at 2:09 AM, Larry Martell 
> > wrote:
> >>
> >> I have an app I distribute to clients.
> >>
> >> When I run the app on my local machine I connect to http://127.0.0.1/.
> ..
> >> When I'm VPN-ed into a client site I connect to the app on their
> >> machine with http://xx.xx.xx.xx/...
> >> When a client is running locally at their site they connect with
> >> http://myappsname.company.com/
> >>
> >> I need to get that initial part of the URL from the python side. Is
> >> there some way to do that? (I may be using the wrong terminology here
> >> when I say 'url root'.)
> >>
> >> --
> >> 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.
> >>
> >>
> >
> >
> >
> > --
> > Regards,
> > Sithu Lloyd Dube
> >
> > --
> > 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: Model Error

2013-06-18 Thread jirka . vejrazka
Hi Nigel,

  You have a spelling error in the word "unicode" in the TextFile method.

  Cheers

Jirka

-Original Message-
From: Nigel Legg 
Sender: django-users@googlegroups.com
Date: Wed, 19 Jun 2013 06:51:21 
To: 
Reply-To: django-users@googlegroups.com
Subject: Model Error

I have been working through the tutorial, "Writing your first Django app,
part 1", at https://docs.djangoproject.com/en/1.5/intro/tutorial01/. I have
the following model code:

from django.db import models
import datetime
from django.utils import timezone

class TextFile(models.Model):
tfile = models.CharField(max_length = 50)
filetype = models.CharField(max_length = 50)
up_date = models.DateTimeField('date_uploaded')

def __unicde__(self):
return self.tfile

def was_uploaded_recently(self):
return self.up_date>= timezone.now() - datetme.timedelta(days=1)

class Bitext_upd(models.Model):
tFile = models.ForeignKey(TextFile)
bitext_file = models.CharField(max_length = 50)
Bit_up_date = models.DateTimeField('date_analysed')

def __unicode__(self):
return self.bitext_file

However in the shell I am still getting:
>>> from apilink.models import TextFile
>>> TextFile.object.all()
[, ]

... when there are two files added.
In the admin interface, I have a list of two "TextFile objects" (see
image), if I edit them I can see the details.

I am a bit lost as to where the error is, can anyone help?
Many thanks.

Regards,
Nigel Legg
07914 740972
http://twitter.com/nigellegg
http://uk.linkedin.com/in/nigellegg

-- 
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: Settings object has no attribute 'ROOT_URLCONF' while deploying using apache and mod_wsgi

2013-03-17 Thread jirka . vejrazka
I'd look at how you reference your settings during imports. The error message 
spells "Settings" with uppercase "S" which feels incorrect.

   HTH

 Jirka
-Original Message-
From: Navid Shaikh 
Sender: django-users@googlegroups.com
Date: Sun, 17 Mar 2013 02:20:29 
To: 
Reply-To: django-users@googlegroups.com
Subject: Settings object has no attribute 'ROOT_URLCONF'  while deploying
 using apache and mod_wsgi

Hi folks,

(Before posting I searched in archive and the question is kind of similar 
to thread [1].)

I am getting error:
AttributeError: 'Settings' object has no attribute 'ROOT_URLCONF'

I am using 
a) Django version 1.3.2.
b) Apache
c) mod_wsgi
 
I followed standard Django docs [2] to implement configurations.

Below are my some config file excerpts:
(I renamed my actual site name with mysite)

mysite-httpd.conf (filename)
-

WSGIScriptAlias / "/usr/share/slate/apache/mysite.wsgi"

-

mysite.wsgi   (filename)
--
#!/usr/bin/python
#
# For Apache mod_wsgi.
import os
import sys

path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.append(path)   # /usr/share/slate/
sys.path.append(os.path.dirname(path))  # /usr/share/

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
--

After reading thread[1] , I think that there is problem in setting 
'DJANGO_SETTINGS_MODULE', as I have 'ROOT_URLCONF variable
set in settings.py.


Please point out where I am doing it wrong.

Links:
[1] http://www.mail-archive.com/django-users@googlegroups.com/msg28764.html
[2] https://docs.djangoproject.com/en/1.3/howto/deployment/modwsgi/


Thanks and Regards,
Navid Shaikh.

-- 
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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Call Class based view from another class based view

2013-02-19 Thread Jirka Vejrazka
You have

ShowAppsView.as_view()(self.request)

at the end of the code you pasted below. That means that you get result of
the ShowAppsView which gets immediatelly discarded ("forgotten") because
you don't do anything with it.

You probably want

return ShowAppsView.as_view()(self.request)

but that's just a wild guess, I have not read your code thoroughly nor I
use CBV's myself.

  HTH

Jirka

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Is there an easy way to popup forms?

2013-02-13 Thread jirka . vejrazka
Probably the easiest way is to use a JS/CSS framework that has a good support 
for popups and forms. There are a lot out there. I have personal experience 
with Bootstrap (one of the most popular these days) - check its documentation 
(look for both "popup" and "modal"), also search for available bootstrap 
plugins - plenty exist.

  If you wanted to stick with jQuery, check out jQuery UI - a set of reusable 
components that might suit your needs.

  HTH

Jirka

-Original Message-
From: frocco 
Sender: django-users@googlegroups.com
Date: Wed, 13 Feb 2013 11:35:36 
To: 
Reply-To: django-users@googlegroups.com
Cc: 
Subject: Re: Is there an easy way to popup forms?

Thanks Tom,

Do you know how I would have a form display using this?


On Wednesday, February 13, 2013 11:41:59 AM UTC-5, Tom Evans wrote:
>
> On Wed, Feb 13, 2013 at 4:12 PM, frocco > 
> wrote: 
> > I have a form I want to popup and am having trouble getting this to 
> work. 
> > This is not in the admin page. 
> > 
> > Can someone give me an example? 
> > 
> > Thanks 
> > 
>
> An easy way to do a pop up form is to use a jqueryui dialog¹ 
>
> http://api.jqueryui.com/dialog/ 
>
> Cheers 
>
> Tom 
>
> ¹ Other dialogs are available, consult your local google 
>

-- 
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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: F function?

2013-01-31 Thread Jirka Vejrazka
Pro tip:  if you find yourself in a similar situation again, try searching
Django code for "def F(" and "class F(" - that should narrow your search a
bit :)

  Cheers

Jirka


On Fri, Feb 1, 2013 at 6:14 AM, Chad Vernon  wrote:

> Nevermind, found it!  Was having a hard time searching for "F" :)
>
> https://docs.djangoproject.com/en/1.4/topics/db/queries/#query-expressions
>
>
> On Thursday, January 31, 2013 9:10:39 PM UTC-8, Chad Vernon wrote:
>>
>> I was looking at this snippet:
>>
>> http://djangosnippets.org/**snippets/1560/#comments
>>
>> And on this line:
>> ReportField.objects.filter(**order__range=range).update(**
>> order=F('order')+shift)
>>
>> What is the F in F('order')?
>>
>> Thanks!
>> Chad
>>
>  --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Relations to unknown models?

2013-01-23 Thread jirka . vejrazka
Hi galgal,

   You might want to take a look at django.contrib.comments (either use it or 
learn from it) and/or GenericForeignKey.

  HTH

Jirka

-Original Message-
From: galgal 
Sender: django-users@googlegroups.com
Date: Wed, 23 Jan 2013 14:48:55 
To: 
Reply-To: django-users@googlegroups.com
Subject: Relations to unknown models?

Hi.
I'm looking for a solution to make site-wide comments that can be connected 
with different models via FK.
I want to make 1 global model Comments. I want to make a relation to 
Articles, Relations and Solutions models. I the future I plan to add 
additional models. Now, Comments model should allow me to make relations to 
any of that models via FK. What is important, I need to have 1 and only 1 
Comments model, and it won't be abstract model.
On site I want to display stats showing how many comments were added to 
each model.

Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/AhXGBGXPu_oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ajax

2012-12-19 Thread jirka . vejrazka
Yes
-Original Message-
From: Randa Hisham 
Sender: django-users@googlegroups.com
Date: Wed, 19 Dec 2012 13:11:35 
To: 
Reply-To: django-users@googlegroups.com
Subject: ajax

hey,
if i wana use ajax in my django project
could i use jquery or dajax liberary

-- 
Randa Hesham
Software Developer

Twitter:@ro0oraa 
FaceBook:Randa Hisham 

ٍ

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Messages Framework

2012-12-09 Thread jirka . vejrazka
You have not posted any code so it's difficult to say what you might be 
missing. I can only confirm that the messaging framework works very well 
outside of admin, requiring only a few lines of code in views (typically) and a 
base template.

  Cheers

JirkA
-Original Message-
From: Andreas Pritschet 
Sender: django-users@googlegroups.com
Date: Sun, 09 Dec 2012 14:44:31 
To: 
Reply-To: django-users@googlegroups.com
Subject: Messages Framework

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi there,
for a little project of mine I wanted to use the Message middleware,
but the documentation appears to lack some crucial information.

The message framework is working very well on the admin site. On the
admin site also the messages generated in non-admin views are shown.
So good so far.

But following the documentation and the base.html template of the
admin site the messages are not rendered to non-admin views.

As the framework is working on the admin site I would assume that it
is enabled and configured correctly.

So I would appreciate any suggestions.

Thanks in advance
Andi
- -- 
Andreas Pritschet
Phone:   +49 151 11728439
Homepage:http://www.pritschet.me
GPG Pub Key: http://goo.gl/4mOsM
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQxJW/AAoJEMMdfJo8Sd0MfTQH/jqcxc0gnyvHBqMrQINPNDwH
MoDqixUGb6Q4C4nnQckJdvVO6DjOH1dYviAeJ4PrOFcaNnftN7EWKhttnbA6SBDW
F/M7gIK4ohnk4jJ3SR7qN28u+zz26075uOPkHNhy1OwK5LP+h8IWpzkVKEcJbcGA
/OinF41Xwyh9d6FMvDvm9+bNCqE3If3m25Pb+477hStQ3ZgjZBgjZd6lEgOeoUKt
kTe+SnCtQ2HPrpby5tyVl/fffOxxvn8zMXaRBzhWc5X52qe0PD4sZWQUhR3IjVN5
KGTYCeZ9TYLfr4/0PP5BxwYZvWv1TrwbkU9vFZqFjoZPeAGh8dAd7Sk/k7dsyns=
=0wKy
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 504 Gateway Timeout

2012-11-29 Thread Jirka Vejrazka
> I'm just facing a problem with little longer runnig SQL select command,
and DJago framework returns a "504 Gateway Timeout" after aprox 10 seconds.
My sql command is executed on Oracle SQL database through
"django.db.backends.oracle" driver.

You'd have to change multiple timeouts to make this work. There are several
approaches in similar situations, pick what suits your situation (which you
have not described in detail).

  - calculate data *before* user requests it and keep the calculated copy
  - caching of any data that takes long to compute (retrieve) - can and
should be combined with above
  - using asyncronous queries, typically achived via celery (django-celery)
and some AJAX calls

  You need to provide more details about your long-running query if you
need people to help you further.

  Cheers

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Confused about model save/update

2012-11-26 Thread jirka . vejrazka
I may se the formating incorrectly (on a phone) but it looks like your save() 
method does nothing if self.pk already exists (i.e. model is not new)

  HTH

Jirka

-Original Message-
From: Lachlan Musicman 
Sender: django-users@googlegroups.com
Date: Tue, 27 Nov 2012 11:07:42 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Confused about model save/update

On Tue, Nov 27, 2012 at 11:00 AM,   wrote:
> Hi there,
>
>   a long shot since you have not provided your save() method. Are you calling 
> super() there?

Jirka, yes I am, but it's only been modified to set the slug:

def save(self, *args, **kwargs):
if not self.pk:
super(Applicant, self).save(*args, **kwargs) # Call the
first save() method to get pk
self.slug = slugify(str(self))
super(Applicant, self).save(*args, **kwargs) # Call the
"real" save() method.


Cheers
L.

>
>   Cheers
>
>  Jirka
>
> -Original Message-
> From: Lachlan Musicman 
> Sender: django-users@googlegroups.com
> Date: Tue, 27 Nov 2012 10:14:03
> To: 
> Reply-To: django-users@googlegroups.com
> Subject: Confused about model save/update
>
> Hi
>
> Sorry about the last email - fat fingered it.
>
> For some reason I can't get the model.save() method to actually save
> the data I want it to. I have tried using both save() and
> save(force_update=True) without any joy.
>
> I have the following model:
>
> class Applicant(model.Models):
> ...
> successful = NullBooleanField()
> ...
>
> def mark_successful(self):
>self.successful = 0
>self.last_change_by = request.user
>#self.save(force_update=True)
>self.save()
>
> def mark_successful(self):
>self.successful = 1
>self.last_change_by = request.user
>self.save(force_update=True)
>self.save()
>
>
> I call these functions from the admin interface, via admin.py:
>
> class ApplicantAdmin(admin.ModelAdmin):
> ...
> actions = ['mark_successful', 'mark_unsuccessful']
> ...
>
> def mark_unsuccessful(self, request, queryset):
> '''Marks a group of applicants as unsuccessful'''
> rows_updated = 0
> for applicant in queryset:
> applicant.mark_unsuccessful(request)
> rows_updated += 1
>
> if rows_updated == 1:
> message_bit = "1 applicant was"
> else:
> message_bit = "%s applicants were" % rows_updated
> self.message_user(request, "%s marked unsuccessful." % message_bit)
>
>
>
> Can anyone see what's going wrong?
>
> cheers
> L.
>
> --
> ...we look at the present day through a rear-view mirror. This is
> something Marshall McLuhan said back in the Sixties, when the world
> was in the grip of authentic-seeming future narratives. He said, “We
> look at the present through a rear-view mirror. We march backwards
> into the future.”
>
> http://www.warrenellis.com/?p=14314
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>



--
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Confused about model save/update

2012-11-26 Thread jirka . vejrazka
Hi there, 

  a long shot since you have not provided your save() method. Are you calling 
super() there?

  Cheers

 Jirka

-Original Message-
From: Lachlan Musicman 
Sender: django-users@googlegroups.com
Date: Tue, 27 Nov 2012 10:14:03 
To: 
Reply-To: django-users@googlegroups.com
Subject: Confused about model save/update

Hi

Sorry about the last email - fat fingered it.

For some reason I can't get the model.save() method to actually save
the data I want it to. I have tried using both save() and
save(force_update=True) without any joy.

I have the following model:

class Applicant(model.Models):
...
successful = NullBooleanField()
...

def mark_successful(self):
   self.successful = 0
   self.last_change_by = request.user
   #self.save(force_update=True)
   self.save()

def mark_successful(self):
   self.successful = 1
   self.last_change_by = request.user
   self.save(force_update=True)
   self.save()


I call these functions from the admin interface, via admin.py:

class ApplicantAdmin(admin.ModelAdmin):
...
actions = ['mark_successful', 'mark_unsuccessful']
...

def mark_unsuccessful(self, request, queryset):
'''Marks a group of applicants as unsuccessful'''
rows_updated = 0
for applicant in queryset:
applicant.mark_unsuccessful(request)
rows_updated += 1

if rows_updated == 1:
message_bit = "1 applicant was"
else:
message_bit = "%s applicants were" % rows_updated
self.message_user(request, "%s marked unsuccessful." % message_bit)



Can anyone see what's going wrong?

cheers
L.

--
...we look at the present day through a rear-view mirror. This is
something Marshall McLuhan said back in the Sixties, when the world
was in the grip of authentic-seeming future narratives. He said, “We
look at the present through a rear-view mirror. We march backwards
into the future.”

http://www.warrenellis.com/?p=14314

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Apache] Trouble deploying my web app with mod_python

2012-11-14 Thread jirka . vejrazka
Hi Isaam!

  Do you have a specific reason for using mod_python?

  This module is old and deprecated. The recommended way is to use other 
modules, many people use mod_wsgi which is really simple to deploy and use.

  HTH

Jirka
-Original Message-
From: Issam Outassourt 
Sender: django-users@googlegroups.com
Date: Wed, 14 Nov 2012 11:45:40 
To: 
Reply-To: django-users@googlegroups.com
Subject: [Apache] Trouble deploying my web app with mod_python

Hi all,
I've got a problem deploying my new app that i designed on my personal
server that i run on my computer and i would like some help to deal with
this.

Here's the problem. You can see down here what happens when I try to
visualize my home page :

ServerName: '127.0.1.1'
DocumentRoot:   '/var/www'

URI:'/'
Location:   '/'
Directory:  None
Filename:   '/var/www/'
PathInfo:   ''

I get this due to the PythonDebug On that's on my apache2.conf file, from
which i've got these lines which normally set the server to append the
django developped app (from what i understood) :

LoadModule python_module /usr/lib/apache2/modules/mod_python.so


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/issam/Workspace/Django/DjangoCode/',
'/home/issam/Workspace/Django/DjangoCode/mysite/'] + sys.path"


to help you out there, my settings.py file lives in
/home/issam/Workspace/Django/DjangoCode/mysite/mysite

I wish i could get help from you guys and that you've got sufficient
details to help me out with this.

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: update the part 1 of Django Tutorial perhaps

2012-11-13 Thread Jirka Vejrazka
>The reason is that I should add in the table "django_site" of
my database : domain and name, I did it : insert into django_site (domain,
name) values ("ncegcolnx270", "mysite");   And it works.   But this point,
the Tutorial 1 doesn't say.. How can I perhaps help update the Tutorial
1 of Django?

Hi there,

  this table should have been automatically created once you ran the
"manage.py syncdb" command. It is part of the 'django.contrib.sites'
application which is enabled by default in your settings.py.

  Maybe you accidentally commented it out of your settings.py?

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Forbidden (403)

2012-11-13 Thread Jirka Vejrazka
I may be wrong, but I don't see you using {% csrf_token %} anywhere. You're
posting random snippets from your code that only loosely relate - I have
trouble finding full code for the view and all components of HTML templates
causing you trouble.

So I'll just post a few tips:

  - before submitting the form in your browser, show the rendered HTML for
the page "right click, then View Source (or similar) - does it contain the
csrf_token parameter? (Just search for "csrf_token").
  - you can easily verify that your CSRF token is posted with the form by
putting "print request" on the first line of the view that receives the
form submission - then you should see "csrf_token" among the posted
paramaters.
  - better version is to install a module to the browser you use for
debugging to view what's actually being sent. For Firefox, you could use
the excellent Firebug.



On Tue, Nov 13, 2012 at 9:05 AM, Nebros  wrote:

> kundendaten-
> {% include "header.html" %}
> Kundendaten
> {% include "header2.html" %}
> Portal
> Ausgabe Kundendaten
> {% include "sql.html" %}
> 
> NameE-Mail
> '.$result['t_name'].''.$result['t_mail'].'
> 
> {% include "footer.html" %}
> ---
>
> (header , header2 and footer are only for the html tags !doctype... blabla)
>
> Forbidden (403)-
>
> CSRF verification failed. Request aborted.
> Help
>
> Reason given for failure:
>
> CSRF cookie not set.
>
>
> In general, this can occur when there is a genuine Cross Site Request
> Forgery, or when *Django's CSRF 
> mechanism*has
>  not been used correctly. For POST forms, you need to ensure:
>
>- Your browser is accepting cookies.
>- The view function uses 
> *RequestContext*for
>  the template, instead of
>Context.
>- In the template, there is a {% csrf_token %} template tag inside
>each POST form that targets an internal URL.
>- If you are not using CsrfViewMiddleware, then you must use
>csrf_protect on any views that use the csrf_token template tag, as
>well as those that accept the POST data.
>
> You're seeing the help section of this page because you have DEBUG = Truein 
> your Django settings file. Change that to
> False, and only the initial error message will be displayed.
>
> You can customize this page using the CSRF_FAILURE_VIEW setting.
>
> -
>
>
> Am Montag, 12. November 2012 15:00:48 UTC+1 schrieb Nebros:
>
>> I know this is an old problem with many answers... but no one helps me. ^^
>> what i have:
>>
>> Settings--**--
>> MIDDLEWARE_CLASSES = (
>> 'django.middleware.csrf.**CsrfViewMiddleware',
>> 'django.middleware.common.**CommonMiddleware',
>> 'django.contrib.sessions.**middleware.SessionMiddleware',
>> 'django.contrib.auth.**middleware.**AuthenticationMiddleware',
>> 'django.contrib.messages.**middleware.MessageMiddleware',
>> # Uncomment the next line for simple clickjacking protection:
>> # 'django.middleware.**clickjacking.**XFrameOptionsMiddleware',
>> )
>> --**-
>>
>> urls--**
>> from django.conf.urls import patterns
>> from klasse.views import portal, kundendaten
>> urlpatterns = patterns('',
>> (r'^portal/$', portal),
>> (r'^kundendaten/$', kundendaten),
>> )
>> --**-
>>
>> views-**--
>> from django.shortcuts import render_to_response
>> from django.core.context_processors import csrf
>> from django.views.decorators.csrf import csrf_protect
>> import datetime
>> import pyodbc
>> @csrf_protect
>> def portal(request):
>> now = datetime.datetime.now()
>> return render_to_response('portal.**html', {'current_date': now})
>> --**--
>>
>> portal.html---**---
>> 
>> {% csrf_token %}
>> 
>> Anfrage
>> Bitte Kundennamen eingeben
>> 
>> 
>> 
>> 
>> 
>> > href="kundendaten">
>> 
>> 
>> --**--
>>
>> I tryed a lot of variants to fix my "post" problem, but without success.
>> can anybody help me? ^^
>> thx
>> *pls ignore my englisch fails
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/K1p4e5lY1B4J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.

Re: How to build this query

2012-11-09 Thread Jirka Vejrazka
paris_discounts = Discount.objects.filter(brand__city__name='Paris')  ?

  Note that these are always *double* underscores and I had to make a guess
that your City has an attribute "name".

  HTH

Jirka



On Fri, Nov 9, 2012 at 9:12 AM, ozgur yilmaz  wrote:

> Hi all,
>
> I hope i can explain my query problem well. Think you have 3 classes:
>
> class City( models.Model ):
> ...
> ...
>
> class Brand( models.Model ):
> ...
> ...
>
> class Shop( models.Model ):
>brand = models.ForeignKey( Brand )
>city = models.ForeignKey( City )
> ...
> ...
>
> class Discount( models.Model ):
>brand = models.ForeignKey( Brand )
> ...
> ...
>
> Think a Shop sell products of a single Brand. I have lots of Discount
> records. But i'm interested in Discounts at Shops in Paris. Is there
> any?
>
> Can you help me?
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Posting from HTTP to HTTPS on same domain results in CSRF failure

2012-10-31 Thread jirka . vejrazka
Hi there,

  I'm sorry I don't have a solution for you. However I have a 
warning/recommendation.

  Even if you don't serve the full site over https, you should make sure that 
forms that submit data over HTTPS are served over HTTPS. Otherwise you make it 
difficult for users to verify that their data (credentials etc.) will be 
submitted over a secure channel (and to verify certs prior to submitting form 
data etc.)

  On the plus side, if you serve forms over HTTPS (not only submit responses), 
it'll automatically solve your CSRF token problem.

  HTH

Jirka
-Original Message-
From: Kevin 
Sender: django-users@googlegroups.com
Date: Wed, 31 Oct 2012 01:21:33 
To: 
Reply-To: django-users@googlegroups.com
Subject: Posting from HTTP to HTTPS on same domain results in CSRF failure

Hello everyone,

  I am in the process of deploying a Django app which works both on HTTP 
and HTTPS connections, and require that some specific forms only submit via 
HTTPS.  I want the transition process over to HTTPS to be seamless for the 
end-user.  I am implementing this on a site-wide login form.

  Are there any workarounds for this or any middleware I can create to 
allow same domain HTTP to HTTPS transition without worrying about CSRF 
tokens being declined?  To ensure it wasn't a stale cookie issue, I just 
cleared my cookies before posting this.

  The csrf cookie is allowed for any connection, according to Firefox's 
cookie viewer, so shouldn't this mean that the cookie will be accepted over 
HTTPS?

Thanks in advance.

Django version is 1.4 branch.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/AR9a9jddb_QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Easy way to make all form fields read only?

2012-10-30 Thread Jirka Vejrazka
On the UI side, you can set the "readonly" property on form fields.
This will prevent the field from being edited in a browser (I think so
- done that only once on a small internal project).

However, we warned - if *some* of your users can edit and submit the
form, you should also introduce server-side check testing if user is
allowed to edit fields. Making form fields read only won't prevent
anyone from actually submitting changed data (as it's just a
client-side control which can be easily worked around)

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Database setup

2012-10-30 Thread Jirka Vejrazka
Hi Markus,

  I don't think you mentioned what OS you use on your machine with Django.

  If it helps, I had this in my settings.py when connecting to MS SQL
database from Linux

'mssql': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'mdb',
'USER': USERNAME,
'PASSWORD': PASSWORD,
'OPTIONS': {
'driver': 'FreeTDS',
'encoding': 'latin1',  # see django-pyodbc issue #24
# UAPM uses SQL_Latin1_General_CP1_CI_AS
'dsn': 'mssql', # see /etc/odbc.ini
},

  There was some extra client libraries installed and a configuration
had to be do be done for system ODBC. Can't help you there, memory
failing :)

  HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Connecting to external databases from Views.py

2012-10-24 Thread jirka . vejrazka
Hi Gregg,

  I've done something similar in the past - had several external databases (MS 
SQL and Oracle) attached to my Django project. These were backends of 
enterprise tools, hundreds of tables each.

  I used the "manage.py inspectdb" command to reverse engineer each "external" 
DB, manually polished models I needed (inspectdb is great but can't always 
perfectly guess foreign key relations or field types). Then I set 
"managed=False" for each model of those external DB's to make sure Django won't 
try to modify them.

  As for writing to those DB's, I had set up my DB routing so that these DB's 
were available only for read, not for wrining. I made sure that my code never 
attempted to write to those DB's. I also never used Django admin for this 
project. 

 YMMV

   Jirka

P.S. You can override the save() of your models in"external DB"  method to do 
nothing
-Original Message-
From: Gregg Branquinho 
Sender: django-users@googlegroups.com
Date: Wed, 24 Oct 2012 21:43:01 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Connecting to external databases from Views.py

Hi Russel,

First off thank you for the suggestion, I am going to give it a whirl and 
see how it works out.. I have a couple of concerns about the pricing 
database it the
* it is on  mssql and the data is spread accross 3 database on the same 
server so the query would have to be cross database.. which also pose's a 
problem.
* the db's have like 300 table each..

Before you answer I wat thinking of accessing the database on the view 
*yuck* via pyodbc.

after your answer I have a couple more questions ?

Is is possible to override how a model is loaded from the database with raw 
sql and then overide the save and update methods to do nothing ? I have 
look at ovveriding __init__ but all recommendation are against it, but 
since I am not saving would it make any difference ?

Thanks very much for you previous answer as I feel it is pushing me towards 
a better solution

Kind regards
Gregg










On Thursday, 25 October 2012 02:49:49 UTC+2, Russell Keith-Magee wrote:
>
> Hi Gregg,
>
> Is there any reason you can't treat this as a mutliple-database 
> configuration?
>
> https://docs.djangoproject.com/en/dev/topics/db/multi-db/
>
> Django allows you to specify more than one database, and then direct 
> queries at specific databases. So, you have your "main" django database for 
> your own application, but you set up a connection to your "other" database 
> to access the pricing report.
>
> You'll need to write some Django model wrappers for the data in the 
> 'other' database -- inspectdb can help with that -- but once you've done 
> that, you'll be able to query the 'other' database as if it were a set of 
> normal Django models.
>
> Yours,
> Russ Magee %-)
>
> On Thu, Oct 25, 2012 at 4:43 AM, Gregg Branquinho 
> 
> > wrote:
>
>> Hi guys I am new to django and have built my first application that is 
>> being used to track and compare pricelists from vendors and it is working 
>> awesomly, I have had a request for a new feature and I am alittle boggled 
>> at to how I am going to do it..
>>
>> Basically I wasnt to create a view which returns read only data(a report) 
>> from an external database which is not the django database. I dont want to 
>> copy the data to the django database and use a models as then concurreny 
>> become an issue
>>
>> What would you guys recommened..
>>
>> I was thinking on implenting a odbc connection from the views.py method 
>> called for my url ? but database call from the view , sound a abit dodgy.
>>
>> Any ideas ?
>>
>>
>>
>>
>>
>> Email Disclaimer  | Quote 
>> Disclaimer  | All 
>> business is undertaken subject to our General Trading Conditions, a copy of 
>> which is available on request and on our website 
>> www.freightman.com 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/ewQAAfxJlJ4J.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
-- 
Email Disclaimer  | Quote 
Disclaimer  | All 
business is undertaken subject to our General Trading Conditions, a copy of 
which is available on request and on our website 
www.freightman.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/rboXgSmzH3cJ

Re: I am in trouble

2012-09-26 Thread Jirka Vejrazka
Others have pointed at the indentation error, so I'll just add that
mod_python is no longer supported and recommended - you should use
mod_wsgi or similar supported module if possible at all.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Beginner problem linking pages from homepage?

2012-09-23 Thread jirka . vejrazka
Hi Vincent,

  Django is telling you what the problem is - none of strings in urls.py 
matches the requested URL. All lines in your file say that the regular 
expression fas nothing before the "foo" (the "^" character says that). However 
the URL you are trying has "homepage/" before "foo". Hence it does not match.

  You need to correct this before you can proceed furter. Either remove the 
"homepage/" from your request (may be in a link on your first page) or change 
the urls.py accordingly.

 HTH

Jirka

-Original Message-
From: Vincent Fulco 
Sender: django-users@googlegroups.com
Date: Sun, 23 Sep 2012 12:47:39 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: Beginner problem linking pages from homepage?

Thank you for the timely advice.  Before I move my "base/homepage" site to 
its own app dir, thought I would give it another pass using your changes.  
Verified 'mysite.urls' in settings.py, added 'mysite' to the urlpatterns 
arg and put quotes around the hello func.  I have had debugging from the 
outset of installation.  views.py in the mysite/mysite dir is simply:

def hello(request):
return HttpResponse('Hello World!')

The 404 error which comes up is:

Page not found (404)  Request Method: GET  Request URL: 
http://192.168.1.126:8000/homepage/foo1  
 
Using the URLconf defined in mysite.urls, Django tried these URL patterns, 
in this order: 

   1. ^foo1$ 
   2. ^foo2$ 
   3. ^foo3$ 
   4. ^foo4$ 

The current URL, homepage/foo1, didn't match any of these.
 
You're seeing this error because you have DEBUG = True in your Django 
settings file. Change that to False, and Django will display a standard 404 
page.  Could be a permissions thing or some subtle backslashes nuance I 
haven't picked up on yet?
Thanks again.  V. 


On Saturday, September 22, 2012 7:39:36 PM UTC-5, Sam Lai wrote:
>
>
>
> I just created a toy project with that urls.py and it worked fine. 
>
> > I am not even sure if philosophically this is considered a good practice 
> of 
> > django.  Thanks in advance for your assistance.  V. 
>
> Generally you would not create a views.py in your project directory 
> (mysite/mysite is your project directory). You would usually create an 
> app (mysite/manage.py startapp appname), create your views, app-level 
> URLs, models etc. in there, and then reference them in your project 
> urls.py by including your app's urls.py. 
>
> Also, generally you would reference the view using a string, instead 
> of the actual view function itself. This saves you from having to 
> import every view, and avoid clashes in larger projects where you may 
> have view functions with the same name in different apps. In the 
> second urls.py you posted, the first parameter to patterns, where you 
> have 'homepage' specified, is used to shorten these view function 
> strings - that parameter is appended to your url definitions, i.e. you 
> could use the following urls.py instead - 
>
> urlpatterns = patterns('mysite', 
>url(r'^foo1$', 'hello'), 
>url(r'^foo2$', 'hello'), 
>url(r'^foo3$', 'hello'), 
>url(r'^foo4$', 'hello'), 
> ) 
>
> ... and Django will append 'mysite' to all the view function strings, 
> turning them into 'mysite.hello'. See 
> https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix 
>
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/django-users/-/ojFywQSzpYsJ. 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > django-users...@googlegroups.com . 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/_y5eEwalYc8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: java script alert from view after sucessfull opreation

2012-09-17 Thread Jirka Vejrazka
> how to use java script alert from view after sucessfull opreation in view

Simplest way is to set some context variable (a.k.a. "flag") in the
view (e.g. "operation_successful = True") and have a piece of JS code
in your template that runs only when this flag is set, e.g:

  {% if operation_successful %}

  alert("operation was successful")
   
 {% endif %}

  There is a lot more ways to do this, at some later point you will
probably want to read about AJAX calls.

  HTH

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django.contrib.markup deprecated in 1.5 - what's the alternative?

2012-09-15 Thread Jirka Vejrazka
Hi Phil,

  incidentally, I was looking at this just recently. The
contrib.markup was deprecated mainly due to security issues with 3rd
party libraries that could not be fixed in Django itself and were
compromising its security. For more, read
https://code.djangoproject.com/ticket/18054

  Can't tell you what the replacement is. I rolled up my own markup
filter, but I only have a handful of trusted users for my web app so I
don't have to be too concerned with trusting their inputs.

  You can copy the markup filter from 1.4 - just be aware of the
security consequences.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sending data with HttpResponseRedirect

2012-09-12 Thread Jirka Vejrazka
If you have sessions enabled, you can use the built-in messages
framework (look in contrib) to display a message on the "next" page.
Alternatively, you can save (semi-) arbitrary data in the user session
and retrieve it in the view that displays the "success" page.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django development running on 127.0.0.1:8000 not accessible from same machine

2012-08-27 Thread jirka . vejrazka
Hi nav,

  A long shot - do you happen to have a proxy defined in your browser? It is 
possible to define a proxy for *all* request (including localhost) - this would 
have the same effect.

  HTH

Jirka
-Original Message-
From: nav 
Sender: django-users@googlegroups.com
Date: Mon, 27 Aug 2012 21:00:12 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Django development running on 127.0.0.1:8000 not accessible from
 same machine

Hi Anton,

Thank you for your email.

I have tried all of the methods you had suggested but to no avail.

In all my years of Django development the localhost address has worked
flawlessly. I have also tried with multiple Django projects and other
Linux installations and the problem persists. This makes me think this
is a DNS issue that may be due to a network related problem. In which
case I will have to investigate. I will post once I find a work around
or solution.

Cheers,
nav

On Aug 27, 5:36 pm, Anton Baklanov  wrote:
> oh, i misunderstood your question.
>
> try to type url with schema into browser's address bar. i mean, use 
> 'http://localhost:8000/'instead of 'localhost:8000'.
> also it's possible that some browser extension does this, try disabling
> them all.
>
>
>
>
>
>
>
>
>
> On Mon, Aug 27, 2012 at 10:53 AM, nav  wrote:
> > Dear Folks,
>
> > I am running my django development server on 127.0.0.1:8000 and accessing
> > this address from my web browser on the same machine. In the past few days
> > I have found thet the web browsers keep prepending the address with "www."
> > when using the above address. 127.0.0.1 without the prot number works fine
> > but the django development server requires a port number.
>
> > I have not encountered this problem before and am puzzled by what is
> > happening. I am working on a Kubuntu 12.04 linux box and my /etc/hosts/
> > file is below if that helps:
>
> > 
> > 127.0.0.1       localhost
> > 127.0.1.1       
>
> > # The following lines are desirable for IPv6 capable hosts
> > ::1     ip6-localhost ip6-loopback
> > fe00::0 ip6-localnet
> > ff00::0 ip6-mcastprefix
> > ff02::1 ip6-allnodes
> > ff02::2 ip6-allrouters
> > 
>
> > TIA
> > Cheers,
> > nav
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/django-users/-/EZzlz6iQOGoJ.> To post to 
> >this group, send email todjango-us...@googlegroups.com.
> > To unsubscribe from this group, send email 
> > to>django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Regards,
> Anton Baklanov

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: What is the easy way to install DJango?

2012-08-15 Thread Jirka Vejrazka
It's easy to install Django on a Windows machine to test it out and
develop code. Most of this is covered here:
https://docs.djangoproject.com/en/1.4/topics/install/

In a nutshell, you need:
- Python 2.x (2.7) - install it if you already have not done so
- Django (start with a stable release e.g. 1.4, download link on the
main Django page)
- to install the downloaded Django package (covered in docs)
- to find your "django-admin.py" (most likely in C:\Python27\Scripts)
and use it to create your first project.
- follow the official tutorial to learn the basics

https://docs.djangoproject.com/en/1.4/intro/tutorial01/

  It's pretty straightforward, most people have trouble locating the
django-admin.py which is not on system PATH by default.

 HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DJANGO_DEFAULT_SETTINGS

2012-08-14 Thread Jirka Vejrazka
> right, I was being very brief in my description!
> But it is the following:
> I want to insert data into the database from the shell, django shell, but
> the result is always that you can not import the settings because the va
> riavel DJANGO_SETTINGS_MODULE is not set

Did you read my previous email and checked the documentation at all?
It's all described there:

https://docs.djangoproject.com/en/1.4/faq/usage/
https://docs.djangoproject.com/en/1.4/ref/django-admin/

If you read this and *still* have a problem, come back and ask a
specific question with what you already tried (e.g. do you have a
database defined and created?) and what specific error(s) are you
experiencing.

  HTH

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DJANGO_DEFAULT_SETTINGS

2012-08-14 Thread jirka . vejrazka
It's always good to copy the error message you're getting. It seems that you 
try to run "python manage.py shell" ang getting an error that 
DJANGO_SETTINGS_MODULE is not set.

Please follow at least a bit of the tutorial on docs.djangoproject.com which 
will teach you how to set this variable properly.

 HTH

Jirka
-Original Message-
From: Carlos Andre 
Sender: django-users@googlegroups.com
Date: Tue, 14 Aug 2012 15:48:18 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: DJANGO_DEFAULT_SETTINGS

Ok, the  quest is relative  a how that work with forms of data in
settins.py!
not relative to date time.
in  real i'm want insert data in databases athroughl shell  and thi error
is show!

2012/8/14 Satinderpal Singh 

> On Tue, Aug 14, 2012 at 9:42 PM, Carlos Andre  wrote:
> > hi developers i'm with a ptoblem in this date. How work?
> > thanks!
> Please clear your question, if you are looking for date and time at
> your page please follow the following tutorial:
> http://www.djangobook.com/en/2.0/chapter03/
>
> --
> Satinderpal Singh
> http://satindergoraya.blogspot.in/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: invoking a funcion or module as root

2012-08-14 Thread Jirka Vejrazka
Hi there,

   you definitely don't want to allow apache to setuid() to root as
you've pointed out. You have a few options, probably the easiest one
is to write a pair of scripts for each task you want your application
to perform with root privileges.

  - the first script will only contain "sudo "
  - the second script should contain the necessary step(s) that need
to be performed with root privileges. It should be simple to minimize
chances for security issues

  Then you'd configure your sudoers file to allow apache process to
call the "second script" *including the right set of parameters* (if
applicable) with sudo permissions.

  You'd then call your "first script" using subprocess() call from
your views.py (or whereever appropriate).

  (you could technically bypass the whole "first script", but it'll
greatly improve readability if you do it this way, no one will have to
read your python code to match it to your sudoers file if problems
occur).

  Even better solution would be fixing your security model, having a
web application perform high-privileged tasks on a system seems flawed
in 99% of cases I can think of, but maybe you have a good reason why
you need it that way.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: merge data from multiple models

2012-07-31 Thread Jirka Vejrazka
Hi there,

>  As templates cannot do lookups into a dictionary

 Templates can do lookups into a dictionary, see
https://docs.djangoproject.com/en/1.4/topics/templates/#variables
(check the "Behind the scenes" section).

  From what you've described, I'd try to prepare the necessary data in
a view (using caching, if possible at all), build the appropriate data
structure to be displayed and then use the template layer to do a
"dummy" display. Then you'd have the full power of Python at your
disposal to perform the best access to your data and combining the
models together into and array of items or a dictionary, depending on
your need.

  HTH

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.save() fails silently - how to debug?

2012-07-26 Thread Jirka Vejrazka
Sorry, I should have read your code before answering.

I'm struggling to understand what you do in your clean() method. Are
you sure you're returning the right set of data?

  Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: form.save() fails silently - how to debug?

2012-07-26 Thread Jirka Vejrazka
> Thank you for the suggestion, but unfortunately that too does not work.
>
> I really need to find a way to get at the source of the problem; I would
> think an error message should be generated but none shows up...

Are you doing some magic in model's save() by any chance?

  Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: rendering modelForms

2012-07-10 Thread Jirka Vejrazka
Hi Marilena,


  I'm also using Twitter Bootstrap and over time migrated to this
template snipped that I'm including in my templates at the place where
you put {{ form.as_table }}

http://dpaste.com/hold/768995/

  If you find it useful, great :)  I'm not a web developer by nature
so there may be a better way to do this - just be warned :)

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem to complète the xml template

2012-07-05 Thread Jirka Vejrazka
> Hello,
> http://cdm-fr.fr/2006/schemas/CDM-fr.xsd"; language="fr-FR">
>   {% if formations %}
>
> 

  Hi there,

   you probably want to follow your {% if formations %} statement with:
 {% for formation in formations %}

  Check Django template documentation again - you're moving along the
right path, but your template is missing the loop across individual
formations.

  HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django 1.4 - how to display a success message on form save

2012-06-26 Thread Jirka Vejrazka
>> @Jirka - thanks. I saw something about the messaging framework and even
>> tried one example which did not work.

Using the messaging framework is actually very simple.

You need to enable the messaging framework (see the steps here:
https://docs.djangoproject.com/en/1.4/ref/contrib/messages/ )

In your template, you need this (I have that in my base template so
it's included in all pages):

  {% if messages %}
{% for message in messages %}
  {{ message }}
{% endfor %}
  {% endif %}

Obviously, you'll need some formatting/CSS around it.

And in your views.py (or forms.py, ...)

from django.contrib import messages

   if form.is_valid():
 messages.success(request, 'Your form was saved')

And that's it!


   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django 1.4 - how to display a success message on form save

2012-06-26 Thread Jirka Vejrazka
Hi,

  have you checked the messaging framework in Django?

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django newbie

2012-06-20 Thread Jirka Vejrazka
> experience. However when I'm trying to execute following command in
> command prompt (Windows 7), I get this error.
> File "", line 1
> django-admin.py startproject mysite
>                                        ^
> SyntaxError: Invalid synatx

  Hi there,

   this is a typical Python interpreter error message. It seems that
you're typing your command in a Python prompt, not the Windows prompt.
Can you copy & paste the whole command you're typing including the
beginning of the line?

  Cheers

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to generate secure passwords

2012-05-29 Thread jirka . vejrazka
Hi,
   Are you trying to create passwords on behalf of users? This is usually a bad 
idea.

  If I got your message wrong and you talk about secure password hashes, is 
there something specific you did not like about the current Django auth system?

  Or maybe you are interested in password complexity requirements? It's really 
difficult to guess. Please describe the problem you're trying to solve a bit 
better.

  Cheers

Jirka


-Original Message-
From: Emily Namugaanyi 
Sender: django-users@googlegroups.com
Date: Tue, 29 May 2012 23:03:39 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: How to generate  secure passwords

Hi Django users,

I am working on a project that as to generate secure passwords
(passwords that cannot be hacked) every time a user register and the
password lasts for a period of time. S,here I am wondering whether
django has a provision for this or I need to find another way...
Thank you for your time

Emily.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Tutorial database problem

2012-05-27 Thread Jirka Vejrazka
Hi,

  you're creating your database file in /usr/bin which is intended for
system executable files, not databases etc. It's highly likely that
you don't even have write permissions there (unless you work using the
"root" account which is a big NO-NO).

  Set your database file somewhere where you can write for sure, such
as /home//test_db.db.

  You can easily find out if you have write permissions somewhere by
using the "touch" command, i.e. "touch /home//test_db.db -
it'll either create an empty file which means that this path is OK for
your database, or give you an error.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django connect alternate database.

2012-05-26 Thread jirka . vejrazka
Hi,

  search documentation for "database routers" and using() in the ORM...

  HTH

Jirka

-Original Message-
From: Min Hong Tan 
Sender: django-users@googlegroups.com
Date: Fri, 25 May 2012 22:18:23 
To: 
Reply-To: django-users@googlegroups.com
Subject: django connect alternate database.

hi,

I have a situation.  currently i have one default django 's database.
but, i wound like to connect to mssql/other database.
- how can i get connected to ms-sql/other database?
- is it we have to create class in models? the database is for read only.
Hope able to get the information.

Regards,
MH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Stuck in URL............!!! Help

2012-05-18 Thread Jirka Vejrazka
> 1. ^wikicamp/(?P[^/]+)/edit/$
> 2. ^wikicamp/(?P[^/]+)/save/$
> 3. ^wikicamp/(?P[^/]+)/$
>
> The current URL, wikicamp/, didn't match any of these.

All defined URL's expect wikicamp/some_page_name/  (and maybe some
extras after). The requested URL has no page name, terminates right
after "wikicamp/" - hence the error...

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Dajaxice is not defined!!! please heelpppp!! :(

2012-05-03 Thread Jirka Vejrazka
> i am trying to use dajax in my page and i followed all steps several times
> as given hier: http://dajaxproject.com/
>
> but once i click on onclick="Dajaxice.home.randomize(Dajax.process), nothing
> is happening and i saw in console of firefox, there it says, "Dajaxice is
> not defined". but i included the {% dajaxice_js_import %} in the head, and
> even i linked the dajaxice.core.js file statically from my STATIC_URL. but
> it still says the same error. how can i go around this problem? is there any
> way of getting this work?

  Hi, I did have this problem a few weeks ago. Did you doublecheck
your urls.py for Dajaxice-related links? What happens if you call
Dajaxice URL directly? (you should see requests for dajaxice.core.js
in your development server log).

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: null field issue

2012-03-01 Thread jirka . vejrazka
Hi Marc, 

  if I remember correctly (can't check now), the documentation clearly states 
that you should avoid using null=True on CharField unless you have a good 
reason. Your example is a textbook reason why is it recommended - having two 
distinct states for "empty string" (i.e. "blank" and "null") leads to 
inconsistencies and confusion.

  HTH

 Jirka

-Original Message-
From: Marc Aymerich 
Sender: django-users@googlegroups.com
Date: Thu, 1 Mar 2012 22:43:19 
To: 
Reply-To: django-users@googlegroups.com
Subject: null field issue

I have a model with a filed like
name = models.CharField(max_length=255, blank=True, null=True)

With Django admin I've created some instances of that model without
filling name field. Now I'm querying that model with name__isnull=True
and the filter doesn't return any single object!! acctually on the
database (postgresql) the name field is an empty string '' instead of
the expected NULL.

Why the admin fills name field with an empty string? Is this a normal
behaviour?

-- 
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Issues with "startproject"

2012-01-03 Thread Jirka Vejrazka
> I was able to get the django-admin.py file to be located and I no
> longer had an error with startproject not executing but there was a
> random issue with the name of my file. At this point I have no idea
> what the problem is.
>
> http://madtrak.com/error.png

Hi there,

  you are missing the django-admin.py filename on your path. It ends
with "...\django\bin" which is a directory name, not a file name.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Boolean test on queryset

2011-11-28 Thread Jirka Vejrazka
Hi Adam,

  I tend to use:

  if examples.count():

...something...

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: QuerySet: "if obj in queryset" can be very slow

2011-11-02 Thread Jirka Vejrazka
> queryset=MyModel.objects.all()
> obj=MyModel.objects.get(id=319526)

Thomas,

  if the second line works for you (i.e. does not raise
MyModel.DoesNotExist exception), then obj is in queryset by
definition.

  What are you trying to achieve?

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM - Am I trying to do the impossible?

2011-10-21 Thread Jirka Vejrazka
I thought I missed something :)

First of all, nothing stops you from writing raw SQL query if you had
one in mind. It might be more sensible than trying to massage the ORM
too much.

If you insist on ORM, but something along these lines *might* work (I
really don't have the opportunity to test it right now, need to catch
flight :)

AssignmentUpdate.objects.order_by('-actual_report_time').values_list('assignment__team',
'status').distinct()
and then you can simply select the first entry for each team from the list.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM - Am I trying to do the impossible?

2011-10-21 Thread Jirka Vejrazka
Hi there,

  I may be missing something obvious here, but have you tried thinking
about it the other way round? The below is just an untested hint:

class Team(models.Model):
  def get_status(self):
team_status =
AssignmentUpdate.objects.filter(assignment__team=self).latest().status
return team_status.

Obviously you'd have to handle some edge cases (like non-existing
AssignmentUpdate etc.).

So rather that working your way down from Team, work your way up from
AssignmentUpdate, filter by foreign keys (check documentation for
filters that span relationships) and get your latest() set up properly
(hint: class Meta). You should not really need values_list for this
type of request.

  Hope it helps

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: time part of datetime not saved

2011-09-05 Thread Jirka Vejrazka
OK - I can't see anything wrong with your code that'd jump at me. Can
you check your database table format? Maybe you've declared your model
fields as models.DateField first and then changed to DateTimeField
without changing the underlying table? Just a guess :)

  Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: time part of datetime not saved

2011-09-05 Thread Jirka Vejrazka
Can you tell us what is the "[0:6]" supposed to be doing in your time
conversion funcions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to have a template NOT show up

2011-09-01 Thread Jirka Vejrazka
Yves,

  this:

^polls/ ^polls/$
^polls/ ^polls/(?P\d+)/$
^polls/ ^polls/(?P\d+)/results/$
^polls/ ^polls/(?P\d+)/vote/$

  suggests that you did not follow the tutorial closely. Django keeps
telling you what's wrong - your urls.py in your application (pools)
duplicates the word "polls" in (most of) URL strings.

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Password Field Not being encrypted

2011-08-30 Thread Jirka Vejrazka
Raj,

  PasswordInput deals with browser forms to make sure that a password
can't be seen in the form by someone looking over user's shoulder. But
it does nothing to encrypt passwords in database.

  Why don't you check out django.contrib.auth.models for inspiration
about encrypting passwords if plan on doing it yourself and not
reusing the standard auth framework?

  Cheers

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unable to work with Django API

2011-08-26 Thread Jirka Vejrazka
Hi there,

  your database is not set up properly - are you sure you went through
the "database setup" section of the tutorial?

   HTH

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Installation

2011-08-26 Thread Jirka Vejrazka
Prem,

  your Django does *not* have to be on your PATH, but it either has to
be in your PYTHONPATH or there must be a link from your Python
site-packages directory.

  The easiest way is to add c:/Django-1.0.4  (notice the forward
slash) to your Windows PYTHONPATH environment variable (or create it
if it does not exist)

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do I select which user/password to use for DB connection after Django app was started?

2011-08-17 Thread Jirka Vejrazka
> I.e. I want to set up database connection after Django app has started
> *when I want it*.
> Is there a way to do it?

No. At least not easily. Django is a web framework and is expected to
run on a web/application server with a single-user connection to a
target database. That's typical for web applications.

What you have now it a typical "thick" client, running on end user's
desktop. I am sorry, but there is no easy conversion between those
two.

Web applicatons typically users and permissions *winthin the
application* rather than *within the database*. Django is tailored to
the former.

I can't see how you could change Django easily. You could experiment
with creating settings dynamically and closing DB connection just
before user logs in (Django can open it again when it needs it) to use
your "dynamic" DB connection, but you'd have to somehow link your
"dynamic settings" with user sessions and that might be tricky.

It's often difficult to make a car fly, no matter how good the car is.

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to avoid repeated "context_instance = RequestContext(request)" args when rendering?

2011-08-15 Thread Jirka Vejrazka
>> > ... I'm hoping some standard solution
>> > already exists.)  Sorry to be so long winded.

 Hi there,

   in older Django versions, you can use direct_to_template from
generic views to automatically use RequestContext. I'm using it to
save a line or two per view. Not a magic solution, but might help you
:)

  Just my 2 cents

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: database requests

2011-07-14 Thread Jirka Vejrazka
> how can i get the queries being passed while a page is being
> requested? i mean when a view is requested the database queries being
> sent.

Hi,

  it's difficult to figure out what you need from your question, but
I'll make a wild guess that you need this:

https://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-raw-sql-queries-django-is-running

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Inspecting objects

2011-07-12 Thread Jirka Vejrazka
> Thank you all for your help!!!

I know I'm a bit late to the party (blame timezones :), but thought
I'd put my 2 cents worth in :)

For inspecting models from command lines (usually when working with
models from legacy databases) I often use model_to_dict which is
"hidden" in django.forms.models.

>>> from django.forms.models import model_to_dict
>>> print model_to_dict(some_model)

  HTH

 Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Problem with Tutorial 1 - Django Version = 1.3

2011-06-30 Thread Jirka Vejrazka
> class Poll(models.Model):
>    question = models.CharField(max_length=200)
>    pub_date = models.DateTimeField('date published')
> def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    poll = models.ForeignKey(Poll)
>    choice = models.CharField(max_length=200)
>    votes = models.IntegerField()
> def __unicode__(self):
>        return self.choice
>
> When I execute the command Poll(objetcs.all): I get as result the
> following: class [, ] when I;m
> supposed to get as result []
>
> I don't know what is missing. If someone can help me I would
> appreciate it. Thanks!!

  Apart from the problem Kenneth pointed out, you seem to have the
indentation wrong. The "def __unicode__" belongs to the class, not on
the same level as the "class" word.

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Get MAC from diferent fields

2011-06-14 Thread Jirka Vejrazka
Hi there,

Django is just a Python package. Forget for a moment that you use
Django for database connection and solve your "how do I recognize a
MAC address?" problem just as you'd solve it in pure Python.

There is nothing wrong with the MAC addresses in your example - why do
you say these are in "weird format" ?

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django Admin site and password field

2011-05-12 Thread Jirka Vejrazka
I have not done it myself, but you might need to specify custom widget
for your field. Take a look at PasswordInput widget here:
http://docs.djangoproject.com/en/1.3/ref/forms/widgets/

  HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Help! Database is locked! Windows developing envrionment, sqlite3, djcelery and djkombu

2011-05-07 Thread Jirka Vejrazka
Or any other database that you would be familiar with or could easily
get help for. SQLite3 is great for single-process tasks and simple
development. It can't however handle simultaneous writes (other
databases supported by Django can handle simultaneous writes)

  As you use multiple threads/processes, it's very likely that
processes try to write to database at the same time, which causes the
erorr you're getting.

   HTH

 Jirka

On 07/05/2011, Andy McKay  wrote:
>
> On 2011-05-06, at 7:01 PM, Robert Ray wrote:
>
>> I''im using Django 1.3 with Djcelery and Djkombu on Windows7. When I'm
>
>> Can anyone give me any help? Thanks in advance!
>
>
> You are using sqlite? Don't use that, use postgresql instead.
> --
>   Andy McKay
>   a...@clearwind.ca
>   twitter: @andymckay
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ANN: DSE v2.0.0-Beta - DSE uses 1.8% of the time compared to the Django ORM updating 100.000 records.

2011-05-03 Thread Jirka Vejrazka
Thanks for DSE!

  I tried it earlier (version 0.6 I think). While I really liked the
speed improvement, there were 2 areas that did not suit me too well:

  - error detection - I needed reliability more than speed and I was
not comfortable with situations like "the IntegrityErrror is somewhere
in last 1000 inserts"

 - multi-db support. I rely heavily on that and DSE was not mature
enough there (I opened a ticket or two). I have not checked since if
there's been any improvement.

  So, I'm not using DSE today but putting my 2 complaints aside, I
really liked it when I tested it.

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-29 Thread Jirka Vejrazka
Have you checked permissions?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: logout problem - NameError - newbie

2011-04-23 Thread Jirka Vejrazka
Hi did you notice in tutorial (or docs) that view names in urls.py are
usually strings, not functions? So, if you use 'farewell' in urls.py,
you should be fine.

  HTH

 Jirka

On 22/04/2011, Marg Wilkinson  wrote:
> Hi,
>
> I'm a total newbie slogging my way through a tutorial. I've reached an
> impasse with logging off
>
> In views my code includes
>
> 
> from django.contrib.auth import logout
>
> def farewell(request):
> logout(request)
> return HttpResponseRedirect('/')
> ---
>
> and urls.py has the lines
>
> -
> urlpatterns = patterns('',
>  url(r'^admin/', include(admin.site.urls)),
>  url(r'^$', main_page),
>  url(r'^user/(\w+)/$', user_page),
>  url(r'^login/$', 'django.contrib.auth.views.login',
> {'template_name': 'registration/login.html'}),
>  url(r'^logout/$',farewell),
> 
>
>
> http://127.0.0.1:8000/farewell  (or anything after the 8000/)  gives
> me an error
> -
> Exception Value:
>
> name 'farewell' is not defined
> 
>
> OK  but farewell looks defined to me in views.py,so what am I
> missing?
>
> (BTW - originally I was trying to use logout for my def instead of
> farewell, with appropriate urls.py changes - same error except it
> specified that "logout" was not defined.)
>
> Can anyone please point a newbie in the right direction?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread Jirka Vejrazka
Are you getting this error only when using the app through a web server?
Have you verified that the web server does have ORACLE_HOME and
LD_LIBRARY_PATH correctly defined? (e.g. by logging it using os.environ).

Are you sure that the user that is used to run your webserver has
permissions to read all Oracle client files?

 Just thinking "loudly" :)

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cx_Oracle error: ImproperlyConfigured

2011-04-22 Thread Jirka Vejrazka
Hi Kamal,

  checking my install history, this is what I had to do to use
cx_Oracle on Ubuntu Server:

$ /usr/local/oracle/instantclient_11_2$ ln -s libclntsh.so.11.1 libclntsh.so
$ WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
python setup.py build
$ sudo bash
# WITH_UNICODE=1 ORACLE_HOME=/usr/local/oracle/instantclient_11_2
python setup.py install

and tested:
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/oracle/instantclient_11_2
$ python
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> cx_Oracle.version
'5.0.3'

Then I added the LD_LIBRARY_PATH to /etc/profile so it'd be used by
all users, including the Apache process.

The error you're getting is most likely caused by ORACLE_HOME not
being set during cx_Oracle installation. To be extra sure, consider
adding it to /etc/profile too.


  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unexplainable delay when binding request.POST to form

2011-04-18 Thread Jirka Vejrazka
> I'm getting 20-30 seconds delay when trying to bind request.POST data
> to form.

  Hi Toni,

  it's a very long shot, but similar delays are often related to DNS
issues. Is there anything in your code or data that might be using
domain name? It *might* be possible that some part of your code (or
even Django) tries to resolve a domain name and fails.

  As stated above, it's a very long shot but it certainly wouldn't be
the first time similar delay would be found related to DNS after some
debugging...

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Please Help a django Beginner!

2011-04-15 Thread Jirka Vejrazka
I use Djano ORM for a lot of my backend processing where no web is
involved. Just make sure that DJANGO_SETTINGS_MODULE is defined in
your environment and you can use pretty much any part of Django in
your own code/scrits/whatever.

  HTH

Jirka


On 15/04/2011, Aviv Giladi  wrote:
> Hey guys,
>
> I am an experienced Python developer starting to work on web service
> backend system. The system feeds data (constantly) from the web to a
> MySQL database. This data is later displayed by a frontend side (there
> is no connection between the frontend and the backend). The backend
> system constantly downloads flight information from the web (some of
> the data is fetched via APIs, and some by downloading and parsing
> text / xls files). I already have a script that downloads the data,
> parses it, and inserts it to the MySQL db - all in a big loop. The
> frontend side is just a bunch of php pages that properly display the
> data by querying the MySQL server.
>
> It is crucial that this web service be robust, strong and reliable.
> Therefore, I have been looking into the proper ways to design it, and
> got the following recommendation:
> django as the framework (over Apache).
> wrapping my sources with Piston for API usage.
> All if this sounds great. I used django before to write websites (aka
> request handlers that return data). However I don't see how django can
> fulfill a role of a constant running (non request-serving) system -
> being that it uses views/forms, which are not a part of my backend
> system. Is want I want at all possible / advisable with django? Is
> django what you would recommend for this?
> If so, could you please refer me to some documentation / help files
> more specific to my needs?
>
> Thank you so much,
> Aviv
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SQL Server

2011-04-15 Thread Jirka Vejrazka
Mike,

  I use exactly the same setup. Look up the "django-odbc" package.
This will be quite easy to use and setup, but there are some
unresolved bugs in that package related to multi-db support. Most of
them have patches attached to their tickets.

  Cheers

 Jirka

On 15/04/2011, Mike Kenny  wrote:
> Hi,
>
> I am trying to use a django application developed on Linux with MySQL
> on a Windows box with SQL Server. I have downloaded pyodbc and set my
> ENGINE to sql_server.pyodbc (and tried just pyodbc as I was able to
> import this into python but not sql_server). Both result in an error
> message listing the supported engines, of which pyodbc is not listed.
>
> Obviously I have missed a step somewhere, does anybody know hat it
> might be? Or can somebody provide me with an idiot's guide to using
> django with SQL Server. (Unfortunately I am not at home in a windows
> environment)
>
> The software I am using is python 2.7 ,django 1.3 and pyodbc 2.18
>
> Thanks,
>
> mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: __unicode__ in tutorial part 1

2011-04-12 Thread Jirka Vejrazka
> IndentationError: unexpected indent
>
> I don't know what's wrong - Can You help me?


It's exactly what it says - indentation is important in Python and
number for spaces (or tabs) on that line does not match the rest of
your file. Or you mixed tabs and spaces.

  HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Deploying django. Please specify the steps.

2011-03-11 Thread Jirka Vejrazka
OK - I'm going to ask the obvious question here - have you made sure
that Apache web server user can read ALL your configuration files? The
log reveals that there are permission problems on .htaccess file that
is stored in your home directory (where Apache can't reach by
default). I'm going to make a guess that there's where your
WSGI-related Apache configuration is.

 HTH

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Why does Django Fail on Date Field?

2011-03-10 Thread Jirka Vejrazka
Will this answer your question?

>>> import datetime
>>> datetime.datetime(year=, month=00, day=00)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year is out of range


  Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error 503 Service Unavailable from 127.0.0.1

2011-03-10 Thread Jirka Vejrazka
Most likely, you have a proxy defined in your browser and "bypass
proxy for local machines" is not checked.

  Cheers

 Jirka


On 09/03/2011, pjstunna  wrote:
> Hi,
>
> I just recently discovered Django and I'm following the Django
> tutorial as it is written on the website (
> http://docs.djangoproject.com/en/dev//intro/tutorial01/
> ) but when i start the development server and view http://127.0.0.1:8000
> from my browser I get this error
>
> Error 503 Service Unavailable from 127.0.0.1
>
> I just installed Django 1.2.5 and I'm using the SQlite3 backend on a
> Windows 7 laptop
>
> Please help!!!
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Why does Django Fail on Date Field?

2011-03-08 Thread Jirka Vejrazka
Well, we're missing the bit where you tell us what error are you
getting. I don't know about others, but my crystal ball is a bit dusty
these days.

The models.py snippet you posted is obvious result of inspectdb
output, which *may* need some manual tweaking. But it's difficult for
us to guess as we don't know your database and we don't know what
exactly is wrong (except for "Django fails").

If you add more details, someone might be able to help you

My 2 cents

   Jirka

On Tue, Mar 8, 2011 at 14:08, octopusgrabbus  wrote:
> Here is the table:
>
> class CsRemove(models.Model):
>    action = models.CharField(max_length=3, db_column='Action') #
> Field name made lowercase.
>    endpointid = models.IntegerField(primary_key=True,
> db_column='EndpointId') # Field name made lowercase.
>    devicetype = models.IntegerField(primary_key=True,
> db_column='DeviceType') # Field name made lowercase.
>    channelnumber = models.IntegerField(primary_key=True,
> db_column='ChannelNumber') # Field name made lowercase.
>    actiondate = models.DateField(primary_key=True,
> db_column='ActionDate') # Field name made lowercase.
>    class Meta:
>        db_table = u'cs_remove'
>
> I can use MySQL Query browser and insert successfully. Django cannot.
> I can easily roll some MySQL code to do this, but would prefer to do
> it the Django way.
>
> What am I missing?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django ORM query modelling question

2011-03-01 Thread Jirka Vejrazka
Hi Carsten,

  this does not seem to me like something you would be able to do
using SQL (or Django ORM) only. I would guess that you'll have to
write a bit of Python code that will walk through the entries and
detect those that are different from "previous"

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: urls.py usage

2011-02-28 Thread Jirka Vejrazka
> AlreadyRegistered at /blog/
> The model BlogPost is already registered

  That you have duplicate registration of one model in your admin.py
somewhere (I believe, I may be wrong).

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to properly implement counter?

2011-02-10 Thread Jirka Vejrazka
I don't have much experience with this, but it looks like a good use
case for signals and atomic counters using memcached.

  Just my 2 cents

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: matching a domain name in urls.py

2011-02-03 Thread Jirka Vejrazka
> I am building an app that passes a domain name to urls.py like so   "/
> sites/domain.com/'
>
> but I cannot get my urls.py to match the 'domain.com'  it only seems
> to match if i just use domain without the dot
>
> I have tried
>
>    (r'^zones/^[^/]+/', get_domain),
>    (r'^zones/(?P\w+)/', get_domain),
>    (r'^zones/(?P\w+)$', get_domain),
>
> and none seem to be able to catch it


Just curious - did you notice that you have "sites" in the question,
but "zones" in the urls.py?

And the obvious question - did you know that dot has a special meaning
in regular expressions so you probably want to write "\."
(backslash-dot).

  Just my 2 cents

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: working django with existing database

2011-01-30 Thread Jirka Vejrazka
> i've tried inspect-db but i still have no vitctory

  Err, what exactly does that mean? Did you get an error message?

> it's get error while i recompile back it to oracle by syncdb

  Again - difficult to help you if you don't say *what* error.

> errr...and something i don't know, if i syncdb, what's will happen to the
> data? will i lost it??

  It depends on lots of factors, but the answer is generally NO - you
will not lose any data. But since you don't really describe what your
environment is and what is the specific issue you're hitting, no one
can really be sure.

  Cheers

   Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: working django with existing database

2011-01-30 Thread Jirka Vejrazka
Search documentation for "inspectdb"

  HTH

 Jirka

On 30/01/2011, arief nur andono  wrote:
> is there anybody could save my time to make django work with existing
> database so i need only create the sql in model (not have to define
> table and field in models.py)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to format a datetime in a webpage?

2011-01-28 Thread Jirka Vejrazka
>         {{record.ComplaintTime|time:"Y-m-d
> H:i"}}

>From the documentation:

"The time filter will only accept parameters in the format string that
relate to the time of day, not the date (for obvious reasons). If you
need to format a date, use the date filter."

  So, you need to use:
{{record.ComplaintTime|date:"Y-m-d H:i"}}

  instead of:
{{record.ComplaintTime|time:"Y-m-d H:i"}}

  Cheers

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Is there a tool to check which views are used?

2011-01-27 Thread Jirka Vejrazka
Unless someone comes up with a smarter idea (I'm sure they will :),
I'd take website logs for the last month or so (depending on your
site), build a list of all successful requests URL's on your site and
then map those to views on your site using standard URL resolver. That
should tell you what views *are* being used with some 99% certainity.

Also, if your site is relatively small, you could insert a small
logging code to the beginning of every view. Just a thought :)

  HTH

Jirka

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



  1   2   >