Re: Django site broken after Debian upgrade

2011-07-18 Thread Kejun He
hi,
I met the same problem when updated diango from version 1.2 to version 1.3.
And it comes back to normal after back to version 1.2.

May be your trouble came from the same reason

rgs,
he

On Tue, Jul 19, 2011 at 1:13 PM, Andre Terra  wrote:

> On Tue, Jul 19, 2011 at 9:48 AM, bkline  wrote:
>> > On Jul 18, 5:25 pm, Andre Terra  wrote:
>> >
>> > Really?  It would be better if I went back to the days where we all
>> > built everything from the source?  Do all Django users running on
>> > Linux (which I assume is the platform for the majority of
>> > installations) build all the software on their servers and handle all
>> > of the dependencies by hand?
>>
>> nope. I, for one, use pip for the package management related to django
>> (and python).
>>
>>
> Like I said, installing python-django isn't canonical, but no body said
> it's inherently wrong.
>
> It's standard practice among the Python community to install and manage
> packages through either pip, easy_install or other python tools. Creating
> isolated virtual environments with custom PYTHONPATHs is very common as
> well.
>
> Having said that, I wonder why [1] i'm still finding Django 1.2 as the
> shipped version for the Debian's stable release. Are you running wheezy by
> any chance?
>
>
> Regards,
> AT
>
> [1] http://packages.debian.org/squeeze/python-django
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Django site broken after Debian upgrade

2011-07-18 Thread Andre Terra
>
> On Tue, Jul 19, 2011 at 9:48 AM, bkline  wrote:
> > On Jul 18, 5:25 pm, Andre Terra  wrote:
> >
> > Really?  It would be better if I went back to the days where we all
> > built everything from the source?  Do all Django users running on
> > Linux (which I assume is the platform for the majority of
> > installations) build all the software on their servers and handle all
> > of the dependencies by hand?
>
> nope. I, for one, use pip for the package management related to django
> (and python).
>
>
Like I said, installing python-django isn't canonical, but no body said it's
inherently wrong.

It's standard practice among the Python community to install and manage
packages through either pip, easy_install or other python tools. Creating
isolated virtual environments with custom PYTHONPATHs is very common as
well.

Having said that, I wonder why [1] i'm still finding Django 1.2 as the
shipped version for the Debian's stable release. Are you running wheezy by
any chance?


Regards,
AT

[1] http://packages.debian.org/squeeze/python-django

-- 
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: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread bedros
komodo is absolutely brilliant! couple months ago I spent two hours
learning how to write komodo macros in python and how to use their
shortcuts in writig commands; I recommend you try komodo and check
their bundled macros and commands in the toolbox panel (on the right)
click properties to edit command or macro.

-B

On Jul 18, 10:56 am, Fatrix  wrote:
> I didn't aim to start a discussion about which IDE is better. But
> every one has its own pros and cos.
>
> While working with Aptana I had to recreate several times a broken
> workspace, a really annoying work.
> That was my main reason to switch from the free Eclipse-World to the
> (not expensive) PyCharm
> world.
>
> For me the most significant feature a IDE must provide is a vi-mode.
> No fun without vi.

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



Proper way to strip whitespace from Charfields in a form in current version of Django?

2011-07-18 Thread br
There seems to be a raging and unresolved discussion about how to
address the issue of stripping whitespace from form fields in future
versions of Django over on the Developers group:
http://groups.google.com/group/django-developers/browse_thread/thread/90352cc0da78390b
.

In the present, what is the proper place to strip whitespace?

I've starting down this path:

http://www.peterbe.com/plog/automatically-strip-whitespace-in-django-forms

by setting up a BaseModelForm class, but i don't necessarily like the
fact that I could have a field with "blank=False" that will still
validate if you have an input of just whitespace, since apparently
"clean" gets called after validation takes place.  Is the override of
full_clean referenced in the comments the way around this then? Seems
pretty hacky.

Thanks

Ben

-- 
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: POST requests that don't send any data - Django development version 1.4.0 Alpha

2011-07-18 Thread Jesse Tane
Aha! I knew i was crazy :)  Thanks!

On Mon, Jul 18, 2011 at 7:49 PM, Venkatraman S  wrote:

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

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



Re: Django site broken after Debian upgrade

2011-07-18 Thread Aldiantoro Nugroho
On Tue, Jul 19, 2011 at 9:48 AM, bkline  wrote:
> On Jul 18, 5:25 pm, Andre Terra  wrote:
>
> Really?  It would be better if I went back to the days where we all
> built everything from the source?  Do all Django users running on
> Linux (which I assume is the platform for the majority of
> installations) build all the software on their servers and handle all
> of the dependencies by hand?

nope. I, for one, use pip for the package management related to django
(and python).

-- 
Part-time programmer. Full-time dreamer.
http://kriwil.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: POST requests that don't send any data - Django development version 1.4.0 Alpha

2011-07-18 Thread Venkatraman S
Are you missing to 'return' HttpResponse?

-V

-- 
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 site broken after Debian upgrade

2011-07-18 Thread bkline
On Jul 18, 5:25 pm, Andre Terra  wrote:

  "Installing the python-django package is not the canonical way of
using
   django, let alone running production servers."

Really?  It would be better if I went back to the days where we all
built everything from the source?  Do all Django users running on
Linux (which I assume is the platform for the majority of
installations) build all the software on their servers and handle all
of the dependencies by hand?  No one but me uses a package management
system to take care of keeping track of security updates and making
sure all the moving parts play well together?  Or do they use the
package management systems for everything except Django?  If the
latter, can you give me a reasonable argument for why we should treat
Django differently from the other software on our servers?  I can be
convinced if you can provide a compelling rationale.

Regards,
Bob

-- 
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: Accounting app - design decisions needed

2011-07-18 Thread Mike Dewhirst

On 19/07/2011 9:13am, Andre Terra wrote:


The problem is I'm supposed to have millions of entries; all with the 
same date, thousands for the same Account, hundreds with the same 
description and perhaps dozens with the same value. I think I'm going 
with force-overwrite for the month, at least for the time being.


Seems to me you need imestamps too or you will lose data.

Mike

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



POST requests that don't send any data - Django development version 1.4.0 Alpha

2011-07-18 Thread Jesse
I'm not sure if this is a bug (though it probably is) and wanted to
review here before submitting a report. Consider the following
handler:


def test(req):
if req.method == "POST":
HttpResponse("the request was a POST")
else:
HttpResponse("the request was not a POST")


This works as long as the client doesn't send any data. However, if
any data is included in the request payload, the HttpResponse call
mysteriously fails and redirects to [origin]/internal_error.html which
in turn ends up as a 404 if you don't have such a page in your public
directory or a catch all handler.

