Re: Exciting Opportunity: Join Our Django WhatsApp Bulk Messaging Project!

2024-02-23 Thread Don Onyango
Interested add +254741590670 

On Sunday, February 18, 2024 at 7:48:37 PM UTC+3 SURAJ TIWARI wrote:

>  Join Our Django WhatsApp Bulk Messaging Project!
>
>  Hello everyone,
>
> Are you looking for an exciting opportunity to gain hands-on experience in 
> Django development? Do you want to work on a meaningful project that 
> leverages WhatsApp for bulk messaging? We're thrilled to invite you to join 
> our dynamic team!
>
>  Benefits:
>
>- Get hands-on experience working on a real-world Django project.
>- Learn how to leverage WhatsApp for bulk messaging, a valuable skill 
>in today's digital landscape.
>- Opportunities for hybrid work, allowing flexibility in your schedule.
>- Collaborate with experienced developers and gain valuable mentorship.
>- Access to cutting-edge tools and technologies.
>
>  Opportunities Available:
>
>- Django developers
>- Frontend developers
>- UI/UX designers
>- Quality assurance testers
>
> 欄 How to Join: Simply reply to this message expressing your interest, 
> and we'll provide you with all the necessary details to get started on our 
> project.
>
> Let's work together to create something amazing and gain valuable 
> experience along the way! ✨
>
> Best regards,
>
> Suraj Tiwari
>
>
>

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


Re: What's the best way to find the number of database accesses being done?

2019-07-24 Thread Don Baldwin
Thanks for the quick response Simon.  This looks to be very informative.
It will take me a while to digest all of it, but I've already gotten
logging working for my queries.  Very helpful.

Thanks,
Don

On Tue, Jul 23, 2019 at 11:38 AM Simon Charette 
wrote:

> Hello Don,
>
> Django logs all database queries to the django.db.backends logger. It is
> not
> redirected to STDOUT when using the default settings.LOGGING configuration
> but you can enable it yourself[0].
>
> If you wan to assert against a fixed number of queries you can use the
> assertNumQueries context manager[1] provided by SimpleTestCase and its
> subclasses to do that.
>
> For an easy to setup and per-view breakdown of the number of queries I
> suggest you install the django-debug-toolbar[2] and enable the SQL panel.
>
> For more details about optimizing database accesses within a Django project
> I suggest you have a look at the dedicated section of the documentation[3].
> I've filed a ticket to make sure bulk_update is also mentioned in this
> section
> of the documentation.
>
> Cheers,
> Simon
>
> [0] https://www.dabapps.com/blog/logging-sql-queries-django-13/
> [1]
> https://docs.djangoproject.com/en/2.2/topics/testing/tools/#django.test.TransactionTestCase.assertNumQueries
> [2] https://django-debug-toolbar.readthedocs.io/en/latest/
> [3] https://docs.djangoproject.com/en/2.2/topics/db/optimization/
>
> Le mardi 23 juillet 2019 12:19:03 UTC-4, Don Baldwin a écrit :
>>
>> I have a function that runs some database queries and updates.  In the
>> test code for that function, I'd like to check out many times the database
>> is actually being hit.  Does Django provide a way to get that information?
>>
>> Thanks,
>> Don
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/cywNQX35caw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bf8c2c46-40b7-477a-8635-9da5c766bb7d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bf8c2c46-40b7-477a-8635-9da5c766bb7d%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


Re: What's the best way to update multiple entries in a database based on key/value pairs

2019-07-24 Thread Don Baldwin
Thanks for the quick response Simon.  Worked like a charm.

-Don

On Tue, Jul 23, 2019 at 11:29 AM Simon Charette 
wrote:

> Hello Don,
>
> If you're on Django 2.2+ you should use bulk_update for this purpose[0]
>
> TestThing.objects.bulk_update((
> TestThing(id=id, value=new_value)
> for id, value in new_values.items()
> ), ['value'])
>
> Under the hood it performs a SQL query of the form
>
> UPDATE ... SET value = (CASE WHEN id=1 THEN foo WHEN id=2 THEN ...)
>
> That you can emulate yourself by using Case and When expressions if you're
> using Django < 2.2.
>
> Cheers,
> Simon
>
> [0]
> https://docs.djangoproject.com/en/2.2/ref/models/querysets/#bulk-update
>
> Le mardi 23 juillet 2019 12:15:20 UTC-4, Don Baldwin a écrit :
>>
>> Hi,
>>
>> I have a dictionary where the key is the primary key from one of my
>> database tables, and the values are the values that I want to update with.
>>
>> For example, I may have the following dictionary:
>>
>> new_values = {1:'a', 2:'b', 3:'c'}
>>
>>
>> And the following model:
>>
>> class TestThing(models.Model):
>>
>> new_value = models.IntegerField(default=0)
>>
>>
>> And I want to update the entry with primary key 1 with value 'a', etc.
>>
>>
>> Note that there are other fields in the table that need to be preserved, so 
>> I can't just create a new table.
>>
>>
>> Obviously, I could loop through each entry and update each entry 
>> individually, but this seems really inefficient, so I think there must be a 
>> better way to do this.
>>
>>
>> Also, my table may have entries that aren't represented in my dictionary, so 
>> I don't think I can do the following:
>>
>>
>> TestThing.objects.all().update(new_value=new_values[F(id)])
>>
>>
>> Thanks,
>>
>> Don
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/J79WXBWaNuA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8fe0d69c-0158-4eaa-be5d-435a09a29535%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8fe0d69c-0158-4eaa-be5d-435a09a29535%40googlegroups.com?utm_medium=email_source=footer>
> .
>

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


What's the best way to find the number of database accesses being done?

2019-07-23 Thread Don Baldwin
I have a function that runs some database queries and updates.  In the test 
code for that function, I'd like to check out many times the database is 
actually being hit.  Does Django provide a way to get that information?

Thanks,
Don

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


What's the best way to update multiple entries in a database based on key/value pairs

2019-07-23 Thread Don Baldwin
Hi,

I have a dictionary where the key is the primary key from one of my 
database tables, and the values are the values that I want to update with.

For example, I may have the following dictionary:

new_values = {1:'a', 2:'b', 3:'c'}


And the following model:

class TestThing(models.Model):

new_value = models.IntegerField(default=0) 


And I want to update the entry with primary key 1 with value 'a', etc.


Note that there are other fields in the table that need to be preserved, so I 
can't just create a new table.


Obviously, I could loop through each entry and update each entry individually, 
but this seems really inefficient, so I think there must be a better way to do 
this.


Also, my table may have entries that aren't represented in my dictionary, so I 
don't think I can do the following:


TestThing.objects.all().update(new_value=new_values[F(id)])


Thanks,

Don

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


Re: M2M relationship not behaving as I would expect

2019-07-23 Thread Don Baldwin
FYI, I was able to get this working with a small change to the query, from:

data = list(TestThing.objects.all().values('user__user_data',

   'thing_data',

   'user__testbridge__bridge_data'))


to:


data = list(TestThing.objects.all().values('user__user_data',

   'thing_data',

   'testbridge__bridge_data'))


(removing the highlighted code).

Somehow this extra level of indirection caused the query to lose the 
constraints of the one-to-many relationships between user and bridge and 
between thing and bridge, although I don't fully understand it.

Thanks for your response Mike.

-Don


On Sunday, July 21, 2019 at 3:58:03 PM UTC-7, Mike Dewhirst wrote:
>
> You can constrain uniqueness in the through table and/or the other tables 
> to represent whatever real-world constraints you need. Otherwise you can 
> have as many duplicated relationships as you want. Each through record has 
> its own id so the database is happy no matter how many go in. 
>
> *Connected by Motorola*
>
>
> Don Baldwin > wrote:
>
> Hi,
>
> I have a many-to-many relationship between users and things, where a user can 
> select multiple things,
> and a thing can be selected by multiple users.  The relationship between 
> users and things also
> contains data, so I've specifically setup a through table.
>
> When I add a user to a thing, I guess I expect a one-to-one relationship 
> between the thing and
> the intervening bridge, but it seems like I'm getting a one-to-many.
>
> Here is my code:
>
> models.py:
>
> class TestUser(models.Model):
> user_data = models.TextField(default="")
> 
> def __str__(self):
> return "Other: " + self.user_data
> 
> class TestThing(models.Model):
> thing_data = models.TextField(default="")
> user = models.ManyToManyField(TestUser, through='TestBridge')
> 
> def __str__(self):
> return "Thing: " + self.thing_data
> 
> class TestBridge(models.Model):
> user = models.ForeignKey(TestUser, on_delete=models.CASCADE)
> thing = models.ForeignKey(TestThing, on_delete=models.CASCADE)
> bridge_data = models.TextField(default="")
> 
> def __str__(self):
> return "Bridge: " + self.bridge_data
>
> tests.py:
>
> u_1 = TestUser(user_data = 'user')
> u_1.save()
> t_1 = TestThing(thing_data='thing 1')
> t_1.save()
> t_2 = TestThing(thing_data='thing 2')
> t_2.save()
>
> t_1.user.add(u_1, through_defaults={'bridge_data': 'bridge 1'})
> t_2.user.add(u_1, through_defaults={'bridge_data': 'bridge 2'})
>
> data = list(TestThing.objects.all().values('user__user_data',
>'thing_data',
>
> 'user__testbridge__bridge_data'))
> for item in data:
> print(item)
>
> Output:
>
> {'user__user_data': 'user', 'thing_data': 'thing 1', 
> 'user__testbridge__bridge_data': 'bridge 1'}
> {'user__user_data': 'user', 'thing_data': 'thing 1', 
> 'user__testbridge__bridge_data': 'bridge 2'}
> {'user__user_data': 'user', 'thing_data': 'thing 2', 
> 'user__testbridge__bridge_data': 'bridge 1'}
> {'user__user_data': 'user', 'thing_data': 'thing 2', 
> 'user__testbridge__bridge_data': 'bridge 2'}
> 
> What I expect:
>
> {'user__user_data': 'user', 'thing_data': 'thing 1', 
> 'user__testbridge__bridge_data': 'bridge 1'}
> {'user__user_data': 'user', 'thing_data': 'thing 2', 
> 'user__testbridge__bridge_data': 'bridge 2'}
>
> How do I get rid of the relationships between thing 1 and bridge 2, and 
> between thing 2 and bridge 1?
>
> Thanks for your responses.
>
> -Don
>
> -- 
> 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...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAKL%3DYPH5OCd9wYNG%2BZ4R0%3DuYOEW0hfhRngqfudeaGqCjB6Yfrg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/django-users/CAKL%3DYPH5OCd9wYNG%2BZ4R0%3DuYOEW0hfhRngqfudeaGqCjB6Yfrg%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

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


M2M relationship not behaving as I would expect

2019-07-21 Thread Don Baldwin
Hi,

I have a many-to-many relationship between users and things, where a
user can select multiple things,
and a thing can be selected by multiple users.  The relationship
between users and things also
contains data, so I've specifically setup a through table.

When I add a user to a thing, I guess I expect a one-to-one
relationship between the thing and
the intervening bridge, but it seems like I'm getting a one-to-many.

Here is my code:

models.py:

class TestUser(models.Model):
user_data = models.TextField(default="")

def __str__(self):
return "Other: " + self.user_data

class TestThing(models.Model):
thing_data = models.TextField(default="")
user = models.ManyToManyField(TestUser, through='TestBridge')

def __str__(self):
return "Thing: " + self.thing_data

class TestBridge(models.Model):
user = models.ForeignKey(TestUser, on_delete=models.CASCADE)
thing = models.ForeignKey(TestThing, on_delete=models.CASCADE)
bridge_data = models.TextField(default="")

def __str__(self):
return "Bridge: " + self.bridge_data

tests.py:

u_1 = TestUser(user_data = 'user')
u_1.save()
t_1 = TestThing(thing_data='thing 1')
t_1.save()
t_2 = TestThing(thing_data='thing 2')
t_2.save()

t_1.user.add(u_1, through_defaults={'bridge_data': 'bridge 1'})
t_2.user.add(u_1, through_defaults={'bridge_data': 'bridge 2'})

data = list(TestThing.objects.all().values('user__user_data',
   'thing_data',

'user__testbridge__bridge_data'))
for item in data:
print(item)

Output:

{'user__user_data': 'user', 'thing_data': 'thing 1',
'user__testbridge__bridge_data': 'bridge 1'}
{'user__user_data': 'user', 'thing_data': 'thing 1',
'user__testbridge__bridge_data': 'bridge 2'}
{'user__user_data': 'user', 'thing_data': 'thing 2',
'user__testbridge__bridge_data': 'bridge 1'}
{'user__user_data': 'user', 'thing_data': 'thing 2',
'user__testbridge__bridge_data': 'bridge 2'}

What I expect:

{'user__user_data': 'user', 'thing_data': 'thing 1',
'user__testbridge__bridge_data': 'bridge 1'}
{'user__user_data': 'user', 'thing_data': 'thing 2',
'user__testbridge__bridge_data': 'bridge 2'}

How do I get rid of the relationships between thing 1 and bridge 2,
and between thing 2 and bridge 1?

Thanks for your responses.

-Don

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
Hi ,
This Python Extension 
<https://marketplace.visualstudio.com/items?itemName=donjayamanne.python> too 
supports the features you have mentioned.
The difference is:
- Visual Studio Code is more of a lightweight and cross platform 
alternative (completely open source - MIT licensed).