Trying to catch this exception is impossible because the handler has
to call HttpResponse at some point. Since there is no way to control
whether the client decides to send data, (even if they shouldn't) this
appears to result in an un-handleable circumstance. Is this the
intended behavior, a bug or am I crazy for some other reason?

*An additional point of interest - changing the handler to access
req.POST anywhere before HttpResponse is called, even if the actual
data isn't processed or examined directly, seems to solve this problem.

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



SOLVED Re: Render nested queryset in a template ?

2011-07-18 Thread kooliah

Thank you

On 07/18/2011 11:57 PM, Daniel Roseman wrote:

Op maandag 18 juli 2011 20:29:17 UTC+1 schreef kooliah het volgende:

I need to render a nested queryset in a template, a classic
father/son
structure like
publisher>dvds>renters,



in python code i can use this code:

code

---
pub= publisher.objects.get(publisherid=1)
for disk in pub.dvds_set.all():
 print disk.dvdsname
 for rent in disk.renters_set.all():
 print rent.rentersname

---

How can i do same things in a template ?
Can i call methods in a tag or i have to build a dictionary and
pass it
to template?

Thanks to all


You can do exactly that, except without the () brackets. You'll need 
to pass the `pub` object into the template context, but the for loops 
work fine within the template.

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

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


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



Re: Accounting app - design decisions needed

2011-07-18 Thread Andre Terra
Marc,

First of all, thank you for your insights. I'll try to clarify things as
best as I can.

On Mon, Jul 18, 2011 at 7:21 PM, Marc Aymerich  wrote:

>
>
> On Mon, Jul 18, 2011 at 10:54 PM, Andre Terra wrote:
>
>> Hello, django-users.
>>
>> I'm in need of some serious help on deciding how to design my next
>> project. Below is my attempt to describe the use case:
>>
>> *USE CASE*
>> I'm writing an accounting app that will be generating unique monthly
>> reports of the revenue results for a list of Accounts (model) in the
>> company.
>>
>> Each Account has a set of instances of Entry (model) with a Decimal value,
>> date and some text, as well as a FK to Account.
>>
>> These entries are uploaded through an (already coded) import function
>> which parses a .csv and, using DSE, inserts 1.5 million rows to the Entry
>> table. These entries also have an FK to Task (model) so I know which import
>> process generated them.
>>
>> Each month I want to allow an admin to pick a set of Accounts to be
>> displayed in the monthly report, which needs to be unique for obvious
>> reasons.
>>
>> *CODE
>> models.py
>> *http://dpaste.com/hold/570933/
>>
>> *example .csv file to be imported* (importing the file is already coded
>> and works 100% so far)*
>> *http://dpaste.com/hold/570934/*
>> *
>> *QUESTIONS*
>
> 1. Should I create another model named MonthlyReport with an M2M relation
>> to Accounts, and then add an 'is_active' flag so I know which one is the
>> official monthly report?
>
>
> Hi Andre, Could you elaborate a little more about the monthly reports?
> The admin pick up some arbitrary number of accounts and the app generates a
> global report for those accounts? or it should generate a discret report for
> each account?
>

Currently, there are about 200 accounts, but the entries for every month
only refer to a subset of them (about 50 each month). However, the entries
can refer to accounts that weren't referenced on the previous months,
including new accounts. Moreover, even though the entries refer to say, 50
accounts, the admin might only want to show the report for 40, or perhaps
display an extra account (that didn't get imported) with a hard coded value.
They might also want to manually enter a value for any account, if, for
example, something was missing in the original .csv or if the total value
was wrong.

Monthly Account values are derived from a sum of all the entries' values
that have an FK to that account in a given month.

Entries are 1.5 million rows/month, with small values, and accounts are
referenced hundreds of times in the .csv file, with the same date, user and
sometimes text. The value can vary, but not necessarily. So I do some
aggregation in the entries to get the account value.

These accounts are "groups" of entries that for accounting purpose have been
given a code. Think of it as a way of grouping different account
payables/receivables, so you have, say code M1023910240 for "subscriptions"
(+), D102512509 for "discounts" (-), M91212050592 for "SMS usage".


>
> 2. If so, how can I ensure there's only one official monthly report?
>> Perhaps setting is_active to False to all the other MonthlyReports that
>> carry the same month/year?
>>
>
>  what's the difference between "official monthly report" and  "unofficial"
> monthly record?
>

I wanted admins to be able to draft the report and have a final, published
report to go on the main page (this one would need to be unique for
month/year), so that they can switch back and forth between versions.


>
>> 3. How should I prevent users from importing the Entries more than once?
>> Forcing a deletion of entries for the same month as the imported entries is
>> a possible solution.. The .csv file should always be restricted to a single
>> month, but I guess I could write a check for that too, or expand the
>> deletion for every matching month.
>
>
> As you say, when a user upload a csv file you could check if your db
> already contains entries for the same month and if so, display a
> confirmation page warning the user that someone already uploaded the csv for
> the current month and if it's ok to delete the entries of the previous
> importat. (show some details: user/date/csv version|name/#entries and so on)
> .
>

The problem is I'm supposed to have millions of entries; all with the same
date, thousands for the same Account, hundreds with the same description and
perhaps dozens with the same value. I think I'm going with force-overwrite
for the month, at least for the time being.



Thanks again for your input!


Best regards,
André

-- 
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: Accounting app - design decisions needed

2011-07-18 Thread Marc Aymerich
On Mon, Jul 18, 2011 at 10:54 PM, Andre Terra  wrote:

> Hello, django-users.
>
> I'm in need of some serious help on deciding how to design my next project.
> Below is my attempt to describe the use case:
>
> *USE CASE*
> I'm writing an accounting app that will be generating unique monthly
> reports of the revenue results for a list of Accounts (model) in the
> company.
>
> Each Account has a set of instances of Entry (model) with a Decimal value,
> date and some text, as well as a FK to Account.
>
> These entries are uploaded through an (already coded) import function which
> parses a .csv and, using DSE, inserts 1.5 million rows to the Entry table.
> These entries also have an FK to Task (model) so I know which import process
> generated them.
>
> Each month I want to allow an admin to pick a set of Accounts to be
> displayed in the monthly report, which needs to be unique for obvious
> reasons.
>
> *CODE
> models.py
> *http://dpaste.com/hold/570933/
>
> *example .csv file to be imported* (importing the file is already coded
> and works 100% so far)*
> *http://dpaste.com/hold/570934/*
> *
> *QUESTIONS*

1. Should I create another model named MonthlyReport with an M2M relation to
> Accounts, and then add an 'is_active' flag so I know which one is the
> official monthly report?


Hi Andre, Could you elaborate a little more about the monthly reports?
The admin pick up some arbitrary number of accounts and the app generates a
global report for those accounts? or it should generate a discret report for
each account?

2. If so, how can I ensure there's only one official monthly report? Perhaps
> setting is_active to False to all the other MonthlyReports that carry the
> same month/year?
>

 what's the difference between "official monthly report" and  "unofficial"
monthly record?



> 3. How should I prevent users from importing the Entries more than once?
> Forcing a deletion of entries for the same month as the imported entries is
> a possible solution.. The .csv file should always be restricted to a single
> month, but I guess I could write a check for that too, or expand the
> deletion for every matching month.


As you say, when a user upload a csv file you could check if your db already
contains entries for the same month and if so, display a confirmation page
warning the user that someone already uploaded the csv for the current month
and if it's ok to delete the entries of the previous importat. (show some
details: user/date/csv version|name/#entries and so on) .


> --

Marc

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



Re: get django/lighttpd "hello world" page

2011-07-18 Thread Javier Guerra Giraldez
On Mon, Jul 18, 2011 at 4:55 PM, Phil  wrote:
> I did run "./manage.py runfcgi
> method=threaded host=my ip address port=80"

don't use port 80 for FastCGI.  chances are that it's already used

-- 
Javier

-- 
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: Render nested queryset in a template ?

2011-07-18 Thread Daniel Roseman
Op maandag 18 juli 2011 20:29:17 UTC+1 schreef kooliah het volgende:
>
> I need to render a nested queryset in a template, a classic father/son 
> structure like
> publisher>dvds>renters,
>
>  
>
in python code i can use this code:
>
> code 
>
> ---
> pub= publisher.objects.get(publisherid=1)
> for disk in pub.dvds_set.all():
>  print disk.dvdsname
>  for rent in disk.renters_set.all():
>  print rent.rentersname
>
> ---
>
> How can i do same things in a template ?
> Can i call methods in a tag or i have to build a dictionary and pass it 
> to template?
>
> Thanks to all
>

You can do exactly that, except without the () brackets. You'll need to pass 
the `pub` object into the template context, but the for loops work fine 
within the template.
--
DR. 

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



Re: get django/lighttpd "hello world" page

2011-07-18 Thread Phil
Thanks for reply. Yeah I seen that, I did run "./manage.py runfcgi
method=threaded host=my ip address port=80" in my mysite directory but
am still getting a "not found" page.


On Jul 18, 10:41 pm, Daniel Roseman  wrote:
> Op maandag 18 juli 2011 20:29:03 UTC+1 schreef Phil het volgende:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I have an ubuntu server, django is fully installed and working,
> > lighttpd is installed and working(works with standard html page), but
> > I am not sure how to get them talking to each other?
>
> > It is my first time putting a django site onto a live server so any
> > help is appreciated. I'm used to a php "stick everything into webroot"
> > setup.
>
> > I have the following in my lighttpd.conf file as mentioned on django
> > website
>
> > server.document-root = "/var/www"
> > fastcgi.server = (
> >     "/mysite.fcgi" => (
> >         "main" => (
> >             # Use host / port instead of socket for TCP fastcgi
> >             "host" => "my ip address",
> >             "port" => 80,
> >             #"socket" => "/home/user/mysite.sock",
> >             "check-local" => "disable",
> >         )
> >     ),
> > )
>
> > At present all that is doing is loading my html page in my webroot. I
> > have restarted lighttpd and all. But not sure how it see's django
> > project?
>
> > Thanks.
>
> See the very good documentation on FastCGI 
> setup:https://docs.djangoproject.com/en/1.3/howto/deployment/fastcgi/
> - it even has a section specifically on lighttpd.
> --
> DR.

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



Render nested queryset in a template ?

2011-07-18 Thread kooliah
I need to render a nested queryset in a template, a classic father/son 
structure like

publisher>dvds>renters,

code 
---

class publisher(models.Model):
publisherid = models.IntegerField(primary_key=True)
publishername = models.CharField(max_length=135, blank=True)

class dvds(models.Model):
dvdsid = models.IntegerField(primary_key=True)
dvdsname = models.CharField(max_length=135,verbose_name='Corp.Name')
publisher_publisherid = models.ForeignKey(publisher, 
db_column='publisher_publisherid')


class renters(models.Model):
rentersid = models.IntegerField(primary_key=True)
rentersname = models.CharField(max_length=135, blank=True)
dvds_dvdsid = models.ForeignKey(dvds, db_column='dvds_dvdsid')
---

in python code i can use this code:

code 
---

pub= publisher.objects.get(publisherid=1)
for disk in pub.dvds_set.all():
print disk.dvdsname
for rent in disk.renters_set.all():
print rent.rentersname
---

How can i do same things in a template ?
Can i call methods in a tag or i have to build a dictionary and pass it 
to template?


Thanks to all

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



Re: get django/lighttpd "hello world" page

2011-07-18 Thread Daniel Roseman
Op maandag 18 juli 2011 20:29:03 UTC+1 schreef Phil het volgende:
>
> Hi, 
>
> I have an ubuntu server, django is fully installed and working, 
> lighttpd is installed and working(works with standard html page), but 
> I am not sure how to get them talking to each other? 
>
> It is my first time putting a django site onto a live server so any 
> help is appreciated. I'm used to a php "stick everything into webroot" 
> setup. 
>
> I have the following in my lighttpd.conf file as mentioned on django 
> website 
>
> server.document-root = "/var/www" 
> fastcgi.server = ( 
> "/mysite.fcgi" => ( 
> "main" => ( 
> # Use host / port instead of socket for TCP fastcgi 
> "host" => "my ip address", 
> "port" => 80, 
> #"socket" => "/home/user/mysite.sock", 
> "check-local" => "disable", 
> ) 
> ), 
> ) 
>
>
> At present all that is doing is loading my html page in my webroot. I 
> have restarted lighttpd and all. But not sure how it see's django 
> project? 
>
> Thanks. 
>
>
See the very good documentation on FastCGI setup:
https://docs.djangoproject.com/en/1.3/howto/deployment/fastcgi/
- it even has a section specifically on lighttpd. 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WcA5odzyAAQJ.
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 site broken after Debian upgrade

2011-07-18 Thread Andre Terra
Django has a policy of warning about deprecations for two versions and
finally dropping support on the third dot release.

Installing the python-django package is not the canonical way of using
django, let alone running production servers.

Perhaps you have a replica of the old admin templates on your
project's folder which might be overriding the files shipped with
core, so take a look at that first.

If nothing else works, disable the csrf middleware and you're good to go.

Cheers,
AT

On 7/18/11, bkline  wrote:
> I just upgraded my Debian server, which brought the python-django
> package up to version 1.2, and now any attempt to post to the database
> tables results in a CSRF failure.  I'm using the admin pages to do
> just about everything, so it not clear how to apply the instructions
> in the Django CSRF docs [1].  Those documents say "The utility script
> extras/csrf_migration_helper.py can help to automate the finding of
> code and templates that may need to be upgraded. It contains full help
> on how to use it."  That script is not among the many files installed
> by the package.  Right now I've got things working by hacking the core
> code and disabling the lines which are returning the failure, but
> that's clearly not a good long-term solution.  Breaking sites like
> this with a dot-release which isn't backwards compatible is
> disappointing, to put it politely.  Unless I can get this working the
> right way I'm going to have to dump Django and port the site to some
> other package.
>
> Package info:
>
> ii  python-django1.2.3-3+squeeze1
>
> [1] https://docs.djangoproject.com/en/1.2/ref/contrib/csrf/
>
> --
> 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.
>
>

-- 
Sent from my mobile device

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



Accounting app - design decisions needed

2011-07-18 Thread Andre Terra
Hello, django-users.

I'm in need of some serious help on deciding how to design my next project.
Below is my attempt to describe the use case:

*USE CASE*
I'm writing an accounting app that will be generating unique monthly reports
of the revenue results for a list of Accounts (model) in the company.

Each Account has a set of instances of Entry (model) with a Decimal value,
date and some text, as well as a FK to Account.

These entries are uploaded through an (already coded) import function which
parses a .csv and, using DSE, inserts 1.5 million rows to the Entry table.
These entries also have an FK to Task (model) so I know which import process
generated them.

Each month I want to allow an admin to pick a set of Accounts to be
displayed in the monthly report, which needs to be unique for obvious
reasons.

*CODE
models.py
*http://dpaste.com/hold/570933/

*example .csv file to be imported* (importing the file is already coded and
works 100% so far)*
*http://dpaste.com/hold/570934/*
*
*QUESTIONS*
1. Should I create another model named MonthlyReport with an M2M relation to
Accounts, and then add an 'is_active' flag so I know which one is the
official monthly report?

2. If so, how can I ensure there's only one official monthly report? Perhaps
setting is_active to False to all the other MonthlyReports that carry the
same month/year?

3. How should I prevent users from importing the Entries more than once?
Forcing a deletion of entries for the same month as the imported entries is
a possible solution.. The .csv file should always be restricted to a single
month, but I guess I could write a check for that too, or expand the
deletion for every matching month.



As you can see, I have a few ideas on how to proceed, but it would be great
if anybody could weigh in on this, as the deadline is incredibly short (1
month including views/templates, etc).

I thank everyone in advance for reading through this and for any help they
can offer.

Cheers,
André

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



get django/lighttpd "hello world" page

2011-07-18 Thread Phil
Hi,

I have an ubuntu server, django is fully installed and working,
lighttpd is installed and working(works with standard html page), but
I am not sure how to get them talking to each other?

It is my first time putting a django site onto a live server so any
help is appreciated. I'm used to a php "stick everything into webroot"
setup.

I have the following in my lighttpd.conf file as mentioned on django
website

server.document-root = "/var/www"
fastcgi.server = (
"/mysite.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "my ip address",
"port" => 80,
#"socket" => "/home/user/mysite.sock",
"check-local" => "disable",
)
),
)


At present all that is doing is loading my html page in my webroot. I
have restarted lighttpd and all. But not sure how it see's django
project?

Thanks.

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



RE: [] Django site broken after Debian upgrade

2011-07-18 Thread Henrik Genssen
feel free to disable the csrf middleware and all problems should go away...

>reply to message:
>date: 18.07.2011 13:45:56
>from: "bkline" 
>to: "Django users" 
>subject: [] Django site broken after Debian 
>upgrade
>
>I just upgraded my Debian server, which brought the python-django
>package up to version 1.2, and now any attempt to post to the database
>tables results in a CSRF failure.  I'm using the admin pages to do
>just about everything, so it not clear how to apply the instructions
>in the Django CSRF docs [1].  Those documents say "The utility script
>extras/csrf_migration_helper.py can help to automate the finding of
>code and templates that may need to be upgraded. It contains full help
>on how to use it."  That script is not among the many files installed
>by the package.  Right now I've got things working by hacking the core
>code and disabling the lines which are returning the failure, but
>that's clearly not a good long-term solution.  Breaking sites like
>this with a dot-release which isn't backwards compatible is
>disappointing, to put it politely.  Unless I can get this working the
>right way I'm going to have to dump Django and port the site to some
>other package.
>
>Package info:
>
>ii  python-django1.2.3-3+squeeze1
>
>[1] https://docs.djangoproject.com/en/1.2/ref/contrib/csrf/
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To post to this group, send email to django-users@googlegroups.com.
>To unsubscribe from this group, send email to 
>django-users+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/django-users?hl=en.
>

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



Re: Multiple Databases || External Databases

2011-07-18 Thread Lycan
Thank you both!

On Jul 18, 1:39 pm, Andre Terra  wrote:
> Or maybe you want to authenticate using a remote resource?
>
> Authentication using 
> REMOTE_USERhttps://docs.djangoproject.com/en/dev/howto/auth-remote-user/
>
> Cheers,
> AT
>
>
>
>
>
>
>
> On Mon, Jul 18, 2011 at 6:08 AM, Uros Trebec  wrote:
>
> > On Jul 17, 10:36 pm, Lycan  wrote:
> > > I am building a Django User profile management portal. In one of the
> > > sections of the website i need pull data from an external database(Its
> > > managed by someone else, i have access to it).
>
> > > How can i achieve this and also can someone please point me to a
> > > working example.
>
> > You should probably take a look at:
> > * manage.py inspectdb command
> >https://docs.djangoproject.com/en/1.3/ref/django-admin/#inspectdb
>
> > * Multiple DB:
> >https://docs.djangoproject.com/en/1.3/topics/db/multi-db/
>
> > If that fails, ask away.
>
> > Regards,
> > Uros
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Django site broken after Debian upgrade

2011-07-18 Thread bkline
I just upgraded my Debian server, which brought the python-django
package up to version 1.2, and now any attempt to post to the database
tables results in a CSRF failure.  I'm using the admin pages to do
just about everything, so it not clear how to apply the instructions
in the Django CSRF docs [1].  Those documents say "The utility script
extras/csrf_migration_helper.py can help to automate the finding of
code and templates that may need to be upgraded. It contains full help
on how to use it."  That script is not among the many files installed
by the package.  Right now I've got things working by hacking the core
code and disabling the lines which are returning the failure, but
that's clearly not a good long-term solution.  Breaking sites like
this with a dot-release which isn't backwards compatible is
disappointing, to put it politely.  Unless I can get this working the
right way I'm going to have to dump Django and port the site to some
other package.

Package info:

ii  python-django1.2.3-3+squeeze1

[1] https://docs.djangoproject.com/en/1.2/ref/contrib/csrf/

-- 
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: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread Fatrix
I didn't aim to start a discussion about which IDE is better. But
every one has its own pros and cos.

While working with Aptana I had to recreate several times a broken
workspace, a really annoying work.
That was my main reason to switch from the free Eclipse-World to the
(not expensive) PyCharm
world.

For me the most significant feature a IDE must provide is a vi-mode.
No fun without vi.

-- 
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: Multiple Databases || External Databases

2011-07-18 Thread Andre Terra
Or maybe you want to authenticate using a remote resource?

Authentication using REMOTE_USER
https://docs.djangoproject.com/en/dev/howto/auth-remote-user/


Cheers,
AT

On Mon, Jul 18, 2011 at 6:08 AM, Uros Trebec  wrote:

>
>
> On Jul 17, 10:36 pm, Lycan  wrote:
> > I am building a Django User profile management portal. In one of the
> > sections of the website i need pull data from an external database(Its
> > managed by someone else, i have access to it).
> >
> > How can i achieve this and also can someone please point me to a
> > working example.
>
> You should probably take a look at:
> * manage.py inspectdb command
> https://docs.djangoproject.com/en/1.3/ref/django-admin/#inspectdb
>
> * Multiple DB:
> https://docs.djangoproject.com/en/1.3/topics/db/multi-db/
>
>
> If that fails, ask away.
>
> Regards,
> Uros
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: syntax

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 18, 2011 at 6:30 PM, Andre Terra  wrote:

> There is an error because you are concatenating the function _() and the
> string '%s: %s \n'
>
> You also don't need the space before \n
>
> and don't add unnecessary spaces: (the_waybill, str(errorObj.code)) is the
> right way to write the last part of the code[1].
>

Damn, I always add spaces.. didn't realise there was a PEP against it :X Ty
for this.


>
>
> [1] http://www.python.org/dev/peps/pep-0008/
>
>
>
> Regards,
> AT
>
>
> On Mon, Jul 18, 2011 at 2:21 PM, NISA BALAKRISHNAN <
> snisa.balakrish...@gmail.com> wrote:
>
>>
>> self.ErrorMessages = _('Problem with data of Waybill') ' %s: %s \n' %
>> ( the_waybill, str( errorObj.code ) )
>>
>> there is an error in this statement. i do not know if this is a valid
>> python assignment statement
>> becoz what i want to assign to self.errormessages is Problem with data
>> of waybill (-value in- -variable  waybill--) : (errorobjcode) .
>> Problem with data of waybill is a translatable string.
>> On Jul 18, 9:14 pm, "Cal Leeming [Simplicity Media Ltd]"
>>  wrote:
>> > Something like this?
>> >
>> > _str = _('Problem with data of Waybill')
>> > _str2 = "%s: %s \n" % ( the_waybill, str( errorObj.code ) )
>> > self.ErrorMessages = "%s %s" % ( _str, _str2)
>> >
>> > (i split into two parts to make it easier on the eyes)
>> >
>> > Cal
>> >
>> > On Mon, Jul 18, 2011 at 5:59 PM, NISA BALAKRISHNAN <
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > snisa.balakrish...@gmail.com> wrote:
>> > > what is the correct syntax for this:
>> > > self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
>> > > ( the_waybill, str( errorObj.code ) )
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> Groups
>> > > "Django users" group.
>> > > To post to this group, send email to django-users@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > django-users+unsubscr...@googlegroups.com.
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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: syntax

2011-07-18 Thread Andre Terra
There is an error because you are concatenating the function _() and the
string '%s: %s \n'

You also don't need the space before \n

and don't add unnecessary spaces: (the_waybill, str(errorObj.code)) is the
right way to write the last part of the code[1].


[1] http://www.python.org/dev/peps/pep-0008/



Regards,
AT

On Mon, Jul 18, 2011 at 2:21 PM, NISA BALAKRISHNAN <
snisa.balakrish...@gmail.com> wrote:

>
> self.ErrorMessages = _('Problem with data of Waybill') ' %s: %s \n' %
> ( the_waybill, str( errorObj.code ) )
>
> there is an error in this statement. i do not know if this is a valid
> python assignment statement
> becoz what i want to assign to self.errormessages is Problem with data
> of waybill (-value in- -variable  waybill--) : (errorobjcode) .
> Problem with data of waybill is a translatable string.
> On Jul 18, 9:14 pm, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
> > Something like this?
> >
> > _str = _('Problem with data of Waybill')
> > _str2 = "%s: %s \n" % ( the_waybill, str( errorObj.code ) )
> > self.ErrorMessages = "%s %s" % ( _str, _str2)
> >
> > (i split into two parts to make it easier on the eyes)
> >
> > Cal
> >
> > On Mon, Jul 18, 2011 at 5:59 PM, NISA BALAKRISHNAN <
> >
> >
> >
> >
> >
> >
> >
> > snisa.balakrish...@gmail.com> wrote:
> > > what is the correct syntax for this:
> > > self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
> > > ( the_waybill, str( errorObj.code ) )
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: syntax

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Well I just pasted you valid python syntax, so why not try that? Or am I
missing something? :X

On Mon, Jul 18, 2011 at 6:21 PM, NISA BALAKRISHNAN <
snisa.balakrish...@gmail.com> wrote:

>
> self.ErrorMessages = _('Problem with data of Waybill') ' %s: %s \n' %
> ( the_waybill, str( errorObj.code ) )
>
> there is an error in this statement. i do not know if this is a valid
> python assignment statement
> becoz what i want to assign to self.errormessages is Problem with data
> of waybill (-value in- -variable  waybill--) : (errorobjcode) .
> Problem with data of waybill is a translatable string.
> On Jul 18, 9:14 pm, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
> > Something like this?
> >
> > _str = _('Problem with data of Waybill')
> > _str2 = "%s: %s \n" % ( the_waybill, str( errorObj.code ) )
> > self.ErrorMessages = "%s %s" % ( _str, _str2)
> >
> > (i split into two parts to make it easier on the eyes)
> >
> > Cal
> >
> > On Mon, Jul 18, 2011 at 5:59 PM, NISA BALAKRISHNAN <
> >
> >
> >
> >
> >
> >
> >
> > snisa.balakrish...@gmail.com> wrote:
> > > what is the correct syntax for this:
> > > self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
> > > ( the_waybill, str( errorObj.code ) )
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: syntax

2011-07-18 Thread NISA BALAKRISHNAN

self.ErrorMessages = _('Problem with data of Waybill') ' %s: %s \n' %
( the_waybill, str( errorObj.code ) )

there is an error in this statement. i do not know if this is a valid
python assignment statement
becoz what i want to assign to self.errormessages is Problem with data
of waybill (-value in- -variable  waybill--) : (errorobjcode) .
Problem with data of waybill is a translatable string.
On Jul 18, 9:14 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Something like this?
>
> _str = _('Problem with data of Waybill')
> _str2 = "%s: %s \n" % ( the_waybill, str( errorObj.code ) )
> self.ErrorMessages = "%s %s" % ( _str, _str2)
>
> (i split into two parts to make it easier on the eyes)
>
> Cal
>
> On Mon, Jul 18, 2011 at 5:59 PM, NISA BALAKRISHNAN <
>
>
>
>
>
>
>
> snisa.balakrish...@gmail.com> wrote:
> > what is the correct syntax for this:
> > self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
> > ( the_waybill, str( errorObj.code ) )
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: manytomany query problem

2011-07-18 Thread Tony
As I still haven't solved this, any suggestions would be appreciated.

On Jun 26, 10:16 pm, Tony  wrote:
> Alex,
> I did it your way and although it does return the intersected sets
> correctly, it is not exactly what I want because I need those sets to
> be returned with their respective model A objects.  So, referring back
> to the end result of my example above:
> a1 to (b1,), a2 to None, a3 to (b1,)
> I want to return this (I use the prime symbol ' to denote that these
> are the new filtered sets):
> a1'.b_set = (b1,) a2'.b_set = None, a3.b_set = (b1,)
> You gave me this:
> [(b1,), None (or does it return nothing?), (b1,)]
> You were close, but how to I switch yours to what I want above it?
>
> On Jun 24, 3:36 pm, Nikhil Somaru  wrote:
>
> > When you say 'filter' do you mean that you want some objects removed (i.e.
> > filtered), or, do you mean that you want all the A's returned to be in a
> > list that is sorted?
>
> > On Fri, Jun 24, 2011 at 5:55 AM, Tony  wrote:
> > > Nikhil,
> > > This email will be significantly shorter than the one I wrote 5
> > > minutes ago before my laptop ran out of battery and failed to get
> > > sent.  I didn't explain this clearly so I am going to give an example
> > > (a much smaller one than the one I jsut wrote).
> > > Lets say I have 3 object As (a1, a2, a3) and 3 object Bs (b1, b2, b3).
> > > the relations are as follows:
> > > a1 to (b1, b2), a2 to (b2, b3), a3 to (b1, b3)
> > > The user who makes the request is b2. b2 has a "friend connection"
> > > with b1 only (so b2 to (b1,)).  It could have more friends, but for
> > > simplicity it will have only 1.  What I want to return is this:
> > > a1 to (b1,), a2 to None, a3 to (b1,).
>
> > > I always want to return all of my model "A" objects, but I want to
> > > filter the model "B" objects within each based on who the current
> > > user's "friend connections are".  How do I do this in code?
>
> > > On Jun 23, 9:02 pm, Nikhil Somaru  wrote:
> > > > Hi Tony,
>
> > > > Try this:
>
> > > > q1 = A.objects.filter(B=your_b1_instance) # that gets you all A with B =
> > > > your_b1_instance
> > > > q2 = A.objects.filter(B__B=your_b2_instance) #that gets you all A with
> > > B.B =
> > > > your_b2_instance
> > > > result = set(q1).intersection(set(q2)) #gives you the A's that are 
> > > > common
> > > to
> > > > both sets.
> > > > result = list(result) #convert it back to a list
>
> > > > There might be an easier way to do it with just the ORM, but that should
> > > > work for now
>
> > > > On Thu, Jun 23, 2011 at 8:46 PM, Tony  wrote:
> > > > > You have the question I was asking correct, your notation was fine.
> > > > > The only thing I should add is I want to return all A, but filter  my
> > > > > "B1"s (as you put it) for each A. I will post my models if need be,
> > > > > but they are on another computer and its not convenient right now.  In
> > > > > the meantime, do you have any ideas for this query?
>
> > > > > On Jun 23, 11:50 am, Nikhil Somaru  wrote:
> > > > > > It is very hard to read your message. Please format it appropriately
> > > next
> > > > > > time. Avoid repeating variable names and mixing classes with
> > > instances.
> > > > > > Could you post your models here?
>
> > > > > > Are you defining the following structure:
>
> > > > > > A hasMany B;
> > > > > > B hasMany A;
> > > > > > B hasMany B;
>
> > > > > > So you want* A such that A.yourB1.yourB2 exists*? Sorry for the
> > > notation.
>
> > > > > > On Thu, Jun 23, 2011 at 12:03 PM, Tony  wrote:
> > > > > > > I have two models with a manytomany through relation (A and B).  B
> > > has
> > > > > > > a self referential manytomany relation (a userprofile model).  How
> > > > > > > could I filter objects of model B per each relationship with model
> > > A?
> > > > > > > So lets say 3 arbitrary model A objects have 20 model B object
> > > > > > > relations each.  I want to filter the relations so when I return
> > > the
> > > > > > > filtered version of model A is outputted, each object of type 
> > > > > > > model
> > > A
> > > > > > > returns only object Bs (the userprofiles) that are connected
> > > through
> > > > > > > the self referential manytomany relationship to the userprofile
> > > (the
> > > > > > > object B, sorry if I use them interchangeably but they are the 
> > > > > > > same
> > > > > > > thing) that is currently sending in the request.  I figure out
> > > which
> > > > > > > userprofile is sending the request with a unique identifier sent 
> > > > > > > by
> > > > > > > the user in the request (basically their primary key).  Is this
> > > type
> > > > > > > of filtering possible.
>
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the Google
> > > > > Groups
> > > > > > > "Django users" group.
> > > > > > > To post to this group, send email to 

Re: syntax

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Something like this?

_str = _('Problem with data of Waybill')
_str2 = "%s: %s \n" % ( the_waybill, str( errorObj.code ) )
self.ErrorMessages = "%s %s" % ( _str, _str2)

(i split into two parts to make it easier on the eyes)

Cal

On Mon, Jul 18, 2011 at 5:59 PM, NISA BALAKRISHNAN <
snisa.balakrish...@gmail.com> wrote:

> what is the correct syntax for this:
> self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
> ( the_waybill, str( errorObj.code ) )
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: using signals to add users to a group

2011-07-18 Thread Shawn Milochik
What traceback do you get?

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



syntax

2011-07-18 Thread NISA BALAKRISHNAN
what is the correct syntax for this:
self.ErrorMessages = _('Problem with data of Waybill') '%s: %s \n' %
( the_waybill, str( errorObj.code ) )

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



using signals to add users to a group

2011-07-18 Thread Andrew Marder
Dear Django Users,

I want to add users to a particular group based on the domain of their
email address. I set up some code in models.py to do this and it seems
to work. But, when I go to test the code things don't work out so
smoothly. I think in the test environment the objects I try to create
in models.py may not be inserted in the test database. Any ideas for
good work arounds?

https://github.com/mvpdev/nmis/blob/feature%2Fdj13/user_management/models.py#L29
https://github.com/mvpdev/nmis/blob/feature%2Fdj13/user_management/tests.py#L35

Andrew

-- 
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: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Brett Parker
On 18 Jul 18:28, Dmitry Gladkov wrote:
> I like the idea, but I don't like the approach, it should be a
> subclass of PositiveIntegerField, as it is an unsigned int on DB
> level. Also, I agree with Łukasz that it should support both IPv6 and
> IPv4.

IPAddressField appears to be v4 only for backwards compatibilty reasons,
GenericIPAddressField covers both, so in theory I've got no problems
with that, other than it making IPAddressField backwards incompatible
which seems silly at this point, and I'd be recommending people to be
using GenericIPAddressField anyways.
-- 
Brett Parker

-- 
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: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Dmitry Gladkov
I like the idea, but I don't like the approach, it should be a
subclass of PositiveIntegerField, as it is an unsigned int on DB
level. Also, I agree with Łukasz that it should support both IPv6 and
IPv4.


--
Best wishes,
Dmitry Gladkov, mailto:dmitry.glad...@gmail.com

+380 91 303-37-46



On Mon, Jul 18, 2011 at 6:21 PM, Javier Guerra Giraldez
 wrote:
> On Mon, Jul 18, 2011 at 10:13 AM, Javier Guerra Giraldez
>  wrote:
>> On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>>> It stores the IP address in integer form, meaning the lookups on large
>>> tables are much faster:
>>
>> are they?    hashtables shouldn't be too sensitive to key size, as
>> long as the string size stays bounded... like on IP addresses (max 15
>> chars)
>
> OTOH, for really huge database tables, making the index 4 times
> smaller can be a significant difference on RAM-starved servers
> but to fill 1G can hold something like of 50million IP addresses in
> text form...
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>

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



Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Javier Guerra Giraldez
On Mon, Jul 18, 2011 at 10:13 AM, Javier Guerra Giraldez
 wrote:
> On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
>> It stores the IP address in integer form, meaning the lookups on large
>> tables are much faster:
>
> are they?    hashtables shouldn't be too sensitive to key size, as
> long as the string size stays bounded... like on IP addresses (max 15
> chars)

OTOH, for really huge database tables, making the index 4 times
smaller can be a significant difference on RAM-starved servers
but to fill 1G can hold something like of 50million IP addresses in
text form...

-- 
Javier

-- 
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: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Or maybe you were talking about hash tables in MySQL.

Either way, you're right that this would probably need some benchmarks
before being approved for the core.

@django-developers, if I was to provide some benchmarks, would this possibly
be considered for the core?

Cal

On Mon, Jul 18, 2011 at 4:15 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Sorry, I should have been a little more specific.
>
> I meant faster lookups in terms of database index, such as MySQL with
> InnoDB.
>
> Cal
>
>
> On Mon, Jul 18, 2011 at 4:13 PM, Javier Guerra Giraldez <
> jav...@guerrag.com> wrote:
>
>> On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd]
>>  wrote:
>> > It stores the IP address in integer form, meaning the lookups on large
>> > tables are much faster:
>>
>> are they?hashtables shouldn't be too sensitive to key size, as
>> long as the string size stays bounded... like on IP addresses (max 15
>> chars)
>>
>> of course, i don't know about the specific dict implementation on
>> Python.  Sounds like a job for a microbenchmark!
>>
>> --
>> Javier
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

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



Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Sorry, I should have been a little more specific.