Here are some of the features:

   - Linting (Prospector <https://pypi.io/project/prospector/>, Pylint 
   <https://pypi.io/project/pylint/>, pycodestyle 
   <https://pypi.io/project/pycodestyle/>/Pep8, Flake8 
   <https://pypi.io/project/flake8/>, pydocstyle 
   <https://pypi.io/project/pydocstyle/> with config files and plugins)
   - Intellisense (autocompletion)
   - Scientific tools (Jupyter/IPython)
   - Auto indenting
   - Code formatting (autopep8 <https://pypi.io/project/autopep8/>, yapf 
   <https://pypi.io/project/yapf/>, with config files)
   - Code refactoring (Rename 
   <https://github.com/DonJayamanne/pythonVSCode/wiki/Refactoring:-Rename>, 
Extract 
   Variable 
   
<https://github.com/DonJayamanne/pythonVSCode/wiki/Refactoring:-Extract-Variable>
   , Extract Method 
   
<https://github.com/DonJayamanne/pythonVSCode/wiki/Refactoring:-Extract-Method>
   , Sort Imports 
   <https://github.com/DonJayamanne/pythonVSCode/wiki/Refactoring:-Sort-Imports>
   )
   - Viewing references, code navigation, view signature
   - Excellent debugging support (remote debugging, mutliple threads, 
   django, flask, docker)
   - Unit testing, including debugging (unittest 
   <https://docs.python.org/3/library/unittest.html#module-unittest>, pytest 
   <https://pypi.io/project/pytest/>, nosetests 
   <https://pypi.io/project/nose/>, with config files)
   - Execute file or code in a python terminal
   - Local help file (offline documentation)
   - Snippets


On Saturday, 22 October 2016 05:56:43 UTC+11, Muizudeen Kusimo wrote:
>
> Hello Folks,
>
> PyCharm makes debugging Django (and other Python) applications very easy. 
> Some of the features which are very helpful include:
>
>1. Ability to choose specific Python Interpreter you want to run the 
>code base against. Useful if you use virtualenv and need to test your code 
>in different Python versions
>2. Standard debugging tools - Step Into, Step Over, Step Out, Watches
>3. Support for debugging other Python libraries tied to your Django 
>application e.g. Lettuce BDD tests, Unit Tests e.t.c
>
> It's definitely worth a try as you can get a lot from the Community Edition
>
> Regards
>
> On Thursday, October 20, 2016 at 8:30:45 PM UTC-4, Don Thilaka Jayamanne 
> wrote:
>>
>> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
>> https://github.com/DonJayamanne/pythonVSCode). Basically it provides 
>> intellisense, code navigation, debugging (django, multi threads, etc), data 
>> science and the like.
>>
>> When it comes to debugging django applications, today the extension 
>> disables (doesn't support) live reloading of django applications.
>>
>> I'm thinking of having a look at this particular area. Before I do so, 
>> I'd like to get an idea of how developers actually develop and debug django 
>> applications.
>>
>> Most of the people i've spoken to say they develop as follows:
>> - Fire up the django application with live reload 
>> - Start codeing
>> - Test in the browser
>> - Very rarely would they debug an application
>> - i.e. majority of the time they don't launch the application in debug 
>> mode 
>>
>> How do you work on django applications?
>>
>

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
@Luis Zárate 
>I dislike VS as IDE but
Please remember, this is Visual Studio Code (cross platform, open source, 
free) and not to be confused with Visual Sutdio IDE (full blown IDE runs 
only on Windows)
Visual Studio Code <https://code.visualstudio.com/>

>great if you want to support Django there
Django is supported today (including template debugging). Right now i'm 
looking at the need for debugging with auto-reload.
Check here for Python Extension and Features 
<https://marketplace.visualstudio.com/items?itemName=donjayamanne.python>

On Monday, 24 October 2016 03:40:35 UTC+11, luisza14 wrote:
>
> I rarelly debug code with django, with external utility, just trace stack 
> when errors appears, buy when I need it I use pydev over Aptana,  it has 
> heap monitor, breakpoints, step by step run and other debugger functions.
>
> One important thing is that I need to say to pydev that  run django with 
> --no-autoreload parameter, so then works well because when I am debugging I 
> am not coding and I can start or stop the server when I want.
>
> I always run django in external terminal when I am coding, I really like 
> the autoreload, I think it's better if the IDE can reload, but I really 
> hate when Aptana is configured wrong and server never die, because I need 
> to user $ killall python (or some like that) to stop django. 
>
> I dislike VS as IDE but, great if you want to support Django there. 
>
> El viernes, 21 de octubre de 2016, Muizudeen Kusimo <devb...@gmail.com 
> > escribió:
> > Hello Folks,
> > PyCharm makes debugging Django (and other Python) applications very 
> easy. Some of the features which are very helpful include:
> >
> > Ability to choose specific Python Interpreter you want to run the code 
> base against. Useful if you use virtualenv and need to test your code in 
> different Python versions
> > Standard debugging tools - Step Into, Step Over, Step Out, Watches
> > Support for debugging other Python libraries tied to your Django 
> application e.g. Lettuce BDD tests, Unit Tests e.t.c
> >
> > It's definitely worth a try as you can get a lot from the Community 
> Edition
> > Regards
> > On Thursday, October 20, 2016 at 8:30:45 PM UTC-4, Don Thilaka Jayamanne 
> wrote:
> >>
> >> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
> https://github.com/DonJayamanne/pythonVSCode). Basically it provides 
> intellisense, code navigation, debugging (django, multi threads, etc), data 
> science and the like.
> >> When it comes to debugging django applications, today the extension 
> disables (doesn't support) live reloading of django applications.
> >> I'm thinking of having a look at this particular area. Before I do so, 
> I'd like to get an idea of how developers actually develop and debug django 
> applications.
> >> Most of the people i've spoken to say they develop as follows:
> >> - Fire up the django application with live reload 
> >> - Start codeing
> >> - Test in the browser
> >> - Very rarely would they debug an application
> >> - i.e. majority of the time they don't launch the application in debug 
> mode 
> >> How do you work on django applications?
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com .
> > To post to this group, send email to django...@googlegroups.com 
> .
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/d5c69cfc-7bec-4df9-9112-3b0f74c0ab5d%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> > 
>

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
@Derek, yes VS Code Editor is available on Linux platforms.
Have a look here:
https://code.visualstudio.com/Download

On Monday, 24 October 2016 00:20:26 UTC+11, Derek wrote:
>
> Is VS Code Editor available on Linux platforms?
>
> On Friday, 21 October 2016 02:30:45 UTC+2, Don Thilaka Jayamanne wrote:
>>
>> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
>> https://github.com/DonJayamanne/pythonVSCode). Basically it provides 
>> intellisense, code navigation, debugging (django, multi threads, etc), data 
>> science and the like.
>>
>> When it comes to debugging django applications, today the extension 
>> disables (doesn't support) live reloading of django applications.
>>
>> I'm thinking of having a look at this particular area. Before I do so, 
>> I'd like to get an idea of how developers actually develop and debug django 
>> applications.
>>
>> Most of the people i've spoken to say they develop as follows:
>> - Fire up the django application with live reload 
>> - Start codeing
>> - Test in the browser
>> - Very rarely would they debug an application
>> - i.e. majority of the time they don't launch the application in debug 
>> mode 
>>
>> How do you work on django applications?
>>
>

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
@Luis Zárate
>I dislike VS as IDE but
Any particular reason for this?

>great if you want to support Django there
Django is supported today (including template debugging). Right now i'm
looking at the need for debugging with auto-reload.

On Mon, Oct 24, 2016 at 3:38 AM, Luis Zárate <luisz...@gmail.com> wrote:

> I rarelly debug code with django, with external utility, just trace stack
> when errors appears, buy when I need it I use pydev over Aptana,  it has
> heap monitor, breakpoints, step by step run and other debugger functions.
>
> One important thing is that I need to say to pydev that  run django with
> --no-autoreload parameter, so then works well because when I am debugging I
> am not coding and I can start or stop the server when I want.
>
> I always run django in external terminal when I am coding, I really like
> the autoreload, I think it's better if the IDE can reload, but I really
> hate when Aptana is configured wrong and server never die, because I need
> to user $ killall python (or some like that) to stop django.
>
> I dislike VS as IDE but, great if you want to support Django there.
>
> El viernes, 21 de octubre de 2016, Muizudeen Kusimo <devbo...@gmail.com>
> escribió:
> > Hello Folks,
> > PyCharm makes debugging Django (and other Python) applications very
> easy. Some of the features which are very helpful include:
> >
> > Ability to choose specific Python Interpreter you want to run the code
> base against. Useful if you use virtualenv and need to test your code in
> different Python versions
> > Standard debugging tools - Step Into, Step Over, Step Out, Watches
> > Support for debugging other Python libraries tied to your Django
> application e.g. Lettuce BDD tests, Unit Tests e.t.c
> >
> > It's definitely worth a try as you can get a lot from the Community
> Edition
> > Regards
> > On Thursday, October 20, 2016 at 8:30:45 PM UTC-4, Don Thilaka Jayamanne
> wrote:
> >>
> >> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
> https://github.com/DonJayamanne/pythonVSCode). Basically it provides
> intellisense, code navigation, debugging (django, multi threads, etc), data
> science and the like.
> >> When it comes to debugging django applications, today the extension
> disables (doesn't support) live reloading of django applications.
> >> I'm thinking of having a look at this particular area. Before I do so,
> I'd like to get an idea of how developers actually develop and debug django
> applications.
> >> Most of the people i've spoken to say they develop as follows:
> >> - Fire up the django application with live reload
> >> - Start codeing
> >> - Test in the browser
> >> - Very rarely would they debug an application
> >> - i.e. majority of the time they don't launch the application in debug
> mode
> >> How do you work on django applications?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/d5c69cfc-7bec-4df9-9112-3b0f74c0ab5d%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/vEKR34Oo08g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAG%2B5VyNKobt0SZ49pvbbAJWptHjw7AL
> SQ2kg9sRAR8atgfmOdA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAG%2B5VyNKobt0SZ49pvbbAJWptHjw7ALSQ2kg9sRAR8atgfmOdA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
@Derek, yes VS Code Editor is available on Linux platforms.
Have a look here:
https://code.visualstudio.com/Download

On Mon, Oct 24, 2016 at 12:20 AM, Derek <gamesb...@gmail.com> wrote:

> Is VS Code Editor available on Linux platforms?
>
> On Friday, 21 October 2016 02:30:45 UTC+2, Don Thilaka Jayamanne wrote:
>>
>> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
>> https://github.com/DonJayamanne/pythonVSCode). Basically it provides
>> intellisense, code navigation, debugging (django, multi threads, etc), data
>> science and the like.
>>
>> When it comes to debugging django applications, today the extension
>> disables (doesn't support) live reloading of django applications.
>>
>> I'm thinking of having a look at this particular area. Before I do so,
>> I'd like to get an idea of how developers actually develop and debug django
>> applications.
>>
>> Most of the people i've spoken to say they develop as follows:
>> - Fire up the django application with live reload
>> - Start codeing
>> - Test in the browser
>> - Very rarely would they debug an application
>> - i.e. majority of the time they don't launch the application in debug
>> mode
>>
>> How do you work on django applications?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/vEKR34Oo08g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/958b1686-d0b1-4564-b2f6-3e4dcadda72e%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/958b1686-d0b1-4564-b2f6-3e4dcadda72e%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: How to: Django development and debugging

2016-10-23 Thread Don Thilaka Jayamanne
The debugger in python extension for VS Code is comparable to PyCharms 
debugger. In fact it supports all of the features you have mentioned.
Please feel free to try it out:
- https://marketplace.visualstudio.com/items?itemName=donjayamanne.python
- https://github.com/DonJayamanne/pythonVSCode/wiki/Debugging

On Saturday, 22 October 2016 05:56:43 UTC+11, Muizudeen Kusimo wrote:
>
> Hello Folks,
>
> PyCharm makes debugging Django (and other Python) applications very easy. 
> Some of the features which are very helpful include:
>
>1. Ability to choose specific Python Interpreter you want to run the 
>code base against. Useful if you use virtualenv and need to test your code 
>in different Python versions
>2. Standard debugging tools - Step Into, Step Over, Step Out, Watches
>3. Support for debugging other Python libraries tied to your Django 
>application e.g. Lettuce BDD tests, Unit Tests e.t.c
>
> It's definitely worth a try as you can get a lot from the Community Edition
>
> Regards
>
> On Thursday, October 20, 2016 at 8:30:45 PM UTC-4, Don Thilaka Jayamanne 
> wrote:
>>
>> Hi Everyone, I'm the author of a Python plugin for the VS Code editor (
>> https://github.com/DonJayamanne/pythonVSCode). Basically it provides 
>> intellisense, code navigation, debugging (django, multi threads, etc), data 
>> science and the like.
>>
>> When it comes to debugging django applications, today the extension 
>> disables (doesn't support) live reloading of django applications.
>>
>> I'm thinking of having a look at this particular area. Before I do so, 
>> I'd like to get an idea of how developers actually develop and debug django 
>> applications.
>>
>> Most of the people i've spoken to say they develop as follows:
>> - Fire up the django application with live reload 
>> - Start codeing
>> - Test in the browser
>> - Very rarely would they debug an application
>> - i.e. majority of the time they don't launch the application in debug 
>> mode 
>>
>> How do you work on django applications?
>>
>

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


How to: Django development and debugging

2016-10-20 Thread Don Thilaka Jayamanne
Hi Everyone, I'm the author of a Python plugin for the VS Code editor 
(https://github.com/DonJayamanne/pythonVSCode). Basically it provides 
intellisense, code navigation, debugging (django, multi threads, etc), data 
science and the like.

When it comes to debugging django applications, today the extension 
disables (doesn't support) live reloading of django applications.

I'm thinking of having a look at this particular area. Before I do so, I'd 
like to get an idea of how developers actually develop and debug django 
applications.

Most of the people i've spoken to say they develop as follows:
- Fire up the django application with live reload 
- Start codeing
- Test in the browser
- Very rarely would they debug an application
- i.e. majority of the time they don't launch the application in debug mode 

How do you work on django applications?

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


Issue with "Creating forms from Modules"

2014-07-10 Thread Don Fox
While typing in the code 
in https://docs.djangoproject.com/en/1.7/topics/forms/modelforms/ I get a 
a Name Error that doesn't seem related to any omitted import module.

I'm running this is the shell that has the settings* './manage.py shell' * 
where 
I have a project reflecting this particular tutorial.

Thanks!


f = ArticleForm(request.POST)

Traceback (most recent call last):

  File "", line 1, in 

NameError: name 'request' is not defined

-- 
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/b1edf4aa-0857-45d4-bc7f-79ff678e72a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Some creating Forms from models snags.

2014-07-10 Thread Don Fox
Problem went away after PyCharm indicated that two imports be removed? Not 
really sure whet the problem was!

On Wednesday, July 9, 2014 12:09:40 AM UTC-4, Lachlan Musicman wrote:
>
> On 9 July 2014 13:19, Don Fox <foxd...@gmail.com > wrote: 
> > 
> > 
> > I should have mentioned that I already had this method in the models.py: 
> > 
> > class Article (models.Model): 
> > pub_date = models.DateField() 
> > headline = models.CharField(max_length = 30) 
> > content  = models.CharField(max_length=500) 
> > reporter = models.CharField(max_length=20) 
> > 
> > This was assumed to be needed after the definition of the article form 
> in 
> > the shell. 
> > As I said I have that same class ArticleForm in the forms.py 
> > 
> > Thanks for the reply. 
>
> Do you still have the same issue? 
>
> If so I would suggest it's a PATH problem. 
>
> In classBased (which is the folder that has manage.py?), run 
>
> python manage.py 
>
> and then do 
>
> from myapp.models import Article 
>
> if that fails, it is a PATH problem. 
>
> Googling Django PATH has heaps on it, but something like this shows the 
> way: 
>
>
> https://community.webfaction.com/questions/16064/django-module-import-problem 
>
>
> cheers 
> L. 
>
>
>
> -- 
> The idea is that a beautiful image is frameable. Everything you need 
> to see is there: It’s everything you want, and it’s very pleasing 
> because there’s no extra information that you don’t get to see. 
> Everything’s in a nice package for you. But sublime art is 
> unframeable: It’s an image or idea that implies that there’s a bigger 
> image or idea that you can’t see: You’re only getting to look at a 
> fraction of it, and in that way it’s both beautiful and scary, because 
> it’s reminding you that there’s more that you don’t have access to. 
> It’s now sort of left the piece itself and it’s become your own 
> invention, so it’s personal as well as being scary as well as being 
> beautiful, which is what I really like about art like that. 
> ---
>  
>
> Adventure Time http://theholenearthecenteroftheworld.com/ 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To 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/85fe398d-efda-49b4-a820-042bee9539d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Some creating Forms from models snags.

2014-07-08 Thread Don Fox


On Tuesday, July 8, 2014 10:30:23 PM UTC-4, Lachlan Musicman wrote:
>
> There is no class Article in any of those blocks. That's why. 
>
> Try adding this to models.py this: 
>
> class Article(models.Model): 
>   name = models.CharField(max_length=25) 
>   body = models.TextField() 
>   author = models.ForeignKey(Author) 
>
> That should help. 
>
> cheers 
> L. 
>
> On 9 July 2014 11:31, Don Fox <foxd...@gmail.com > wrote: 
> > In the Creating forms from Models documentation 
> > https://docs.djangoproject.com/en/1.6/topics/forms/modelforms/ I'm 
> having 
> > some problems. 
> > 
> > First I'm placing the code from the first block (green section), where 
> the 
> > class ArticleForms is defined in the shell in a forms.py file in a myapp 
> app 
> > of a project. 
> > 
> > Second, the models in the second and third green blocks are located in 
> the 
> > myapp/models.py with the class AuthorForm and class BookForm classes in 
> the 
> > from the first block commented out. 
> > 
> > 
> > On arriving at the 4th green block that has 
> > 
> >>>> from myapp.models import Article 
> >>>> from myapp.forms import ArticleForm 
> > 
> > I get this response from a syncdb: 
> > 
> > 
> > 
> > File 
> > 
> "/Users/donfox1/Projects/DjangoExplorations/PycharmProjects/classBased/myapp/forms.py",
>  
>
> > line 17, in  
> > 
> > from myapp.models import Article 
> > 
> > ImportError: cannot import name Article 
> > 
> > DONs-iMac:classBased donfox1$ 
> > 
> > 
> > 
> > Can anyone tell me why I can't import my Article class from my 
> > app/models.py. 
> > 
> > 
> > -- 
> > 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/d0812a2c-ef08-4615-8255-7657ad6c49e5%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> The idea is that a beautiful image is frameable. Everything you need 
> to see is there: It’s everything you want, and it’s very pleasing 
> because there’s no extra information that you don’t get to see. 
> Everything’s in a nice package for you. But sublime art is 
> unframeable: It’s an image or idea that implies that there’s a bigger 
> image or idea that you can’t see: You’re only getting to look at a 
> fraction of it, and in that way it’s both beautiful and scary, because 
> it’s reminding you that there’s more that you don’t have access to. 
> It’s now sort of left the piece itself and it’s become your own 
> invention, so it’s personal as well as being scary as well as being 
> beautiful, which is what I really like about art like that. 
> ---
>  
>
> Adventure Time http://theholenearthecenteroftheworld.com/ 
>


I should have mentioned that I already had this method in the models.py:

class Article (models.Model):
pub_date = models.DateField()
headline = models.CharField(max_length = 30)
content  = models.CharField(max_length=500)
reporter = models.CharField(max_length=20)

This was assumed to be needed after the definition of the article form in 
the shell. 
As I said I have that same class ArticleForm in the forms.py

Thanks for the reply.
 

-- 
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/02faafc6-0427-4b81-8fbd-a53109150896%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Some creating Forms from models snags.

2014-07-08 Thread Don Fox
In the Creating forms from Models documentation 
*https://docs.djangoproject.com/en/1.6/topics/forms/modelforms/ *I'm having 
some problems.

First I'm placing the code from the first block (green section), where the 
class ArticleForms is defined in the shell in a *forms.py *file in a myapp 
app of a project.

Second, the models in the second and third green blocks are located in the 
myapp/models.py with the class AuthorForm and class BookForm classes in the 
from the first block commented out.  


On arriving at the 4th green block that has

>>> from myapp.models import Article>>> from myapp.forms import ArticleForm

I get this response from a syncdb:



File 
"/Users/donfox1/Projects/DjangoExplorations/PycharmProjects/classBased/myapp/forms.py",
 
line 17, in 

from myapp.models import Article

ImportError: cannot import name Article

DONs-iMac:classBased donfox1$ 


Can anyone tell me why I can't import my Article class from my 
app/models.py.


-- 
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/d0812a2c-ef08-4615-8255-7657ad6c49e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Simple User login not working.

2014-03-19 Thread Don Fox
My project has two superusers who have access to the Django Administration 
and who manually add about 15 Users who should then be able to login and 
use the site to do data entry.

I'm using the standard code in my views


*def auth_view(request):*
*username = request.POST.get('username',' ')*
*password = request.POST.get('password',' ')*
*user = auth.authenticate(username=username, password=password)*

*if user is not None:*
*auth.login(request, user)*
*return HttpResponseRedirect('/accounts/loggedin')*
*else:*
*return HttpResponseRediredt('/accounts/invalid') *


This should check against the users listed in the admin page?


[image: ]


However ther is no acknowledgement from the loggedin.hml template.


Does anything come to mind that I have newgelected to do to get the login 
to work.

-- 
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/23a01c55-436b-4514-8be4-ed6a6915f879%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to migrate a project from one DB to another

2014-01-09 Thread Don Fox
Thanks for responding.
Regarding the small project, I initial tried it but it appeared to no go
well with sqlite3. I need to move over to postgresql soon but first need to
resolve a couple of other issues first.

Thanks again for the response.

Don


On Sun, Dec 29, 2013 at 3:53 AM, Timothy W. Cook <t...@mlhim.org> wrote:

> I recommend using South http://south.aeracode.org/  and just follow the
> tutorial as if it is a new project.  Do you need to migrate data as well as
> the schema?  That may require more manual intervention.
>
> HTH,
> Tim
>
>
> On Sun, Dec 29, 2013 at 3:10 AM, Don Fox <foxdo...@gmail.com> wrote:
>
>> I've started a small project and would like to change from sqlite to
>> postgresql. Is there any established systematic method  to carry this 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/8a1c6d46-fb05-440c-b7bb-d13e3fe82f9f%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/ntt_T0KFPeA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3UQMLtLuFPvock8%3DpJHbXQb%3DDNKjdSQb4yJR-rEDLcxrQ%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/CAP3Q5SLwDWFz8eTgLs4bqMgadSV55RQfM53bPxVBA1o--vpzyw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Accessing database table

2014-01-08 Thread Don Fox
In my manage.py shell I can load the following module:
  *from userprofile.models import NPIdata*

However inside a file of utility functions located in the userprofile app 
the same import statement yields *ImportError:* 'No module named 
userprofile.models'

I'm mystified!

Any hints or help welcome.

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/8e0cd191-7fd0-46f7-979b-aa25234a681d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How to migrate a project from one DB to another

2013-12-28 Thread Don Fox
I've started a small project and would like to change from sqlite to 
postgresql. Is there any established systematic method  to carry this 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/8a1c6d46-fb05-440c-b7bb-d13e3fe82f9f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Python shell displays Segmentation Fault: 11 after upgrade to Mavericks OS

2013-10-24 Thread Don Fox


python manage.py  shell

Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 

[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Type "help", "copyright", "credits" or "license" for more information.

(InteractiveConsole)

>>> from polls.models import Poll, Choice

>>> Poll.objects.all()

Segmentation fault: 11


This type of thing just started after upgrade. I assume there's a 
connection.

-- 
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/dc317488-58b2-4826-9fdb-05c4a06a14c3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Current session lost when redirecting via facebook oauth2

2013-10-01 Thread Don Graham
Hi

I'm running into a problem with django loosing the current session, when I 
redirect an AnnonymousUser to an facebook's oauth.  I set a session 
variable before sending a user to facebook to login via oauth. When they 
get redirected back to my site, the session key changes and the data is 
lost. Before the user is sent to facebook the session key 
"ciwz7qboun03pcan42pn8jew3gaphcuh" exist in the db.  When they return it 
seems to be deleted and replaced by an empty one.

I'm intercepting the redirected request using debug tool bar and I can see 
the following in the template context processor 
"django.core.context_processors.debug"

{u'debug': True, u'sql_queries': [
{u'sql': u"SELECT `django_session`.`session_key`, 
`django_session`.`session_data`, `django_session`.`expire_date` FROM 
`django_session` WHERE (`django_session`.`session_key` = 
'ciwz7qboun03pcan42pn8jew3gaphcuh'  AND `django_session`.`expire_date`> 
'2013-10-01 14:57:27' )", u'time': u'0.001'},
{u'sql': u"SELECT (1) AS `a` FROM `django_session` WHERE 
`django_session`.`session_key` = 'vguth05jxwih234x0dwi8vao7xpw7s7r'  LIMIT 
1", u'time': u'0.000'},
{u'sql': u'SAVEPOINT s140077883270912_x1', u'time': u'0.000'},
{u'sql': u"INSERT INTO `django_session` (`session_key`, `session_data`, 
`expire_date`) VALUES ('vguth05jxwih234x0dwi8vao7xpw7s7r', 
'ZDQ5OWZmZmRmZmJkY2M2M2UyMDRmYjhlYTJlNTIzMzhjYzQ5NjQ5NDqAAn1xAS4=', 
'2013-10-15 14:57:27')", u'time': u'0.000'},
{u'sql': u"SELECT `django_session`.`session_key`, 
`django_session`.`session_data`, `django_session`.`expire_date` FROM 
`django_session` WHERE `django_session`.`session_key` = 
'vguth05jxwih234x0dwi8vao7xpw7s7r' ", u'time': u'0.001'},
{u'sql': u"SELECT `django_session`.`session_key`, 
`django_session`.`session_data`, `django_session`.`expire_date` FROM 
`django_session` WHERE `django_session`.`session_key` = 
'vguth05jxwih234x0dwi8vao7xpw7s7r' ", u'time': u'0.000'}]}


If the user is already logged into my site, this doesn't happen. 

Any suggestions or help would be greatly appreciated!

Thank you
Don
 


-- 
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/6e31256c-9469-404d-a1f7-ebb9378930e8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Validation of generic relation from a GenericInlineModelAdmin

2013-06-05 Thread Calin Don
Hi,

I don't know if this is a bug or expected behavior, but when I'm trying to
create a new generic relation object from a GenericInlineModelAdmin form,
the object's validation methods (eg. clean or validate_unique) don't have
object_id and content_type fields set.

When the generic relation object, already exists object_id and content_type
are properly set.

Here is the sample code:

models.py:
class Article(models.Model):
title = models.CharField(max_length=32)
body = models.TextField()

class TaggedItem(models.Model):
tag = models.SlugField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')

def clean(self, exclude=None):
pass

admin.py:
class InlineTags(generic.GenericTabularInline):
model = TaggedItem

class ArticleAdmin(admin.ModelAdmin):
inlines = [InlineTags]

admin.site.register(Article, ArticleAdmin)

Now if you go to Articles admin and add a tag, in the clean method of
TaggedItem self.object_id and self.content_type are set to None. If the tag
is being edited they are set accordingly.

I tried on both django 1.4.x and 1.5.x.

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




Aggregate on part of a date field?

2010-09-07 Thread Don
I need to create a query that aggregates values by the year of a date
field. I have not been able to discover a way to do this yet, perhaps
someone can help. I can issue the following raw query, which gives the
results I want:

cursor.execute("""SELECT year(oac_date) as year, month(oac_date) as
month, sum(oac_actualconsumption) as consumption
 FROM actualconsumption
WHERE oac_object = %s AND oac_commodity = %s AND
year(oac_date) = %s
GROUP BY year(oac_date), month(oac_date)
ORDER BY month(oac_date)""", [object_id, commodity, year])

Where oac_object is the pk for the table.

This summarizes the oac_actualconsumption by year. Does anyone have an
idea how to do this without resorting to a raw query? I have not been
able to get the aggregates to work over parts of a date field in the
database, only on the whole field.

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



MySQLdb problem in conjunction with MAMP

2009-12-27 Thread Don Fox
I'm trying to setup MySQLdb but mysql is located @  
/Applications/MAMP/Library/bin/mysql because of the installation of MAPI.

My  .profile has:  export 
PATH="/usr/local/bin:/usr/local/sbin:/Applications/MAMP/Library/bin:$PATH"

The 'python 'setup.py build' and 
   ' sudo python setup.py install'  cmds seem to go as expected but I get 
this when attempting to import it.

python manage.py shell
Python 2.6.1 (r261:67515, Jul  9 2009, 14:20:26) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.shortcuts import render_to_response
>>> import MySQLdb
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg/MySQLdb/__init__.py",
 line 19, in 
  File 
"/Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg/_mysql.py",
 line 7, in 
  File 
"/Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg/_mysql.py",
 line 6, in __bootstrap__
ImportError: 
dlopen(/Users/donfox1/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so,
 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient_r.16.dylib
  Referenced from: 
/Users/donfox1/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
  Reason: image not found


Does anyone know a fix?

Thanks

Don Fox

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.




ModelChoiceField Work around or danger

2009-10-14 Thread Don Guernsey
I was struggling to find a solution to the ModelChoiceField looking up
100,000 students every time I wanted to add an RtI so I did the following.
Can anyone find problems with this, or have an alternate solution...This
does work though
Instead of using an id I used a student_number as an IntegerField (on the
form and it's hidden) and then checked if that integer was a key in the
request.POST return and then did a get_object_or_404. Indentations are
probably wrong on this email, so you may have to correct them. I made the
foreign keys null=True and blank=True to avoid any conflicts there. I know I
have to probably clean the data too.

def create_student_rti_background(request, student_id):
   if request.method == "POST":
form = StudentRtiBackgroundForm(request.POST)
if form.is_valid():
student_rti_background = form.save(commit=False)
if request.POST.has_key('school_district_number'):
school_district_number = request.POST['school_district_number']
student_rti_background.school_district = get_object_or_404(SchoolDistrict,
pk=int(school_district_number))
if request.POST.has_key('student_number'):
student_number = request.POST['student_number']
student_rti_background.student = get_object_or_404(Student,
pk=int(student_number))
student_rti_background.save()
url='/ess/student/StudentRtiBackground/%s' % str(student.id)
return HttpResponseRedirect(url)
else:
url='/ess/student/StudentRtiBackground/New/%s' % student.id
return HttpResponseRedirect(url)
else:
profile = get_object_or_404(UserProfile, user=request.user)
school_district = profile.school_district
student = get_object_or_404(Student, pk=student_id)
form = StudentRtiBackgroundForm(initial={'student_number':int(student.id),
'school_district_number':int(school_district.id)})

--~--~-~--~~~---~--~~
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: dates() and annotate()

2009-06-08 Thread Don Spaulding



On Jun 8, 3:54 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Mon, Jun 8, 2009 at 3:42 PM, Don Spaulding <donspauldin...@gmail.com>wrote:
>
>
>
>
>
> > Hi there,
>
> > While playing around with the aggregation support in trunk, I came up
> > with the need for the following SQL query:
>
> > SELECT
> >        DATE_TRUNC('day', datestamp) AS rec_day,
> >        COUNT(id) AS count
> > FROM stats_record
> > GROUP BY rec_day
>
> > How would I construct this same query via the ORM?  My intuition tells
> > me "just combine the .dates() and .annotate() queryset methods", as
> > in:
>
> > qs.dates('datestamp', 'day').annotate(num_on_day=Count('id'))
>
> > But the interactive shell gives me no joy with that query, simply
> > returning the dates.  I'm not sure what I would expect it to return
> > (I'm certainly not expecting a setattr on a datetime instance), maybe
> > the equivalent of a .values() call with just the field specified in
> > the .dates() call and the annotation alias (e.g.  {'datestamp':
> > datetime(2009,3,23,0,0), 'num_on_day': 12}).  That would make sense to
> > me, but I'm not sure if that requires reading the user's mind behind
> > the scenes.
>
> > Am I just being dense and missing an easier way to do this with the
> > Aggregation support already in trunk?
>
> Unfortunately this isn't really possible as it is.  There are a number of
> places where aggregates (and F objects) don't really interact with dates
> well.  The way I would handle it is to create a custom aggregate for doing
> the date lookup, and then use values, so the final syntax would be.
>
> Model.objects.annotate(rec_day=Date('datestamp',
> 'day')).values('rec_day').annotate(Count('id')).
>
> Which should work (I think ;) ).  Search the mailing list for some info on
> custom aggregate objects (they're not super difficult).
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero

(Sort of) using the technique Russell described in the Custom
Aggregate Objects thread [1], what follows is my stab at a DateTrunc
aggregate for postgres that tries to mimic the functionality provided
by the dates() queryset method.


from django.db.models.sql.aggregates import Aggregate

class DateTrunc(Aggregate):
"""
An aggregate that returns unique date values according to the
arguments
specified for 'kind' and 'field'
"""
sql_function = 'DATE_TRUNC'
sql_template = "%(function)s('%(kind)s', %(field)s)"

def __init__(self, col, kind, **extra):
super(DateTrunc, self).__init__(col, kind=kind, **extra)
self.col = col
self.lookup = col
self.kind = kind

def _default_alias(self):
return '%s__%s' % (self.col, self.kind)
default_alias = property(_default_alias)

def add_to_query(self, query, alias, col, source, is_summary):
query.aggregate_select[alias] = self


Which really wasn't too hard (thanks Django Devs!).  Unfortunately, I
can't seem to find a way to get it to append a GROUP BY clause onto
the query.  I stumbled upon a comment on ticket #10302 [2] (a similar
problem) that ultimately led me to this query:

qs.extra(select={'rec_date':"DATE_TRUNC('day', datestamp)"}).values
('rec_date').annotate(num_on_day=Count('id'))

Obviously extra() is not the preferred method, but until custom
aggregates support GROUP BY or DatesQuerySet intuitively supports
further annotation, it'll do.  Fortunately, I'm the patient type when
other people are working for me for free ;-)

Thanks,
Don


[1]:  
http://groups.google.com/group/django-users/browse_thread/thread/bd5a6b329b009cfa/
[2]:  http://code.djangoproject.com/ticket/10302
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



dates() and annotate()

2009-06-08 Thread Don Spaulding

Hi there,

While playing around with the aggregation support in trunk, I came up
with the need for the following SQL query:

SELECT
DATE_TRUNC('day', datestamp) AS rec_day,
COUNT(id) AS count
FROM stats_record
GROUP BY rec_day

How would I construct this same query via the ORM?  My intuition tells
me "just combine the .dates() and .annotate() queryset methods", as
in:

qs.dates('datestamp', 'day').annotate(num_on_day=Count('id'))

But the interactive shell gives me no joy with that query, simply
returning the dates.  I'm not sure what I would expect it to return
(I'm certainly not expecting a setattr on a datetime instance), maybe
the equivalent of a .values() call with just the field specified in
the .dates() call and the annotation alias (e.g.  {'datestamp':
datetime(2009,3,23,0,0), 'num_on_day': 12}).  That would make sense to
me, but I'm not sure if that requires reading the user's mind behind
the scenes.

Am I just being dense and missing an easier way to do this with the
Aggregation support already in trunk?
--~--~-~--~~~---~--~~
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: annotate() + order_by() == aborted transaction?

2009-06-03 Thread Don Spaulding



On Jun 3, 7:11 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> On Jun 3, 5:59 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
>
>
>
> > On Jun 3, 5:22 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
>
> > > On Jun 3, 3:05 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
> > > > On Wed, Jun 3, 2009 at 3:03 PM, Don Spaulding 
> > > > <donspauldin...@gmail.com>wrote:
>
> > > > > bump.
>
> > > > > Can anyone tell me if this looks like a bug in Django?
>
> > > > > On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> > > > > > Hi all,
>
> > > > > > I've got a quick use case that I think should work according to the
> > > > > > docs, but it's not.  In this case, Domain objects have a reverse 
> > > > > > fkey
> > > > > > relation named "reports", and the Report model has an "updated"
> > > > > > field.  I'd like to annotate and order Domains by the max value of
> > > > > > "updated" for all related reports.  The following interactive 
> > > > > > session
> > > > > > shows the behavior pretty well.
>
> > > > > > >>> qs =
> > > > > Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
> > > > > > >>> qs.count()
> > > > > > 1577
> > > > > > >>> print qs[0].last_updated
>
> > > > > > IndexError: list index out of range>>> qs.count()
>
> > > > > > InternalError: current transaction is aborted, commands ignored 
> > > > > > until
> > > > > > end of transaction block
>
> > > > > > >>> connection._rollback()
>
> > > > > > If I drop off the order_by call, things appear to work again.
>
> > > > > > >>> qs = 
> > > > > > >>> Domain.objects.annotate(last_updated=Max('reports__updated'))
> > > > > > >>> qs.count()
> > > > > > 1577
> > > > > > >>> print qs[0].last_updated
>
> > > > > > 2009-05-28 13:25:55.027600
>
> > > > > > What am I missing here (besides a thorough understanding of
> > > > > > aggregation)?
>
> > > > It looks like a bug in django at first glance.  Out of curiosity what
> > > > version of Django is it, since it looks a tiny bit like an old bug with
> > > > queryset chaining, but I think that was fixed even before the first 
> > > > beta.
> > > >>> django.get_version()
>
> > > u'1.1 beta 1 SVN-10916'
>
> > Hmm, after updating to u'1.1 beta 1 SVN-10921' I'm now getting a
> > psycopg2.ProgrammingError:  ORDER BY "last_updated" is ambiguous.
>
> > I've put the SQL it generates (I've only sanitized the two table
> > names) up athttp://dpaste.com/51213/
>
> And of course, therein lies my problem, I've gone and tried to
> annotate each record with a 'last_updated' calculation, and the model
> already has an actual 'last_updated' field.  The error only shows up
> when django tries to tell the SQL engine to order_by something that's
> been defined twice in the query.
>
> I'll raise a ticket on the tracker about possibly raising an exception
> instead of allowing users (stupid ones like me) to clobber their own
> namespaces.

Ticket filed at: http://code.djangoproject.com/ticket/11256
--~--~-~--~~~---~--~~
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: annotate() + order_by() == aborted transaction?

2009-06-03 Thread Don Spaulding



On Jun 3, 5:59 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> On Jun 3, 5:22 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
>
>
>
> > On Jun 3, 3:05 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
> > > On Wed, Jun 3, 2009 at 3:03 PM, Don Spaulding 
> > > <donspauldin...@gmail.com>wrote:
>
> > > > bump.
>
> > > > Can anyone tell me if this looks like a bug in Django?
>
> > > > On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> > > > > Hi all,
>
> > > > > I've got a quick use case that I think should work according to the
> > > > > docs, but it's not.  In this case, Domain objects have a reverse fkey
> > > > > relation named "reports", and the Report model has an "updated"
> > > > > field.  I'd like to annotate and order Domains by the max value of
> > > > > "updated" for all related reports.  The following interactive session
> > > > > shows the behavior pretty well.
>
> > > > > >>> qs =
> > > > Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
> > > > > >>> qs.count()
> > > > > 1577
> > > > > >>> print qs[0].last_updated
>
> > > > > IndexError: list index out of range>>> qs.count()
>
> > > > > InternalError: current transaction is aborted, commands ignored until
> > > > > end of transaction block
>
> > > > > >>> connection._rollback()
>
> > > > > If I drop off the order_by call, things appear to work again.
>
> > > > > >>> qs = Domain.objects.annotate(last_updated=Max('reports__updated'))
> > > > > >>> qs.count()
> > > > > 1577
> > > > > >>> print qs[0].last_updated
>
> > > > > 2009-05-28 13:25:55.027600
>
> > > > > What am I missing here (besides a thorough understanding of
> > > > > aggregation)?
>
> > > It looks like a bug in django at first glance.  Out of curiosity what
> > > version of Django is it, since it looks a tiny bit like an old bug with
> > > queryset chaining, but I think that was fixed even before the first beta.
> > >>> django.get_version()
>
> > u'1.1 beta 1 SVN-10916'
>
> Hmm, after updating to u'1.1 beta 1 SVN-10921' I'm now getting a
> psycopg2.ProgrammingError:  ORDER BY "last_updated" is ambiguous.
>
> I've put the SQL it generates (I've only sanitized the two table
> names) up athttp://dpaste.com/51213/

And of course, therein lies my problem, I've gone and tried to
annotate each record with a 'last_updated' calculation, and the model
already has an actual 'last_updated' field.  The error only shows up
when django tries to tell the SQL engine to order_by something that's
been defined twice in the query.

I'll raise a ticket on the tracker about possibly raising an exception
instead of allowing users (stupid ones like me) to clobber their own
namespaces.
--~--~-~--~~~---~--~~
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: annotate() + order_by() == aborted transaction?

2009-06-03 Thread Don Spaulding



On Jun 3, 5:22 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> On Jun 3, 3:05 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
>
>
> > On Wed, Jun 3, 2009 at 3:03 PM, Don Spaulding 
> > <donspauldin...@gmail.com>wrote:
>
> > > bump.
>
> > > Can anyone tell me if this looks like a bug in Django?
>
> > > On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> > > > Hi all,
>
> > > > I've got a quick use case that I think should work according to the
> > > > docs, but it's not.  In this case, Domain objects have a reverse fkey
> > > > relation named "reports", and the Report model has an "updated"
> > > > field.  I'd like to annotate and order Domains by the max value of
> > > > "updated" for all related reports.  The following interactive session
> > > > shows the behavior pretty well.
>
> > > > >>> qs =
> > > Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
> > > > >>> qs.count()
> > > > 1577
> > > > >>> print qs[0].last_updated
>
> > > > IndexError: list index out of range>>> qs.count()
>
> > > > InternalError: current transaction is aborted, commands ignored until
> > > > end of transaction block
>
> > > > >>> connection._rollback()
>
> > > > If I drop off the order_by call, things appear to work again.
>
> > > > >>> qs = Domain.objects.annotate(last_updated=Max('reports__updated'))
> > > > >>> qs.count()
> > > > 1577
> > > > >>> print qs[0].last_updated
>
> > > > 2009-05-28 13:25:55.027600
>
> > > > What am I missing here (besides a thorough understanding of
> > > > aggregation)?
>
> > It looks like a bug in django at first glance.  Out of curiosity what
> > version of Django is it, since it looks a tiny bit like an old bug with
> > queryset chaining, but I think that was fixed even before the first beta.
> >>> django.get_version()
>
> u'1.1 beta 1 SVN-10916'

Hmm, after updating to u'1.1 beta 1 SVN-10921' I'm now getting a
psycopg2.ProgrammingError:  ORDER BY "last_updated" is ambiguous.

I've put the SQL it generates (I've only sanitized the two table
names) up at http://dpaste.com/51213/
--~--~-~--~~~---~--~~
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: annotate() + order_by() == aborted transaction?

2009-06-03 Thread Don Spaulding



On Jun 3, 3:05 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Wed, Jun 3, 2009 at 3:03 PM, Don Spaulding <donspauldin...@gmail.com>wrote:
>
>
>
>
>
> > bump.
>
> > Can anyone tell me if this looks like a bug in Django?
>
> > On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> > > Hi all,
>
> > > I've got a quick use case that I think should work according to the
> > > docs, but it's not.  In this case, Domain objects have a reverse fkey
> > > relation named "reports", and the Report model has an "updated"
> > > field.  I'd like to annotate and order Domains by the max value of
> > > "updated" for all related reports.  The following interactive session
> > > shows the behavior pretty well.
>
> > > >>> qs =
> > Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
> > > >>> qs.count()
> > > 1577
> > > >>> print qs[0].last_updated
>
> > > IndexError: list index out of range>>> qs.count()
>
> > > InternalError: current transaction is aborted, commands ignored until
> > > end of transaction block
>
> > > >>> connection._rollback()
>
> > > If I drop off the order_by call, things appear to work again.
>
> > > >>> qs = Domain.objects.annotate(last_updated=Max('reports__updated'))
> > > >>> qs.count()
> > > 1577
> > > >>> print qs[0].last_updated
>
> > > 2009-05-28 13:25:55.027600
>
> > > What am I missing here (besides a thorough understanding of
> > > aggregation)?
>
> It looks like a bug in django at first glance.  Out of curiosity what
> version of Django is it, since it looks a tiny bit like an old bug with
> queryset chaining, but I think that was fixed even before the first beta.


>>> django.get_version()
u'1.1 beta 1 SVN-10916'

--~--~-~--~~~---~--~~
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: annotate() + order_by() == aborted transaction?

2009-06-03 Thread Don Spaulding

bump.

Can anyone tell me if this looks like a bug in Django?

On Jun 1, 6:12 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> Hi all,
>
> I've got a quick use case that I think should work according to the
> docs, but it's not.  In this case, Domain objects have a reverse fkey
> relation named "reports", and the Report model has an "updated"
> field.  I'd like to annotate and order Domains by the max value of
> "updated" for all related reports.  The following interactive session
> shows the behavior pretty well.
>
> >>> qs = 
> >>> Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
> >>> qs.count()
> 1577
> >>> print qs[0].last_updated
>
> IndexError: list index out of range>>> qs.count()
>
> InternalError: current transaction is aborted, commands ignored until
> end of transaction block
>
> >>> connection._rollback()
>
> If I drop off the order_by call, things appear to work again.
>
> >>> qs = Domain.objects.annotate(last_updated=Max('reports__updated'))
> >>> qs.count()
> 1577
> >>> print qs[0].last_updated
>
> 2009-05-28 13:25:55.027600
>
> What am I missing here (besides a thorough understanding of
> aggregation)?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



annotate() + order_by() == aborted transaction?

2009-06-01 Thread Don Spaulding

Hi all,

I've got a quick use case that I think should work according to the
docs, but it's not.  In this case, Domain objects have a reverse fkey
relation named "reports", and the Report model has an "updated"
field.  I'd like to annotate and order Domains by the max value of
"updated" for all related reports.  The following interactive session
shows the behavior pretty well.

>>> qs = 
>>> Domain.objects.annotate(last_updated=Max('reports__updated')).order_by('last_updated')
>>> qs.count()
1577
>>> print qs[0].last_updated
IndexError: list index out of range
>>> qs.count()
InternalError: current transaction is aborted, commands ignored until
end of transaction block
>>> connection._rollback()

If I drop off the order_by call, things appear to work again.

>>> qs = Domain.objects.annotate(last_updated=Max('reports__updated'))
>>> qs.count()
1577
>>> print qs[0].last_updated
2009-05-28 13:25:55.027600

What am I missing here (besides a thorough understanding of
aggregation)?
--~--~-~--~~~---~--~~
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 count objects for each date in django.views.generic.date_based.archive_index?

2009-05-22 Thread Don Spaulding



On May 22, 8:16 pm, Don Spaulding <donspauldin...@gmail.com> wrote:
> On May 22, 1:13 pm, Laurent Meunier <laur...@deltalima.net> wrote:
>
>
>
> > Hi list!
>
> > I'm looking for a way to have the number of objects for each date in
> > the date_list object for the generic view date_based.archive_index.
>
> > For example:
> > - 2009: 12 objects
> > - 2008: 10 objects
>
> > I saw that the generic view is using the method
> > mymodel.objects.dates(), maybe I can override it. But how?
>
> > For now, I'm stick with a static method in my model Class. This method
> > uses raw sql.
>
> >     @staticmethod
> >     def years():
> >         from django.db import connection
> >         cursor = connection.cursor()
> >         cursor.execute(" \
> >             SELECT p.published_date, COUNT(*) \
> >             FROM phog_photo p \
> >             WHERE p.is_published = 1 AND p.published_date <= '%s' \
> >             GROUP BY YEAR(published_date) \
> >             ORDER BY 1 DESC" % datetime.now().strftime("%Y-%m-%d
> >     %H:%M:%S")) result_list = []
> >         for row in cursor.fetchall():
> >             y = (row[0], row[1])
> >             result_list.append(y)
> >         return result_list
>
> > Is there a better and more elegant way to do this? I would like to
> > avoid raw sql as far as possible.
>
> > Thanks.
>
> > --
> > Laurent Meunier <laur...@deltalima.net>
>
> I'm sure there's a better way, but are you looking for something like
> this?
>
> {% regroup latest by published_date as year_list %}
>
> {% for year_group in year_list %}
> Year: {{ year_group.grouper }}  Num photos: {{ year_group.list|
> length }}
> {% endfor %}

Doh!  Just realized that'll get them grouped by the date, not the
date's year.  An easy, though not necessarily elegant, fix for that
would be to group by a published_year property on your model, that
simply looked up self.published_date.year.  Heading down this trail,
you come within throwing distance of SQL-looks-cleaner-ville  ;-)
--~--~-~--~~~---~--~~
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 count objects for each date in django.views.generic.date_based.archive_index?

2009-05-22 Thread Don Spaulding



On May 22, 1:13 pm, Laurent Meunier  wrote:
> Hi list!
>
> I'm looking for a way to have the number of objects for each date in
> the date_list object for the generic view date_based.archive_index.
>
> For example:
> - 2009: 12 objects
> - 2008: 10 objects
>
> I saw that the generic view is using the method
> mymodel.objects.dates(), maybe I can override it. But how?
>
> For now, I'm stick with a static method in my model Class. This method
> uses raw sql.
>
>     @staticmethod
>     def years():
>         from django.db import connection
>         cursor = connection.cursor()
>         cursor.execute(" \
>             SELECT p.published_date, COUNT(*) \
>             FROM phog_photo p \
>             WHERE p.is_published = 1 AND p.published_date <= '%s' \
>             GROUP BY YEAR(published_date) \
>             ORDER BY 1 DESC" % datetime.now().strftime("%Y-%m-%d
>     %H:%M:%S")) result_list = []
>         for row in cursor.fetchall():
>             y = (row[0], row[1])
>             result_list.append(y)
>         return result_list
>
> Is there a better and more elegant way to do this? I would like to
> avoid raw sql as far as possible.
>
> Thanks.
>
> --
> Laurent Meunier 

I'm sure there's a better way, but are you looking for something like
this?

{% regroup latest by published_date as year_list %}

{% for year_group in year_list %}
Year: {{ year_group.grouper }}  Num photos: {{ year_group.list|
length }}
{% endfor %}
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



strange problem in uploading image file

2009-05-13 Thread don ilicis
hi all:
   I was trying to rewrite the clean_XX() method like this:


1def clean_media(self):
2
3 # save from a upload file
4 data = self.cleaned_data['media']
5 tmp = open('img.jpg','wr')
6 tmp.write(data.read())
7 tmp.close()
8
9 # open it
10   a = img.open('img.jpg','r')
11   if max(a.size[0], a.size[1]) > 78:
12raise forms.ValidationError("pic too big")



this line:  a = img.open('img.jpg','r')   throw a error "

Caught an exception while rendering: cannot identify image file

"


but I try it again with save or open alone( delete line 4-7 or delete line
10-12 ), it works

does anyone know something about this?

--~--~-~--~~~---~--~~
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 in Linux

2009-04-21 Thread don ilicis
2009/4/21 galileo 

>
> How we use Django in Linux?
>
> >
>

http://docs.djangoproject.com/

--~--~-~--~~~---~--~~
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: Your IDE of choice

2009-01-07 Thread don ilicis
2009/1/7 Kenneth Gonsalves 

>
> On Tuesday 06 Jan 2009 5:18:57 pm HB wrote:
> > What is your favorite IDE for coding Django projects?
>
> geany
>
> --
> regards
> KG
> http://lawgon.livejournal.com
>
> >
> me too
and also gedit / vim

--~--~-~--~~~---~--~~
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: Multi table inheritance and admin

2008-09-19 Thread Don



On Sep 19, 11:09 am, Donn <[EMAIL PROTECTED]> wrote:
> Hi,
> I have these models:
> Book, Album (etc.) and they are "grouped" in Res (for Resources)
> My code is at :http://dpaste.com/79178/
>
> Is there some (simple) way to get admin to work like this:
> Edit a Res --> the inline shows the Book class OR album class *depending* on
> what the class of the object in Res.
>
> For example:
> Edit Res (book):
> title, publisher show up.
> Under that:
> author, vol
>
> Edit Res(album):
> title, publisher show up.
> Under that:
> artist
>
> At the moment I have scraped together arcane bits of code to make my basic
> models and get some way of extracting an Object from the Res table. But I
> don't know how to give admin the same power.
>
> \d

If I understand what you are trying to do, I suggest that you put the
following in your admin.py:

class BookAdmin(admin.StackedInline):
model = Book

class AlbumAdmin(admin.StackedInline):
model = Album

class ResAdmin(admin.ModelAdmin):
inlines = [ BookAdmin,
   AlbumAdmin,
   ]

admin.site.register(Res, ResAdmin)

More info on inlines available here:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects

Take care,
Don

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



one-to-many vs. many-to-one in admin

2008-09-19 Thread Don Jennings

I have the following situation:

-a manufacturer makes several different products (one-to-many)
-a manufacturer may have one or more production locations (one-to-many)
-each product may be made at one or more of the manufacturer's
locations and a location might produce multiple products
(many-to-many)

>From the database side, it seems to me that the following setup makes
the most sense:

class Manufacturer(models.Model):
# ...

class MfrLocation(models.Model):
manufacturer = models.ForeignKey(Manufacturer)
# ...

class Product(models.Model):
manufacturer = models.ForeignKey(Manufacturer)
mfr_locations = models.ManyToManyField(MfrLocation)
# ...

For the admin interface, inlines allows me to get the locations and
products on the same page as the manufacturer. This would be fine
except, from the user perspective, the product is actually primary. In
other words, they would expect to add a new product and, if info about
the manufacturer and location(s) aren't already available, to enter
that data on the same page.

So, is there a way to have the Manufacturer and MfrLocation be inline
to the Product admin page? (I tried that and get a Manufacturer has no
ForeignKey to Product error.) Or is there another way to design the
models?

Thanks!

Take care,
Don

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Queryset-refactor branch has been merged into trunk

2008-04-28 Thread Don Spaulding II


Malcolm Tredinnick wrote:
> I merged queryset-refactor into trunk just now. This was changeset
> r7477.
Thanks for all of your effort on this, Malcolm.


Malcolm's Amazon Wishlist:
http://www.amazon.com/gp/registry/registry.html?ie=UTF8=wishlist=1VB5A16R2KV0T
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: mod_python or fcgi

2008-04-24 Thread Don Spaulding



On Apr 24, 6:34 am, Rufman <[EMAIL PROTECTED]> wrote:
> Hey Graham
>
> thanks for the insight
>
> Stephane

I won't debate any of what Graham has said, as it's a pretty standard
answer from what I've seen, and he's a lot smarter than me.  I just
want to note that fastcgi makes a nice separation between app and web
server for my needs.  I hated having to restart apache to restart my
app, and fastcgi on lighttpd made app deployment stupidly easy (not
that apache/mod_python is rocket science).

Don Spaulding
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Calling self.related_object.save() from self.save() ???

2008-04-24 Thread Don Spaulding



On Apr 23, 7:23 pm, "Jorge Vargas" <[EMAIL PROTECTED]> wrote:
> On Wed, Apr 23, 2008 at 11:09 AM, Don Spaulding
>
> <[EMAIL PROTECTED]> wrote:
>
> >  On Apr 22, 11:24 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> >  wrote:
>
> > > On Tue, 2008-04-22 at 13:47 -0700, Don Spaulding wrote:
>
> >  > [...]
>
> >  > > I try to do something like this:
>
> >  > > order = Order()
> >  > > order.save()
> >  > > order.items.create(price=Decimal("5.00"))
> >  > > order.total #gives me 0
> >  > > order.save()
> >  > > order.total #gives me the correct order.total
>
> >  > > My guess is that even though I've saved the item before calling
> >  > > order.save(), the order objects still doesn't know that the new item
> >  > > is related to it.  Anybody know if this is expected behavior?
>
> >  > Yes, it is expected. As Jorge noted, the "order" instance is a snapshot
> >  > of the data at one moment in time, not a live update.
>
> >  Thanks Malcolm and Jorge.  I didn't understand Jorge's response the
> >  first couple times I read it, but now it seems a bit clearer.
>
> sry for that sometimes I sound confusing.

No worries, you were right, I just didn't get it.

>
> >  I can accept that the item's self.order is stale in Item.save().  But
> >  my use case is still "Every time I add an item to an order, the
> >  order's total needs updated".  How can I force the order to hit the DB
> >  again to find all of its (freshly) related objects?
>
> I believe the only way is how you are doing it.
Well that's not very good news, considering the way I'm doing it
doesn't work :-)
> now let me ask a
> question why you need that? can't this be done in the controller? are
> you updating the price total many times per call? why not do it all in
> memory and then save ones? if you take all that out of the model and
> into the controller (maybe even a function) you could do something
> like this.
> new_order = Order()
> new_order.total = sum(new_order.items.all())
> order.save()

That's more or less what I'm having to do right now.  My goal was to
keep the code that consumes this model from having to explicitly
call .save() every time the order has an item added to it.  The item
gets saved and related to an order when order.items.create() is
called, so there's no reason (in my brain) why the total should not
immediately reflect that change, thus my desire to call
self.order.save() from Item.save().  Right now I just make sure to
call order.save() after every order.items.create(), but it feels like
a bad workaround for my desired behavior.

All that being said, I don't need any more of a resolution for this,
since I have the workaround, but I'm still *very* open to ideas about
how it can be done differently.

Thanks,
Don Spaulding
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Calling self.related_object.save() from self.save() ???

2008-04-22 Thread Don Spaulding

I think I must have fallen through the cracks of "nobody will ever
want to do *this*" when building this app.  Given the following two
models (simplified for clarity):

class Order(models.Model):
total = models.DecimalField(...)

def save(self):
tmp_total = Decimal()
for item in self.items.all():
tmp_total += item.price
self.total = tmp_total
super(Order, self).save()

class Item(models.Model):
order = models.ForeignKey(Order, related_name='items')
price = models.DecimalField(...)

def save(self):
super(Item, self).save()
self.order.save()

I try to do something like this:

order = Order()
order.save()
order.items.create(price=Decimal("5.00"))
order.total #gives me 0
order.save()
order.total #gives me the correct order.total

My guess is that even though I've saved the item before calling
order.save(), the order objects still doesn't know that the new item
is related to it.  Anybody know if this is expected behavior?

Thanks,
Don
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



too see free softare notes

2008-02-09 Thread don


earnac.blogspot.com/g933052
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Street address normalisation

2007-11-20 Thread Don Arbow

On Nov 20, 2007, at 3:18 PM, Jeremy Dunck wrote:
>
> On Nov 20, 2007 3:26 PM, hajo <[EMAIL PROTECTED]> wrote:
>>
>> Thanks a lot; will defintely look into this one!
>> The other solution I looked at was to send an address to google (We
>> have a commercial deal with them; I work for a failry large
>> newspaper); get it geocoded and then go from there... The issue here
>> is one of time...
>
> Time to implement, or run-time?  Implementing is not that hard...
> http://www.google.com/uds/solutions/localsearch/reference.html



Perl has a nice library, Geo-StreetAddress, that does some parsing and  
normalization. I looked at porting it to Python, but it has some crazy  
regex code in it. You should be able to call it from Django.

The page below has some other options (like scraping the US Postal  
Service website).

http://search.cpan.org/~sderle/Geo-StreetAddress-US-0.99/US.pm

Don

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: spam

2007-11-07 Thread Don Arbow

> On Nov 7, 2007, at 4:45 PM, Don Arbow wrote:
>>
>> I usually go to the Google Groups web site for this and the dev  
>> group. There is a link in each message that you can use to report  
>> it as spam. I find that Google seems to be pretty quick to ban a  
>> specific user who is spam bombing groups.

Just to follow up, I mentioned Google's excellent filtering and  
banning regime. My email inbox has 8 messages (4 unique with  
duplicates) from a certain someone that were posted this morning in  
the developers group. None of those messages appear in Google's online  
web site. Like any neighborhood with a graffiti problem, I think  
Google recognizes that users who report spam in their groups are more  
likely to get the "cops" to come around and help clean up, so report  
spammers to Google when you get a chance.

For those of you who would like to read messages and not have to worry  
about the boss wondering what you're looking at, reading Google Groups  
online may be a good option.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: spam

2007-11-07 Thread Don Arbow

On Nov 7, 2007, at 2:08 PM, Todd O'Bryan wrote:
>
> Does anyone know if those of us with gmail clicking the Report Spam
> button connects back to Google Groups, or are we just protecting
> ourselves?


I usually go to the Google Groups web site for this and the dev group.  
There is a link in each message that you can use to report it as spam.  
I find that Google seems to be pretty quick to ban a specific user who  
is spam bombing groups.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: python script

2007-10-03 Thread Don Arbow

On Oct 3, 2007, at 7:55 AM, Xan wrote:
>
> In http://code.djangoproject.com/ticket/5534 there is a howto for
> doing that.
> But it's only when the script is in the root project directory.
> What happens if we want the script in other location? What line we
> have to add?
>
> Thanks a lot,
> Xan.



Everything you wanted to know about running Django from a script:

http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: create_or_update() shortcut

2007-08-02 Thread Don Arbow

On Aug 2, 2007, at 2:01 AM, Jens Diemer wrote:
>
> We have the shortcut get_or_create() [1], but whats about a  
> create_or_update() ?
>
> [1] http://www.djangoproject.com/documentation/db-api/#get-or- 
> create-kwargs


The shortcut already exists, it's called save().

http://www.djangoproject.com/documentation/db-api/#how-django-knows- 
to-update-vs-insert

Don

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Flex integration, best practices?

2007-07-12 Thread Don Arbow

On Jul 12, 2007, at 6:03 AM, Jeremy Dunck wrote:
>
> You might want to check out DjangoAMF:
> http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en
>
> It's specifically for Adobe XML messaging.  It adapts Flex's requests
> to regular Django views.


Actually, AMF is a compact binary format that allows you to send  
serialized objects. DjangoAMF allows you to convert these binary  
objects to/from Python objects. Using AMF eliminates the XML parsing  
required in the client.

Don

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Returning a javascript command

2007-07-09 Thread Don Spaulding II

I think you meant to escape those single-quotes in your js call:

return
render_to_response('javascript:AjaxTabs.OpenTab(getUniqueId("tab_page"),"Success","html/
test.html",true,\'\')', {'generic': file })


Rishtastic wrote:
> Right now I am trying;
> ...
> return
> render_to_response('javascript:AjaxTabs.OpenTab(getUniqueId("tab_page"),"Success","html/
> test.html",true,'')', {'generic': file })
> ...
>   

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Rendering a template to the browser on the fly using an iterator?

2007-07-04 Thread Don Arbow

On Jul 4, 2007, at 3:52 PM, Steve Bergman wrote:
> I'd like to be able to render a template straight down the wire to the
> browser on the fly.
>
> Is this possible?


This was discussed a few weeks ago on the developer list:

http://groups.google.com/group/django-developers/browse_frm/thread/ 
328685ac73959701/7cf4a6f68fffc3e5?lnk=gst=template+rendering+as 
+iteration=1#7cf4a6f68fffc3e5

It was fixed in changeset 5482 but then backed out in 5511, while  
they check for side-effect bugs.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Including [django-users] in subject line?

2007-06-11 Thread Don Arbow

On Jun 11, 2007, at 3:22 PM, Mike Schinkel wrote:

>  But I've found a workable solution (note the subject of
> my reply), so I can stay subscribed. I just know now not to ever ask
> for anything to be changed. ;-)

You previously mentioned that one-key filtering only works with  
subject, body, or common fields. Well, every message in the django- 
users mailing list contains the word "django" in the unsubscribe and  
posting links at the bottom of its body text. Why not filter on that?

In the process, you've just screwed up mail readers that thread  
messages based on subject text. This post is now no longer connected  
to the original thread (or wasn't until I edited it). Others that  
wish to reply to a post and keep it in the original thread need to  
edit the subject line prior to sending. It may be "workable" for you,  
but you've now created more work for others.

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Deployment Headache (Apache Permissions?)

2007-06-06 Thread Don Arbow

On Wednesday, June 6, 2007, at 01:58 PM, [EMAIL PROTECTED] wrote:

>
> I'm trying to push a beta build of an App I wrote to my Apache server
> but, I'm running into some problems (I'm pretty sure it's permission
> related)

> [code]
> [EMAIL PROTECTED] alpha1]# ls -al
> total 24
> drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 .
> drwxr-xr-x 3 thebest bestx 4096 Jun  6 15:31 ..
> drwxr-xr-x 9 thebest bestx 4096 Jun  6 15:35 TheBest
> [/code]

If this really were a permissions problem, you would get an error 
stating such. This error was that the module was not found.  Your top 
level folder "TheBest" contains no __init__.py file, so Python doesn't 
know it's a module.

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Running tests - minor problem with fixtures

2007-05-31 Thread Don Arbow

Well, just a follow up for future spelunkers to this list.

Updating my code to the changes in 5173 and 5211 worked (it now loads 
fixtures that are not named initial_data.json). For some reason, 
straight code from 0.96 doesn't work, I never figured out why.

And I patched get_sql_flush() to use "SELECT setval()" for my elderly 
version of Postgres, so all is well.

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Running tests - minor problem with fixtures

2007-05-29 Thread Don Arbow

On Tuesday, May 29, 2007, at 05:25 PM, Russell Keith-Magee wrote:
> The only other cause I can think of would be an error in the fixture
> file that might be getting eaten by the test process. Does the fixture
> load ok if you run './manage.py loaddata myfixture' (where myfixture
> is the name of you fixture)?
>
> Failing that:
> - What is your fixture called?
> - Where is it located relative to your project?
> - Can you provide a sample test case that doesn't work for you?
>
> To answer your other question: The test case doesn't need to have a
> setUp() method, just a fixtures=[] definition.

I only mentioned the setUp() method because I found _pre_setup() and 
assumed that it was some sort of hook related to the setUp() method.

My fixture file is called "region.json", to match one of my models. It 
is located in a fixtures folder in the app folder. If I rename the file 
to "initial_data.json", it loads, no problem. Note that if it can't 
find the initial_data file, there is no real error, only that the test 
fails because there is no data in the table.

Doing some more digging, I found that the run() method (in 
django/test/testcases.py) along with the install_fixtures() method 
never got called. Maybe just a disconnect between the 0.96 testing docs 
and the code? Looking at the later changes to this file (#5173 - rename 
install_fixtures() to _pre_setup(), #5211 - rename run() to 
__call__()), I added these changes and it now appears that I get as far 
as flushing the database in _pre_setup().

I now have another problem, but that is related to "ALTER SEQUENCE" not 
available for my version of Postgres (7.3, I know it's old, but it 
WORKS!). Why does get_sql_sequence_reset() use "SELECT setval()" but 
get_sql_flush() uses "ALTER SEQUENCE"? I've been using setval() in 
Postgres for so long, I wasn't even aware that they added ALTER 
SEQUENCE, :-).

I'll do some more hacking on this when I get to work tomorrow and try 
loaddata from the command line.

Thanks for your help Russ.

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: string index out of range

2007-05-12 Thread Don Arbow

You stated you got a python traceback and yet you only show us the  
error message. What Malcolm was trying to say was that it would be  
helpful to print out that traceback, rather than your Apache  
configuration, at least to start with.

When debugging a problem it's always best to start with the immediate  
data you have (traceback) and work your way backwards to the true cause.

Don

On May 12, 2007, at 9:09 AM, Mark Phillips wrote:

>
>
> On May 11, 2007, at 9:40 PM, Malcolm Tredinnick wrote:
>
>> More information is definitely needed here. You've just done the
>> equivalent of "I've had a car accident." "Where should we send the
>> auto
>> service?" "There's a traffic light here."
>
> Thanks for the reply, Malcolm.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Flex + django

2007-05-07 Thread Don Arbow

I've dabbled in Flex with Django on the backend, using JSON as the  
transport mechanism. It's not that difficult, you just skip all the  
HTML template stuff and handle data requests and serve them  
accordingly. No different than implementing AJAX in the traditional  
way. I used the Cairngorm framework, which makes it easier to handle  
asynchronous calls within the Flex app.

Note also there is some AMF middleware available to enable Flash  
Remoting. I haven't used it though:

http://djangoamf.sourceforge.jp/index.php?DjangoAMF_en

Don


On May 7, 2007, at 1:14 AM, [EMAIL PROTECTED] wrote:

>
>
> Does anybody have got any experience with connection Flex(presentation
> layer) and  Django(server-side)?
> Do you think  this connection could be a good idea?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deos Django have Java Servlet's Listener like thing?

2007-05-05 Thread Don Arbow

Django's equivalent are signals. Here's a few links:

http://code.djangoproject.com/wiki/Signals
http://www.mercurytide.com/whitepapers/django-signals/
http://feh.holsman.net/articles/2006/06/13/django-signals

Don

On May 4, 2007, at 9:06 PM, Mambaragi wrote:

>
> I need to start a thread when Apache(+Python+Django) starts up, end
> stop the thread when Apache stops.
>
> If I use Java, I could do that with Java Servlet Listener, but I
> couldn't have found how to do with django.
>
> Is there anything like Servlet Listener in django,python?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: development server

2007-03-29 Thread Don Arbow

On Mar 29, 2007, at 4:46 PM, Karen Tracey wrote:
>
> So actually the server continues to "run" but it is pretty useless  
> given model validation failed.  The annoying thing is that when I  
> correct the error in my models.py file and re-save, the development  
> server does not auto-reload the file.  I have to Ctrl-C and restart  
> it manually.



A restart though is trivial: Ctrl-C, up arrow, return and you're back  
in business.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Threaded versus forked how can I tell?

2007-02-15 Thread Don Arbow

On Feb 15, 2007, at 10:30 AM, Jakub Labath wrote:
> Hi,
>
> Thanks, but that is not what I'm looking for.
>
> I need to find out at runtime from within my code. Something like.



Since, you can't change modes during runtime, I would set an  
environment variable when you start the server and test for that in  
your code.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: "Best" way of using templates

2007-02-14 Thread Don Arbow

On Feb 14, 2007, at 2:46 PM, James Tauber wrote:
> If the formatting could be applied to different classes, I'd use a
> filter. If the formatting only makes sense for Houses, I'd make it a
> method on House.


And you might even want to make it a __str__() method, I do that for  
some of my models where this would be the most "natural" way of  
displaying the value.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Open Book Platform demo site is up

2007-02-12 Thread Don Arbow

On Feb 12, 2007, at 6:30 AM, limodou wrote:
> I'v setup a demo site for open book platform project. So you can visit
> it : http://limodou.51boo.com
> This site is just for testing and demo, so don't put important  
> things in it.



I would refrain from using other's images on your site (you took a  
cover image of an Apress book and put a title on it to look as if  
there is an Apress book that is related to your site). You claim  
copyright for yourself, and yet you appropriate other's work.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Related "order by" problems

2007-02-04 Thread Don Arbow

On Feb 4, 2007, at 8:44 AM, Ramiro Morales wrote:
>
> On 2/4/07, Tom Smith <[EMAIL PROTECTED]> wrote:
>>
>> I have a model that looks roughly like this...
>>
>> class Client(models.Model):
>>  name = models.CharField(maxlength=200, default='')
>>
>> class Competitor(models.Model):
>>  client = models.ForeignKey(Client)
>>  site = models.ForeignKey(Site)
>>
>> class Site(models.Model):
>>  client = models.ForeignKey(Client)
>>  pagerank =  models.IntegerField(default=0)
>>
>> [...]
>>
>> ... I get this...
>>
>>>   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
>>> python2.4/site-packages/MySQLdb/connections.py", line 35, in
>>> defaulterrorhandler
>>> raise errorclass, errorvalue
>>> OperationalError: (1054, "Unknown column 'site.pagerank' in 'order
>>> clause'")
>>
>
> See tickets #2210 and 2076 where a patch is proposed to solve the
> problem.



I've also found that having a default ordering on your model can work  
without having to specify it. So in your site model you'd have

class Meta:
 ordering = ('pagerank',)

Then in your query, if you order by your site foreign key, you get  
that fk's default ordering, no need to specify the pagerank in the  
query.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: manager.get_or_create() issue

2007-01-30 Thread Don Arbow
On Jan 30, 2007, at 2:45 PM, Curtis W. Ruck wrote:
> We have a model with a DateTimeField, and two FloatField's.  These  
> three fields are unique_together in the database.
>
> Why when using get_or_create(datetimefield=someDatetimeObject,  
> floatfield1=float(-34.2412), floatfield2=float(1.2432)) does it not  
> return a record in the database that has those values, and then  
> fails with a duplicate key error on the unique key of those fields?



Float fields are difficult to represent precisely, some form of  
internal rounding may occur. If you need a precise value as a unique  
key, you could store them as strings or integers (remove the decimal  
point by multiplying by 10,000). Of course, you'll then have to  
convert values when you query the database.

Here's more on how Python handles floating point:
http://docs.python.org/tut/node16.html

Don




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QuerySet generating wrong SQL

2007-01-29 Thread Don Arbow

On Jan 29, 2007, at 4:22 AM, innervision wrote:
>
> How can I tell the queryset to use an OR operator between the 'where'
> clause and the conditions set-up in the Q object?


http://www.djangoproject.com/documentation/models/or_lookups/

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Debugging Django: print statements?

2007-01-27 Thread Don Arbow

On Jan 27, 2007, at 8:57 AM, Filipe Correia wrote:
>
>>> Having to change the source code to debug it doesn't feel very  
>>> right...
>> And adding print statements is...what?
>
> I agree :) And that's why, to me, neither seem the right way to go...
> (then again, using prints is the most effective way I have found, and
> I guess pdb is probably equivalent)



Actually, pdb is much more effective and not the same as print  
statements. In the debugger, you can not only print out variable  
values, but you can change those values as well. You can't do that  
with print statements. With a print statement, you need to specify  
which value you want to print before execution. In the debugger, you  
can look step through your program a line at a time and look at any  
value you can think of.

Using print statements to debug a program is like figuring out what  
is wrong with your car by listening for weird noises. Using a  
debugger is like opening the hood and tweaking the engine with tools.

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to remove the dependencies on the project directory from the python code.

2007-01-23 Thread Don Arbow

On Jan 23, 2007, at 4:21 PM, speleolinux wrote:
>
> Hi all
>
> Having got the tutorial working I have been looking at the docs
> covering what's meant by a site, projects, apps etc. It looks like
> there is a lot to read there to really understand the framework.  
> Anyhow
> what I'd like to do is to understand how to remove the dependencies on
> the project directory from the python code.



Go to Google groups and search this list for a thread last week  
entitled "Project organization and decoupling".

Don




--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: translations...

2007-01-22 Thread Don Arbow

On Jan 22, 2007, at 12:22 PM, ashwoods wrote:
>
> hmm... i guess everybody is tired of translation discussions :)



You might have better luck in the Django internationalization group:

http://groups.google.com/group/django-I18n/

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What can be done about all the spam in django-users?

2007-01-19 Thread Don Arbow


On Jan 19, 2007, at 7:40 AM, LD 'Gus' Landis wrote:

If the spam can't be stopped, the unsubscribe is the only option I  
guess, eh?




No, you go to the Google Groups web page and report the spam. In the  
title of the message is a "Show Options" link, click that, then click  
the "Report Abuse" link.


Google is very good at removing these messages and banning users who  
send it.


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: ANN: Upgrading code.djangoproject.com

2007-01-17 Thread Don Arbow

On Jan 17, 2007, at 12:19 PM, Jacob Kaplan-Moss wrote:
>
> I'm really excited about these changes; I think they'll really help  
> us be more
> efficient.



Whoo, hooo! And with the upgrade, you fixed the Safari bug in the  
ticket search results page, no more crashing when mousing over the  
titles

Thanks, Jacob.

Don


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: For Loops

2007-01-16 Thread Don Arbow


What you are asking is how to use a variable as a key into a  
dictionary, you cannot normally do this with Django template.  You  
can get around it by using a template tag or try this:


{% for date in date_list.items|dictsort:"0" %}
{{ date.1 }}
{% endfor %}

Here's an explanation of how the above works:
http://groups.google.com/group/django-users/msg/858e38a7b440b294

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Complex Data Models.

2006-12-27 Thread Don Arbow


On Dec 27, 2006, at 5:44 PM, Jason C. Leach wrote:

Specifically, I'm curious how you do it without putting SQL in the
view. From what I understand about the methodology of MVC this should
not be done.



I would only worry about that if you are concerned about  
maintainability or want to avoid duplicating a query in more than one  
view. In that case you could just create a Python file containing SQL  
queries and import them where you need them.


MY_BIG_QUERY = """SELECT * FROM table WHERE ..."""
MY_BIG_QUERY_2 = """SELECT * FROM table2 INNER JOIN table3 WHERE ..."""

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'function' object has no attribute 'rindex'

2006-12-26 Thread Don Arbow


On Dec 26, 2006, at 7:46 PM, Adrian Holovaty wrote:


On 12/26/06, Don Arbow <[EMAIL PROTECTED]> wrote:
Read the comments in chapter 3 where it says "Let's edit this file  
to expose

our current_datetime view:". According to people that have commented,
there's a small bug where this code works with more recent  
versions of
Django (such as from svn), but not with 0.95. There is an  
explanation in the

comments there that tell how to fix it.


FYI, that's not a bug -- rather, it's a new feature in the Django
development version. Callable objects in URLconfs were added after
0.95 was released.



Well, I meant bug in the sense of the book. I noticed that this same  
question was asked about a month ago. I'm not sure if the book  
emphasizes which version of Django to use for the tutorials.


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: 'function' object has no attribute 'rindex'

2006-12-26 Thread Don Arbow

On Dec 26, 2006, at 7:13 PM, Mike Tuller wrote:
I seem to have everything installed correctly, and the python paths  
seem to be correct. I am going through the tutorial in the online  
book, and I run into a problem. When I run the first application  
http://127.0.0.1/now/ I get the following error:


'function' object has no attribute 'rindex'





Read the comments in chapter 3 where it says "Let’s edit this file to  
expose our current_datetime view:". According to people that have  
commented, there's a small bug where this code works with more recent  
versions of Django (such as from svn), but not with 0.95. There is an  
explanation in the comments there that tell how to fix it.


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Types of projects Django is not well suited for?

2006-12-25 Thread Don Arbow


On Dec 25, 2006, at 11:03 PM, Saurabh Sawant wrote:

I think this is the best place to ask this question because many a
times, the people who start saying negative things about a  
framework is
when they find out it doesn't suit their need. If we can compile a  
list

where another framework is better than Django, it will help some
newbies.




I"ll bet that if you post a message saying that something can't be  
done in Django, you'll get more than one response in a space of 24  
hours with someone saying they've done it.


I think the biggest limiting factor in Django is the knowledge and  
experience of the developer.


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: startswith a range

2006-12-22 Thread Don Arbow


On Dec 22, 2006, at 10:21 PM, Russell Keith-Magee wrote:

Same result, different composition. Personally, given Guido's
predisposition to eliminating reduce() in Python 3000 [1], I'd be
avoiding using reduce in new code.



Python 2.5 has any() and all() to replace reduce(). So I believe you  
could do this:


list = Model.objects.filter(any([Q(name__startswith=letter) for  
letter in 'abc']))


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Screencast: Django + Aspen = Stephane (was Re: pure-HTTP deployment?)

2006-12-21 Thread Don Arbow


On Dec 21, 2006, at 10:35 AM, Jeremy Dunck wrote:

Where does one find this tiny shim?




Well, the url is in the screencast:

http://aspen-commons.googlecode.com/svn/stephane/

Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CSS Basics

2006-12-19 Thread Don Arbow


On Dec 19, 2006, at 10:49 PM, James Bennett wrote:

...
So we generally recommend using a separate instance of Apache (with no
mod_python) or some other web server (lighttpd is very good at this)
to handle serving static CSS files, JavaScript, images, etc.; the
result is *much* more efficient use of your available resources.




Note that what James wrote is not just a Django thing. This same  
holds true for any sort of server environment that delivers dynamic  
content including PHP, Rails, .NET, mod_perl and others.


Don



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Bugs in Django apps : why not throw exceptions when being in debug mode ?

2006-12-19 Thread Don Arbow

On Dec 18, 2006, at 10:52 PM, Denis Frère wrote:
>
> I've just found a bug that made me searching for hours... I'll tell  
> you
> the story in case it could help someone else.
>
> I got a strange behaviour with Django views recently : some pages of a
> website I'm developping were empty apart from the template. That is,
> the template was called but there was no data to fill the variables.
> The stranger is that a same view code was OK for some pages and bad  
> for
> other pages. It happened with generic views and even with flatpages.
>
> After a long search, I discovered the problem : I had written a buggy
> template context processor. Depending on the request.path, I was
> returning or not a dictionary. When I was returning the dictionary,
> everything was OK, but when not, my templates were empty.
>
> OK, I'm guilty. I knew I had to return a dictionary, but I don't
> appreciate having had no clues to find the bug. I love Python because
> he's generally kind with me, telling me where I made errors. When
> Django fails silently, it makes things much harder for bad programmers
> like me.
>
> In conclusion, a question for the developpers : wouldn't it be better
> to throw exceptions when being in debug mode and fail silently only
> when debug mode is off ?


You can always use the TEMPLATE_STRING_IF_INVALID variable to display  
a string in place of non-existent variables. But you should be aware  
of this warning, which is why it should not be turned on for general  
development:

"Many templates, including those in the Admin site, rely upon the  
silence of the template system when a non-existent variable is  
encountered. If you assign a value other than '' to  
TEMPLATE_STRING_IF_INVALID, you will experience rendering problems  
with these templates and sites.

Generally, TEMPLATE_STRING_IF_INVALID should only be enabled in order  
to debug a specific template problem, then cleared once debugging is  
complete."

You may ask, why would anybody rely on a non-existent variable in  
their template? Think of the {% if xxx %} tag. If you want a section  
of html to display, you set the variable, if not, you don't need to  
set anything.

The above paragraph is from:

http://www.djangoproject.com/documentation/templates_python/#how- 
invalid-variables-are-handled

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Any web control panel project on Django

2006-12-17 Thread Don Arbow

On Dec 17, 2006, at 12:22 PM, Ramdas S wrote:
> Hi,
>
> Is there anyone working on Django based web control panel/ or an  
> extended user panel for simple network management


This was started as a replacement for webmin. Don't know how far  
along the project is, though.

http://code.google.com/p/zmaj/

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Why is IPAddressField a char(15) instead of an int?

2006-12-17 Thread Don Arbow

On Dec 17, 2006, at 9:16 AM, Jamie wrote:
>
> Hello,
>
> I'm just wondering if there's a specific reason why IPAddressField is
> defined as a 15-character string instead of a 32-bit integer? Using an
> integer would reduce the storage size by 15 bytes to only four bytes
> and make it easier to calculate ranges. Additionally, on MySQL, it's
> about 30% faster to scan for an IP address when it's an integer and  
> not
> a string on a non-indexed column.



Probably because Postgres has a column type that can accept strings  
in IPv4, IPv6 and cidr formats (with comparison and masking  
functions), so there was never any need for IP conversion routines  
before other databases were added.

For example, in Postgres you can do this:

 select * from table where ip_column < inet '192.168.1.6';

or even trickier (select all within a subnet):

 select * from table where inet '192.168.1/24' >> ip_column;

If you need that functionality, you could post a ticket and/or a  
suggested fix.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: null ordering in mysql

2006-12-14 Thread Don Arbow

On Dec 14, 2006, at 12:49 AM, MC wrote:
>
> Problem:
> I order dates and null values in ascending order under MySQL. To my
> surprise, null values are listed first, then actual dates. Turns out
> that in MySQL, null values are LOWER than non-null values, whereas
> Postgresql is the reverse. As outlined here
> http://troels.arvin.dk/db/rdbms/#select-order_by, it seems the only  
> way
> to reverse the order is by prepending a - sign and switching from ASC
> to DESC. Unfortunately, this is the same syntax Django uses for
> ordering!
>
> Solution:
> I couldn't think of an easy solution through the model API or using
> custom managers. I suppose I could write custom SQL, but it would be
> nicer to use the model API. I could use a default value like the year
> 3000 and filter for display. Any suggestions? Thanks for your help!



Under relational database theory, nulls are not less than or greater  
than any value, including other nulls. Because of this, you should  
never count on where a particular database puts those values. The  
page you quoted explains the allowances that database authors have  
made to work around the problem. The page didn't even mention sqlite,  
which follows mysql's convention.

I would say this is something that Django should stay away from, too  
many differences, even more when you include aggregates such as min()  
and max(). For example in Postgres, min() and max() ignore nulls in  
columns unless all column values are null, so this behavior is not  
consistent with its column sorting routines. I think If you want  
minimum or maximum values in your tables, they should be explicitly  
coded.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-11 Thread Don Arbow

On Dec 11, 2006, at 7:48 AM, Bob wrote:
>
> http://www.djangoproject.com/documentation/testing/ indicates that
> unittests can be run with
> ./manage.py test
>
> However, when I run it, "test" is not known as an action.  I get this
> output:
> ---
> $ c:/Python24/Python manage.py test
> Error: Your action, 'test', was invalid.
> Run "manage.py --help" for help.
> ---
>
> Sure enough, if I run manage.py --help, "test" is not listed as one of
> the actions.  Is this implemented or not?
>
> I'm running Django 0.95 with Python 2.4 on Windows XP SP2.



What revision are you running? The test option was added in 3660,  
0.95 is rev 3491.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template extending problem

2006-12-09 Thread Don Arbow

On Dec 9, 2006, at 10:56 AM, mezhaka wrote:
>
> try
> {% extends "/blog/base.html" %}
> instead of
> {% extends "/blog/base" %}



In addition, he should remove the leading '/' from the path in the  
extends clause. If you code a leading slash, os.path.join() ignores  
the template path.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Optimizing Templates

2006-12-07 Thread Don Arbow

On Dec 7, 2006, at 8:15 AM, [EMAIL PROTECTED] wrote:
>
> Right off the top, I'd suggest alot of your slowdown is in the number
> of http requests. It appears you're making quite a few javascript and
> css calls. I'd see if i could pare that back.
>
>
> Also, temporarily remove your google analytics code... I've seen that
> cause a major hang on some sites.


He's talking about the time that Django takes to create the page,  
before the browser even sees it.

Is the amount of time a problem? I'm not sure if half a second is a  
problem or not. The page doesn't look too exotic, but it is big, I  
did notice a regroup call in there, which may take some time  
depending on the data it has to process.

If the timing is a problem, have you looked into caching?

Don


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Retrieve Password

2006-11-29 Thread Don Arbow

On Nov 29, 2006, at 10:50 AM, Clint74 wrote:
>
> Hi,
>
> I need to send the password to the user(email), but how recover the  
> raw
> password once the database stores in this format:
>
> hashType$salt$hash
> sha1$6070e$d3a0c5d565deb4318ed607be9706a98535ec7968


You cannot recover the password once it is hashed. If you need to  
send the password back to the user, you need to store it somewhere  
yourself. Note that this is not recommended and defeats the purpose  
of hashed passwords.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Debugging emails

2006-11-27 Thread Don Arbow

On Nov 27, 2006, at 4:59 PM, [EMAIL PROTECTED] wrote:
> I think that may be it, but something's still not right.
>
> I now have:
> DEBUG = False
> TEMPLATE_DEBUG = False
>
> ADMINS = (
>  ('Tim Baxter', '[EMAIL PROTECTED]'),
> )
>
> MANAGERS = ADMINS
> EMAIL_HOST='mail2.webfaction.com' # webfaction says this is the smtp
> server
> EMAIL_HOST_USER='XX'  # my email user name
> EMAIL_HOST_PASSWORD='XX' # my email pass
> EMAIL_PORT='25' # webfaction says this is the port.
>
> Still nothing.



mail_admins() is called from the get_response() routine in django/ 
core/handlers/base.py. There is a parameter, fail_silently, that is  
set to True. Set that to False and see what happens. Any error that  
happens when sending the email should trigger an exception.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Debugging emails

2006-11-27 Thread Don Arbow

On Nov 27, 2006, at 3:00 PM, [EMAIL PROTECTED] wrote:
>
> I understand Django should send an email when there's an error and
> debug=False.
>
> It doesn't. Not for me anyway.


Do you have an email server defined? If not, Django tries to use the  
localhost to send. Do something like this in your settings file:

EMAIL_HOST='smtp.myisp.com'

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Submission rejected as potential spam (Akismet says content is spam)

2006-11-27 Thread Don Arbow

On Nov 27, 2006, at 5:29 AM, favo wrote:
> I can't submit or change ticket, this block me to contrib. could we  
> fix
> the problem of the ticket system? I heard someones have the same
> problem. thanks a lot.


Did you click the settings link at the bottom right of the page and  
enter your information? Once you do that, you should be able to  
modify tickets.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is __init__.py for?

2006-11-19 Thread Don Arbow

On Nov 19, 2006, at 11:29 AM, Jeremy Dunck wrote:
> In the simplest case, __init__.py can just be an empty file, but it  
> can
> also execute initialization code for the package or set the __all__
> variable, described later.


it's also handy to store code where you don't want another namespace  
level inside your module.  See for example, django/http. There is  
nothing in there except an __init__.py that has initialization code  
as well as numerous class definitions and utility functions.

Don

--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to find out the id of the last record in a table?

2006-11-16 Thread Don Arbow

On Nov 15, 2006, at 9:58 PM, simonbun wrote:
>
> The problem with getting the last record's id and using it, is that
> someone might have inserted yet another record while you're still
> working on the previous one.
>
> For single user scenario's it's ok, or if you're using table level
> write locking. Yet afaik, its generally a bad idea.



Not sure how it works in MySQL, but in Postgres, getting the last  
inserted id is unique to the current user's (database) session. So if  
a user inserts a record into the table, then queries the sequence for  
that id, the value will always be the same, regardless if other table  
insertions have been done by other users since the first insertion.  
So the last inserted id should be thought of as the id inserted by  
this user, not the maximum id inserted by any user.

The easiest way to get the last inserted id is to create an object,  
save it, then read its id directly. If you need the maximum inserted  
id, use select max(id) from table.

Don




--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newbie startup question about ImportError on Windows with Apache/mod_python

2006-11-14 Thread Don Arbow

On Nov 14, 2006, at 8:17 AM, benstewart wrote:
>
> I suppose nobody has the time to help... or maybe nobody has desire to
> help.
>
> This is sad since I have already searched and tried everything that I
> could find here, at the django project website, in the django book,  
> and
> on the web. I am sure this is a simple fix but it is a simple fix that
> I apparently cannot do alone.
>
> No django for me... off to rails, I guess.

I would check the archives of this group, just a quick check using  
the search string "Import Error" finds a message with the title  
"Slowly losing my ming..." from two weeks ago, which describes and  
answers the exact same problem you are seeing (mainly having to do  
with DOS changing filenames to uppercase).

And I'm not sure what Apache/mod_python has to do with running the  
development server from the command line. Perhaps no one answered  
because the title of this thread does not match your problem.

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Order_by problems

2006-11-08 Thread Don Arbow

On Nov 8, 2006, at 12:13 AM, Pythoni wrote:
>
> 
> Now when I try:
> words.get_list(order_by=('Word'))
>
> I will get the error:
> OperationalError: (1054, "Unknown column 'mimi_words.W' in 'order
> clause'")



This is a basic Python error. You have a tuple with only one item, so  
you need to put a comma after it, otherwise Python thinks you're  
passing a tuple of letters ('W','o','r','d'), which is why you're  
seeing the field name as 'W'. Try this instead:

words.get_list(order_by=('Word',))

or use a list instead:

words.get_list(order_by=['Word'])

Don



--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Admin - "Site administration"

2006-11-06 Thread Don Arbow

On Nov 6, 2006, at 12:03 AM, Carl Holm wrote:

> Thanks. I should clarify that I am looking for the string "Site
> administration" which I did not find in the base_site.html
> template. Is should also mention that I am running the dev version.


The actual physical location of the string "Site administration" is  
in the locale files, try this path (xx is the two character ISO  
language code):

django/conf/locale/xx/LC_MESSAGES/django.po

Don


--~--~-~--~~~---~--~~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: secure argument to set_cookie should accept False

2006-11-01 Thread Don Arbow
On Nov 1, 2006, at 4:19 PM, Shannon -jj Behrens wrote:Hi,I'm looking at ttp://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L199. It seems very natural to pass a value of False to the secure argumentinstead of None, but if you do this, it gets treated as if you passedsecure=True.  That's because the code is checking for equality withNone instead of using Python's general truth mechanism.  The code is: 	        for var in ('max_age', 'path', 'domain', 'secure', 'expires'): 	            val = locals()[var] 	            if val is not None: 	                self.cookies[key][var.replace('_', '-')] = valThe only place that Django calls set_cookie is in django/contrib/sessions/middleware.py and the process_method there sets the secure argument to either to the value of the SESSION_COOKIE_SECURE setting or None. So it never passes False and the code you quoted doesn't have to special case the value of the secure argument.You can see the change to the set_cookie call in changeset 3570:http://code.djangoproject.com/changeset/3570Don
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



  1   2   3   >