I meant faster lookups in terms of database index, such as MySQL with
InnoDB.

Cal

On Mon, Jul 18, 2011 at 4:13 PM, Javier Guerra Giraldez
wrote:

> On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > It stores the IP address in integer form, meaning the lookups on large
> > tables are much faster:
>
> are they?hashtables shouldn't be too sensitive to key size, as
> long as the string size stays bounded... like on IP addresses (max 15
> chars)
>
> of course, i don't know about the specific dict implementation on
> Python.  Sounds like a job for a microbenchmark!
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Javier Guerra Giraldez
On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> It stores the IP address in integer form, meaning the lookups on large
> tables are much faster:

are they?hashtables shouldn't be too sensitive to key size, as
long as the string size stays bounded... like on IP addresses (max 15
chars)

of course, i don't know about the specific dict implementation on
Python.  Sounds like a job for a microbenchmark!

-- 
Javier

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



Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Hi,

I have created a ModelField called RealIPAddressField.

It stores the IP address in integer form, meaning the lookups on large
tables are much faster:

http://djangosnippets.org/snippets/2493/

@django-developers - Do you think there is any possibility of this getting
included into the core?

@django-users - Hope this is of some use to someone else, would appreciate
any criticisms / improvements.

Cal

-- 
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: import django models without runing the server

2011-07-18 Thread Shawn Milochik
On Mon, Jul 18, 2011 at 10:33 AM, bruno desthuilliers
 wrote:
> On Jul 18, 3:33 pm, Alexander Crössmann
>  wrote:
>> Hi Malcom,
>>
>> I am not sure the management commands are what I want
>
> Strange enough, it seems that everyone starts by saying this and ends
> up writing custom management commands ;)
>


Getting the DJANGO_SETTINGS_MODULE correct is all that's needed. I've
never created a management command, nor needed to.

If all you want to do is use Django models in a script there's no need
for anything else.

-- 
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: import django models without runing the server

2011-07-18 Thread bruno desthuilliers
On Jul 18, 3:33 pm, Alexander Crössmann
 wrote:
> Hi Malcom,
>
> I am not sure the management commands are what I want

Strange enough, it seems that everyone starts by saying this and ends
up writing custom management commands ;)

-- 
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:NameError at /admin/

2011-07-18 Thread arthur_mwai
I wanted to register an app called "news" in the admin site and i got
this error:

NameError at /admin/
name 'news' is not defined
Request Method: GET
Request URL:http://127.0.0.1:8000/admin/
Django Version: 1.3
Exception Type: NameError
Exception Value:
name 'news' is not defined
Exception Location: /home/arthur/code_testing/news/admin.py in
, line 3

here is my admi.py:

from django.contrib import admin
from news.models import Articles

class ArticlesAdmin(admin.ModelAdmin):
  pass
admin.site.register(Articles,ArticlesAdmin)

and below is my urls.py
from django.conf.urls.defaults import patterns, include, url


from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Examples:
# url(r'^$', 'code_testing.views.home', name='home'),
# url(r'^code_testing/', include('code_testing.foo.urls')),

# Uncomment the admin/doc line below to enable admin
documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)

-- 
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 - can't open image in model save()

2011-07-18 Thread br
Not sure if this is your problem but there are some issues with some
PIL installations and JPG files that require some potential
configuration/install-time magic, so make sure you test on PNG's or
GIF's first and make sure its working with those.  If it ends up being
JPG-specific issue, and google doesn't turn up the work-through for
it, post here, and I can dig up the blog posts I used to resolve my
JPG issues with PIL and Django's ImageField.

Ben

On Jul 18, 7:23 am, Malcolm Box  wrote:
> On 18 July 2011 02:04, galgal  wrote:
>
>
>
>
>
>
>
>
>
> > def upload_path_handler(instance, filename):
>
> > return filename
>
> > class SpectacleGallery(models.Model):
>
> >  image = models.ImageField(upload_to=upload_path_handler)
>
> > def save(self, *args, **kwargs):
>
> >  Image.open(self.image)
>
> >  super(SpectacleGallery, self).save(*args, **kwargs)
>
> >  When I try to open it I get:
>
> > IOError at /admin/index/spectacle/1/
> > cannot identify image file
>
> You should be able to pass SpectacleGallery.image to PIL open - I've done
> similar things in the path.
>
> What happens when you step through the code - what's the value of
> self.image? Is it really a valid image file? Is it where it thinks it is?
>
> 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: import django models without runing the server

2011-07-18 Thread Alexander Crössmann
Hi Malcom,

I am not sure the management commands are what I want, but the setting
of the DJANGO_SETTINGS_MODULE environment variable helped. I had
experimented with these settings already, but wasn't successful until now.

So, thanks for the help!
Alex





Am 18.07.2011 15:17, schrieb Malcolm Box:
> On 18 July 2011 13:34, Alexander Crössmann
>  > wrote:
>
> Hi,
>
> I want to write a python script that works with django models without
> runing the server. My OS ist Ubuntu 10.10.
>
>
> I'd suggest using Django management commands:
> https://docs.djangoproject.com/en/1.3//howto/custom-management-commands/
>
> Much easier than doing things manually.
>  
>
> The settings work fine with testserver and apache but wenn I run the
> that skript I geht the following error:
>
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
>
>
> You need to set the DJANGO_SETTINGS_MODULE environment variable.
>
> 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django - can't open image in model save()

2011-07-18 Thread Malcolm Box
On 18 July 2011 02:04, galgal  wrote:

> def upload_path_handler(instance, filename):
>
> return filename
>
> class SpectacleGallery(models.Model):
>
>  image = models.ImageField(upload_to=upload_path_handler)
>
> def save(self, *args, **kwargs):
>
>  Image.open(self.image)
>
>  super(SpectacleGallery, self).save(*args, **kwargs)
>
>  When I try to open it I get:
>
> IOError at /admin/index/spectacle/1/
> cannot identify image file
>
>
You should be able to pass SpectacleGallery.image to PIL open - I've done
similar things in the path.

What happens when you step through the code - what's the value of
self.image? Is it really a valid image file? Is it where it thinks it is?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Class-Based Generic Views (CreateView) - field exclusions and defaults

2011-07-18 Thread br
While this doesn't contribute an answer to your question, I must say
that name "class-based generic views" is a bit misleading . . .
implying that these class-based views are for doing things you want to
do that follow a strictly set pattern out of the box (i.e, listviews,
detailviews, create views, etc.), but that you'll have to use
something else (i.e., function based views) if you are defining your
own views.  However, this is not the case at all.  We wanted to switch
all our views to class-based, and have had great success with writing
our own class-based views by extending built-in view and mixin
classes.  Basically, most of our own views extend the generic
TemplateView and we add in our own Mixins or add functionality to the
overridden class methods. Some of our views extend other generic view
classes. As the documentation gets updated and edited, this paradigm
probably ought to be explained, because for a while I just figured
that i still had to still use function views if I wanted to do
anything custom, beyond what the generic views provide in and of
themselves.  They're a different beast but can be much more DRY and
add some OO awesomeness to your code once you get your head around
them.  For now, I'd recommend looking at the source code to see which
functions you can override, its pretty straightforward.

Ben

On Jul 16, 12:26 pm, Paul Walsh  wrote:
> Hi Russ,
>
> Wow - your response is *exactly* what I needed - thanks a great deal :)
>
> As you mention in there, *because* CreateView gets me so far without the
> Form class (it builds me a form based on the model I declare), I was exactly
> looking to do other "ModelForm" stuff at the CreateView level.
>
> Now it is clear to me what I need to do. Thanks for your class-based generic
> views contribution, and I really hope someone will have the chance to do
> more docs and examples for class-based views.

-- 
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: import django models without runing the server

2011-07-18 Thread Malcolm Box
On 18 July 2011 13:34, Alexander Crössmann
wrote:

> Hi,
>
> I want to write a python script that works with django models without
> runing the server. My OS ist Ubuntu 10.10.
>
>
I'd suggest using Django management commands:
https://docs.djangoproject.com/en/1.3//howto/custom-management-commands/

Much easier than doing things manually.


> The settings work fine with testserver and apache but wenn I run the
> that skript I geht the following error:
>
> ImportError: Settings cannot be imported, because environment variable
> DJANGO_SETTINGS_MODULE is undefined.
>
>
You need to set the DJANGO_SETTINGS_MODULE environment variable.

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



import django models without runing the server

2011-07-18 Thread Alexander Crössmann
Hi,

I want to write a python script that works with django models without
runing the server. My OS ist Ubuntu 10.10.

My skipt looks as follows:

import sys
sys.path.append('/home/myname/python/django_projects/')
sys.path.append('/home/myname/python/')
import settings
from django_projects.codierung.models import *

The settings work fine with testserver and apache but wenn I run the
that skript I geht the following error:

ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.

What else do I need to define appart from the stuff that is allready in
the settings file? I read the page on settings in the documentation but
that wouldn't help me.

Thanks for any Help!
Alex

-- 
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.core.urlresolvers.reverse capturing group before include behavior

2011-07-18 Thread Squeesh
Both*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9r8bIyO8WyUJ.
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.core.urlresolvers.reverse capturing group before include behavior

2011-07-18 Thread Squeesh
Thanks Chang.Jian,


Goth

test_url = reverse('test.views.index', args=['slug'])

and 

test_url = reverse('test.views.index', kwargs={'some_slug': 'slug'})

work as expected... 

reverse('test:index', args=['slug']) would be the desired syntax, but the 
other will work fine as a work around. Anyone know if this is a known issue 
with the dev team? My Google searches didn't come up with much.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WjsHILwvJlwJ.
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: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Personally, I absolutely hate Eclipse and anything associated with it.

An IDE really comes down to personal preference, which is why there are so
many of them.

I'd like to throw Komodo in the mix. I moved from NetBeans to Komodo about 2
months ago, and haven't looked back since. Although Komodo could be
improved, it's the best I've found so far.

On Mon, Jul 18, 2011 at 1:28 PM, Andre Terra  wrote:

>
> Well, i would recommend that you use a simple editor(like vim in linux) or
>> Programmer's Notepad(in windows) for development in django/python.
>> It is much easier to develop and also helps you keep your development
>> environment 'lightweight'.
>>
>> An IDE is required only for languages like Java, where there is loads of
>> boilerplate code; python inherently doesnt have much of it, and hence the
>> rationale to switch over to a 'simple editor'.
>>
>
> I personally like Aptana because it's incredibly easy to browse my source
> code, with hyperlinks and visual cues to required args and kwargs, not to
> mention docstrings, etc.
>
> It also has some degree of support for django templates and allows you to
> configure different python interpreters (i.e. virtualenvs) that can be used
> for running your project from within the IDE or through debugging with
> breakpoints.
>
> Now about the OP, this is the reference you should be following:
>
>
> http://blog.vlku.com/index.php/2009/06/10/djangoeclipse-with-code-complete-screencast/
>
>
> Note that Aptana is just a slightly modified version of Eclipse (in both
> its plugin and standalone flavors), so nearly everything you read about the
> latter applies to the former.
>
>
> Cheers,
> AT
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread Andre Terra
On Mon, Jul 18, 2011 at 4:01 AM, Fatrix  wrote:

>
> -V, before using PyCharm I was also developing with a simple editor
> (vi).
> Aptana wasn't a good choice, because the support for Django isn't
> built-in.
> PyCharm doesn't face you with these kind of problems, because PyCharm
> is very well
> prepared for Django-based applications.
>

Aptana is *very* prepared for Django, including (but not limited to) (some
degree of) support for the template language.

It's also *free as in beer*, which PyCharm is not.


Regards,
AT

-- 
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: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread Andre Terra
> Well, i would recommend that you use a simple editor(like vim in linux) or
> Programmer's Notepad(in windows) for development in django/python.
> It is much easier to develop and also helps you keep your development
> environment 'lightweight'.
>
> An IDE is required only for languages like Java, where there is loads of
> boilerplate code; python inherently doesnt have much of it, and hence the
> rationale to switch over to a 'simple editor'.
>

I personally like Aptana because it's incredibly easy to browse my source
code, with hyperlinks and visual cues to required args and kwargs, not to
mention docstrings, etc.

It also has some degree of support for django templates and allows you to
configure different python interpreters (i.e. virtualenvs) that can be used
for running your project from within the IDE or through debugging with
breakpoints.

Now about the OP, this is the reference you should be following:

http://blog.vlku.com/index.php/2009/06/10/djangoeclipse-with-code-complete-screencast/


Note that Aptana is just a slightly modified version of Eclipse (in both its
plugin and standalone flavors), so nearly everything you read about the
latter applies to the former.


Cheers,
AT

-- 
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: USE_I18N vs. USE_L10N

2011-07-18 Thread Shawn Milochik
If you look up those terms in the Django docs instead of Wikipedia I think
that will erase your confusion.

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



Pinboard.in links on Django Community feeds page usually don't work.

2011-07-18 Thread swiharta
With the rise in popularity of tagging Django links using Pinboard.in,
it would be nice if the links on the feeds page actually worked. The
titles come across fine, but the url's usually just point to the
pinboard.in homepage. I just highlight the title and Google it to find
the page, not a lot of work, but definitely suboptimal. I don't know
if this forum is the right place to report 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.



USE_I18N vs. USE_L10N

2011-07-18 Thread Lucy Brennan
I believe I understand the general definitions of internationalization
and localization, e.g. as defined on 
http://en.wikipedia.org/wiki/Internationalization_and_localization.
Internationalization is somewhat like building/designing a piece of
software for being used with different locales. And localization is
then making some localized version withing the boundaries set by the ,
e.g. making all the translated versions and date formatting for
Germany.

According to those definitions, I think it makes sense to "turn off
i18n and l10n". But what does it mean to turn of one and not the
other?

They only make sense in relation to each other, and turning one of
without turning the other off, does not make sense to me.

I don't think it is obvious what they do?

Lucy

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



Re: SQL Server Support - Does it Exist

2011-07-18 Thread Tom Evans
On Fri, Jul 15, 2011 at 3:21 AM, Python_Junkie
 wrote:
> I have installed django-mssql and still seem to be stuck.
>
> What are the correct attributes that need to be set in the settings.py
> file?
>
> I am getting an error
>
> This is how I have configured my settings.py file
> 
> DATABASE
>
> S = {
>    'default': {
>        'NAME': 'notes',
>        'ENGINE': 'django.db.backends.sqlserver_ado',


Compare and contrast what you have for ENGINE, and what the example
docs for django-mssql say.

http://code.google.com/p/django-mssql/wiki/Settings

Hint: 3rd party dB backends don't live in django.db.backends.

Cheers

Tom

-- 
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: AW: AW: admin_media_prefix in page source is wrong

2011-07-18 Thread Bram Deprettere

Op 18/07/2011 9:42, Szabo, Patrick (LNG-VIE) schreef:

Maybe I'm still not getting it but I think what you want to set is 
admin_media_url instead of admin_media_prefix.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
  XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573
Fax: +43 (1) 534 52 - 146


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bram Deprettere
Gesendet: Montag, 18. Juli 2011 09:36
An: django-users@googlegroups.com
Betreff: Re: AW: admin_media_prefix in page source is wrong

I mean I used ln -ls to make a link to
../../lib/python2.7/site-packages/django/contrib/admin/static/admin
inside my static-folder.






I use a symbolic link to the static admin files of django instead of 
copying the files to the static folder of my project.
That link works - when I go to http://inventory/static/admin is can see 
the css/img/js folders for admin.



I just tried to set admin_media_url but it doesn't work either.



--
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: Multiple Databases || External Databases

2011-07-18 Thread Uros Trebec


On Jul 17, 10:36 pm, Lycan  wrote:
> I am building a Django User profile management portal. In one of the
> sections of the website i need pull data from an external database(Its
> managed by someone else, i have access to it).
>
> How can i achieve this and also can someone please point me to a
> working example.

You should probably take a look at:
* manage.py inspectdb command
https://docs.djangoproject.com/en/1.3/ref/django-admin/#inspectdb

* Multiple DB:
https://docs.djangoproject.com/en/1.3/topics/db/multi-db/


If that fails, ask away.

Regards,
Uros

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



AW: unable to show headline

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Take a look at the sourcecode of the html.

Maybe it's there but has a weird style or if it's not there at all you
might want to show us what's actually in "My_Model_Name.Attribute1"

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von bahare hoseini
Gesendet: Montag, 18. Juli 2011 10:49
An: django-users@googlegroups.com
Betreff: unable to show headline

 

hi,

i used  this code: {{ My_Model_Name.Attribute1 }} in my html
page. when i open this page with browser, mentioned HEADER isn't
visible, but rest of things(buttons, texts, ...) is visible,

 

can anybody help me plz?

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



AW: Delete a record

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Do you mean actually deleting an entry  in the db

 

https://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queri
es-delete 

 

or removing (not showing) it from the form that is shown in html:

 

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-s
ubset-of-fields-on-the-form 

 

hope this helps...

 

Von: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] Im Auftrag von bahare hoseini
Gesendet: Montag, 18. Juli 2011 10:43
An: django-users@googlegroups.com
Betreff: Delete a record

 

hi there,

does someone know how i can delete a record from my form, i'm using
SQLite3 ? 

thank you

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


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 





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



unable to show headline

2011-07-18 Thread bahare hoseini
hi,
i used  this code: {{ My_Model_Name.Attribute1 }} in my html page.
when i open this page with browser, mentioned HEADER isn't visible, but rest
of things(buttons, texts, ...) is visible,

can anybody help me plz?

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



Delete a record

2011-07-18 Thread bahare hoseini
hi there,
does someone know how i can delete a record from my form, i'm using SQLite3
?
thank you

-- 
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: FTP prefic in URL field

2011-07-18 Thread ggavy
Thanks Tim,
  I kinda guessed that would be the case. Thanks for the advice.

G

On Jul 15, 3:12 pm, Tim Shaffer  wrote:
> Yeah, it doesn't look like 1.1 allowed for ftp protocol:
>
> https://github.com/django/django/blob/1.1.X/django/forms/fields.py#L545
>
> Best bet might be to create your own URLField class and overwrite the
> __init__ method to use your own regular expression. Kind of a pain. It's a
> little easier in future versions because you can just overwrite the
> validator instead of the whole field.

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



AW: AW: admin_media_prefix in page source is wrong

2011-07-18 Thread Szabo, Patrick (LNG-VIE)
Maybe I'm still not getting it but I think what you want to set is 
admin_media_url instead of admin_media_prefix.


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bram Deprettere
Gesendet: Montag, 18. Juli 2011 09:36
An: django-users@googlegroups.com
Betreff: Re: AW: admin_media_prefix in page source is wrong

I mean I used ln -ls to make a link to 
../../lib/python2.7/site-packages/django/contrib/admin/static/admin 
inside my static-folder.




-- 
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: AW: admin_media_prefix in page source is wrong

2011-07-18 Thread Bram Deprettere

Op 15/07/2011 9:33, Szabo, Patrick (LNG-VIE) schreef:

I'm sorry maybe this is a dumb question but what do you mean when you say

" Inside static-folder I made a link
to ../../lib/python2.7/site-packages/django/contrib/admin/static/admin
for the admin-media files."

?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
  XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573
Fax: +43 (1) 534 52 - 146


-Ursprüngliche Nachricht-

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Bram Deprettere
Gesendet: Freitag, 15. Juli 2011 09:11
An: django-users@googlegroups.com
Betreff: admin_media_prefix in page source is wrong

I'm having the following situation;
django project named inventory
Made a folder static for media-files. Inside static-folder I made a link
to ../../lib/python2.7/site-packages/django/contrib/admin/static/admin
for the admin-media files.

When I go to http://inventory/admin, the static/admin files are not
loaded - so the page is shown without formatting.

When I check the page source, it shows
admin_media_prefix="http://inventory/admin/; instead of
http://inventory/static/admin/ as set in settings.py.

I'm using django 1.4 in a virtual env, nginx as frontend. When I go to
http://inventory/static/admin it shows the css,... so that is configured
correctly.





I mean I used ln -ls to make a link to 
../../lib/python2.7/site-packages/django/contrib/admin/static/admin 
inside my static-folder.


--
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: trouble going from django on Windows to Ubuntu using Eclipse & Aptana Studio

2011-07-18 Thread Fatrix
Hi Doug

Perhaps [0] on stackoverflow helps you solving the problem (--noreload
option).
As I remember I had the same issue within Aptana.

-V, before using PyCharm I was also developing with a simple editor
(vi).
Aptana wasn't a good choice, because the support for Django isn't
built-in.
PyCharm doesn't face you with these kind of problems, because PyCharm
is very well
prepared for Django-based applications.

Regards,
Philip

[0] 
http://stackoverflow.com/questions/5572990/cannot-run-debug-djangos-manage-py-from-eclipse




On Jul 17, 7:27 pm, Venkatraman S  wrote:
> Well, i would recommend that you use a simple editor(like vim in linux) or
> Programmer's Notepad(in windows) for development in django/python.
> It is much easier to develop and also helps you keep your development
> environment 'lightweight'.
>
> An IDE is required only for languages like Java, where there is loads of
> boilerplate code; python inherently doesnt have much of it, and hence the
> rationale to switch over to a 'simple editor'.
>
> -V

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