Re: How to make an app independent on a specific site?

2011-08-23 Thread Mike Dewhirst

On 24/08/2011 2:09pm, Jim wrote:

Greetings, everyone.

I am new to Django, and much of my knowledge comes from the Django 
book version 2 . In the book, a 
site, mysite, is created for demo purposes. And an app, books, is also 
created for demo purposes. In the file, mysite/books/admin.py, there 
is a line like this:

from mysite.books.models import Publisher, Author, Book
It seems to me that this line makes the app dependent on the name of 
the site, which is mysite. There is a possibility that an app you have 
developed for a site might turn out to have generic use. So, I think 
it is a good idea to always keep an app independent on the site as 
much as possible.


Here is the question. Is it possible that to store the site name into 
a variable, such as site_name, then construct a statement like the 
following?


statement = 'from ' + site_name + '.books.models import Publisher' 
exec(statement) # I am not sure if exec is a legitimate function. Here 
is just an example

Try removing mysite ...

from books.models import Publisher etc

If that stops it working you need to look at your Python path. Make sure 
/path/to/mysite is on the pythonpath. Also check that you have 
__init__.py in each of the sub-directories.


hth

Mike










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

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


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



Re: How to make an app independent on a specific site?

2011-08-23 Thread Jim
BTW, the way I posted above isn't so elegant. Is there a better way to do 
this? Any thoughts?

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



How to make an app independent on a specific site?

2011-08-23 Thread Jim
Greetings, everyone.

I am new to Django, and much of my knowledge comes from the Django book 
version 2 . In the book, a site, mysite, 
is created for demo purposes. And an app, books, is also created for demo 
purposes. In the file, mysite/books/admin.py, there is a line like this:

from mysite.books.models import Publisher, Author, Book

It seems to me that this line makes the app dependent on the name of the 
site, which is mysite. There is a possibility that an app you have developed 
for a site might turn out to have generic use. So, I think it is a good idea 
to always keep an app independent on the site as much as possible. 

Here is the question. Is it possible that to store the site name into a 
variable, such as site_name, then construct a statement like the following?

statement = 'from ' + site_name + '.books.models import Publisher' 
exec(statement) 
# I am not sure if exec is a legitimate function. Here is just an example








-- 
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/-/Jn_07ca2t6MJ.
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: TabularInline save_model()?

2011-08-23 Thread Lee
Jeez what an easy solution, but I sure with InlineModelAdmin would
just do it for us and save us the code.

In models.py (genericized and not tested, sorry for any syntax
errors):

class MyJoinTable(model.Model):
parent_table = models.ForeignKey(ParentTable)
...
def save(self,*args,**kwargs):
if not self.created:
self.created = datetime.datetime.now()
if not self.parent_table.updated_by:
self.created_by = self.parent_table.created_by
else:
self.created_by = self.parent_table.updated_by
else:
self.updated = datetime.datetime.now()
if self.parent_table.updated:
 self.updated_by = self.parent_table.updated_by
else:
 self.updated_by = self.parent_table.created_by
super(MyJoinTable,self).save(*args,**kwargs)

Note that this depends on having the same audit fields (created,
created_by, updated, updated_by) in the parent and join tables, and
only making the join tables addable/editable from within
InlineModelAdmin. But that was the whole point, afterall. This is
basic database parent/child auditing functionality, and should be in
Django core IMHO. Maybe it is and I'm just still half-blind.

Hope this saves someone else 10 hours of hacking.

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



Re: django.contrib.markup question

2011-08-23 Thread Rodney Topor
OK.  I found the answer to my own question.  Page 128 of Practical
Django Projects, 2nd Edition, by James Bennett gives the solution.
Write the following:

{{ input_text|markdown:"safe" }}

Note there must be no space between the colon and the quote, despite
what is in the book.  Note also that this solution is not provided in
the documentation of the markup package, which simply says "read the
source code for more details".  Sheesh!

Rodney

On Aug 23, 6:45 pm, Rodney Topor  wrote:
> Um, Markdown is supposed to allow users to enter marked-up text
> safely, isn't it?  But the output of the markdown filter is assumed to
> be safe.  Writing {{ input_text|escape|markdown }} in a template
> doesn't appear to escape raw HTML in the input text before the
> markdown filter is applied.  So how can one use markdown safely?
>
> Rodney

-- 
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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman
Great job.   You could've told everyone that you had a working install
and decided to break it & install from source code. but oh well.

OSS truly is the ultimate, when you break it you get to keep both pieces :-;


For the record:  why did you install from source instead of using
Ubuntu packages ?  A learning exercise?  Bug-fix? Unwanted defaults?
This might help someone in the future.


Cheers/Excelsior!

On 8/23/11, SSozuer  wrote:
> I solved the problem. I just added,
>LD_LIBRARY_PATH=/usr/local/pgsql/lib
>PATH=/usr/local/pgsql/bin:$PATH
>
> lines to my .bashrc startup shell. After that there is no error.
>
> Selcuk
>
>
> On Aug 23, 10:50 pm, Landy Chapman  wrote:
>> I reinstalled postgresql after deleting config files.  in
>> postgresql.conf I changed this line:
>> #   listen = "localhost"
>> to read:
>>
>>    listen = "*"
>>
>> Also make sure this line is uncommented:
>>    port = 5432
>>
>> Then I restarted the server.
>>     /etc/init.d/postgresql restart
>>
>> One way to see if postgresql is running would be:
>>    lsof | grep "postgres"
>>
>> >  createdb conntest
>>
>> I asked you to create a database because  if the server ISNT running
>> you would not be able to.
>>
>> >   psql -d conntest
>>
>> As another suggested, this will try to use the postgres client.  If
>> all that worked, I would've asked you to run
>>
>>   psql  -h 127.0.0.1 -d conntest
>>
>> Which, in a DEFAULT debian lenny install result in:
>>    "psql: FATAL:  password authentication failed for user "postgres"
>>
>> I set a password for postgres:
>>    su
>>    passwd postgres
>>
>> Next I change pg_hba.conf to "trust" for localhost, restarted the
>> server, and
>>     psql  -h 127.0.0.1 -d conntest
>>
>> does work.  The last step would be to use my local IP address
>>     psql  -h 192.168.1.211 -d conntest
>>
>> This would make sure remote machines could connect also.
>
> --
> 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: can django be used in destop application?

2011-08-23 Thread Andre Terra
Better yet,

http://www.riverbankcomputing.co.uk/software/pyqt/download


Cheers,
AT

On Tue, Aug 23, 2011 at 8:59 PM, Sam Walters  wrote:

> Seriously why bother?
>
> http://www.wxpython.org/
>
> The whole front end of django is too web-centric. So the only thing
> that might be of use is if you have an existing web application which
> heavily uses the django ORM and you want back end consistency with a
> desktop GUI application that shares thee same database.
>
> Writing an application with wx-python is less time consuming than
> dealing with css+html you wont have the same issues to consider when
> thinking about security. wx-python  is a 2-3 week learning curve to
> become proficient and lots of tutorials out there.
>
>
>
> On Wed, Aug 24, 2011 at 5:50 AM, h3  wrote:
> > Django is modular enough that most of its parts could probably be
> > replaced with desktop oriented
> > modules, like rendering QT templates instead of HTML templates.. which
> > is great.
> >
> > If not you can probably use a embed browser engine (like webkit) and
> > run your app like a website
> > locally and get somewhat the look and feel of a desktop application.
> >
> > That said, your real problem will arise when your application will
> > need to do things that doesn't adhere to
> > the REST api. Then you'll need to find a way to save your application
> > state and that's pretty much
> > when shit will hit the fan IMHO.
> >
> > If the desktop application(s) you want to build are all easily
> > translatable for the web (using a REST api that is),
> > I think it's theoretically possible. But try to do anything out of
> > this scope and you will bitten at every corners.
> >
> > In other words, not really worth the troubles.
> >
> > regards,
> >
> > Max
> >
> >
> > On Aug 23, 1:36 pm, "Cal Leeming [Simplicity Media Ltd]"
> >  wrote:
> >> Curious concept, using Django for a desktop application.
> >>
> >> Can't think of any reason why you couldn't at least try it :)
> >>
> >> Cal
> >>
> >> On Tue, Aug 23, 2011 at 3:49 PM, Andy McKay  wrote:
> >>
> >> > On 2011-08-23, at 4:17 AM, smith jack wrote:
> >>
> >> > > i mean not use django for web site development, but for desktop
> >> > application,
> >> > > it seems its orm can be used in destop application, isn't it?
> >>
> >> > Yes.
> >> > --
> >> >  Andy McKay
> >> >  a...@clearwind.ca
> >> >  twitter: @andymckay
> >>
> >> > --
> >> > You received this message because you are subscribed to the Google
> Groups
> >> > "Django users" group.
> >> > To post to this group, send email to django-users@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-users+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/django-users?hl=en.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: why can't I access a dictionary with an initial form field value from my django template?

2011-08-23 Thread Tony Schmidt
Thanks, Reinout.

I wound up creating a custom "getter" filter so I could do {{ MYDICT|
get:myform.somefiled.value }} - which I'm surprised isn't a built-in,
actually.  But I think your suggestion is a good alternative.

Tony

On Aug 23, 1:40 pm, Reinout van Rees  wrote:
> On 23-08-11 21:16, Tony Schmidt wrote:
>
> > I thought this should be the proper syntax in my template:
>
> > {{ MYDICT.myform.somefield.value }}
>
> > But I get a "can't parse remainder error."
>
> > Just putting {{ myform.somefield.value }} gives me "3" and {{ MYDICT.
> > 3 }} gives me the dictionary value I want.
>
> > Am I missing something?
>
> MYDICT.myform looks up an 'myform' attribute on MYDICT or the 'myform'
> key in the MYDICT dictionary. Which doesn't exist.
>
> There's no way the template language can know that it first has to look
> up the last three items and then apply that to the first item. That's
> the basic problem.
>
> Best solution probably: just do the MYDICT[myform.somefield.value] in
> your view and pass the value to the template?
>
> Reinout
>
> --
> Reinout van Rees                    http://reinout.vanrees.org/
> rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"

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



Re: Django Development environment

2011-08-23 Thread Matt Schinckel
OS:
- Mac OS X (Lion / Snow Leopard, depending on machine).
Editor:
- Formerly TextMate, now BBEdit
Database:
- Postgres installed locally
General (python/os) tools:
- virtualenv, pip, fabric, mercurial, git (for -e installation of dev 
versions on github)
Server tools:
- memcached, Werkzeug
Django apps that are almost always installed:
- south, compressor, django-test-utils, sentry, django-model-utils, 
johnny-cache, django-devserver, django-test-extensions

-- 
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/-/WM1ljqy1D24J.
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: can django be used in destop application?

2011-08-23 Thread Sam Walters
Seriously why bother?

http://www.wxpython.org/

The whole front end of django is too web-centric. So the only thing
that might be of use is if you have an existing web application which
heavily uses the django ORM and you want back end consistency with a
desktop GUI application that shares thee same database.

Writing an application with wx-python is less time consuming than
dealing with css+html you wont have the same issues to consider when
thinking about security. wx-python  is a 2-3 week learning curve to
become proficient and lots of tutorials out there.



On Wed, Aug 24, 2011 at 5:50 AM, h3  wrote:
> Django is modular enough that most of its parts could probably be
> replaced with desktop oriented
> modules, like rendering QT templates instead of HTML templates.. which
> is great.
>
> If not you can probably use a embed browser engine (like webkit) and
> run your app like a website
> locally and get somewhat the look and feel of a desktop application.
>
> That said, your real problem will arise when your application will
> need to do things that doesn't adhere to
> the REST api. Then you'll need to find a way to save your application
> state and that's pretty much
> when shit will hit the fan IMHO.
>
> If the desktop application(s) you want to build are all easily
> translatable for the web (using a REST api that is),
> I think it's theoretically possible. But try to do anything out of
> this scope and you will bitten at every corners.
>
> In other words, not really worth the troubles.
>
> regards,
>
> Max
>
>
> On Aug 23, 1:36 pm, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
>> Curious concept, using Django for a desktop application.
>>
>> Can't think of any reason why you couldn't at least try it :)
>>
>> Cal
>>
>> On Tue, Aug 23, 2011 at 3:49 PM, Andy McKay  wrote:
>>
>> > On 2011-08-23, at 4:17 AM, smith jack wrote:
>>
>> > > i mean not use django for web site development, but for desktop
>> > application,
>> > > it seems its orm can be used in destop application, isn't it?
>>
>> > Yes.
>> > --
>> >  Andy McKay
>> >  a...@clearwind.ca
>> >  twitter: @andymckay
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 testing with existing data

2011-08-23 Thread Russell Keith-Magee
On Tue, Aug 23, 2011 at 9:15 PM, Carlos Brum  wrote:
> Hello guys,
>
> I'm new in Django testing whith django test facilities.
>
> I've read "https://docs.djangoproject.com/en/1.3/topics/testing/; but
> couldn't find what i'm looking for.
>
> I'm trying to begin TDD development but wanna use my old data. I don't
> wanna have to build up all my database again. I already have data
> there.
>
> Is it possible!?

Maybe, if you *really* try hard. However, if you are genuine about
TDD, you don't actually want to use the "old database". You *must*
have a new database in order to guarantee test conditions. Good tests
have a known entry condition and a known exit condition; the only
practical way to guarantee this (and the approach implemented by
Django) is to have a fresh database configured for every test run.

However, this doesn't mean that you can't have test data in your new
database. If your live database contains some useful test data, you
can dump that data using the "dumpdata" command. This will produce a
JSON/XML fixture that can be specified in your test case; then, every
time Django runs a test, it will create a clean database and populate
it with your test data.

Yours,
Russ Magee %-)

-- 
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: saving several models with one save() call

2011-08-23 Thread SSozuer

sorry, i forgot to mentioned that you first save the A object.
On Aug 24, 1:28 am, ernando  wrote:
> Hi all,
>
> maybe it's newbie question but I wasn't able to find clear answer/
> solution on it.
>
> For example, we have the following models:
>
> class A(models.Model):
>     id = models.AutoField(primary_key=True)
>     title = models.CharField(max_length=30)
>
> class B(models.Model):
>     id = models.AutoField(primary_key=True)
>     title = models.CharField(max_length=30)
>     aItems = models.OneToOneField(A)
>
> And try to save them in the following way:
>
> a = A(title="123")
> b = B(title="333", aItems = a)
> b.save()
>
> This code runs with the error: (1364, "Field 'aItems_id' doesn't have
> a default value")
> if I firstly save a object - everything goes smoothly. So, the
> question is - should we always save all related objects manually?
> According to django docs we have to create object at first. But that's
> now always convenient - e.g. I receive full model from the 3rd part
> service and want to save it into DB with one call and not do it for
> each item.
>
> Regards,
> Dmitry

-- 
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: saving several models with one save() call

2011-08-23 Thread SSozuer
Exactly i dont know  OneToOneField() field's data type. But you can
try that,
b=B(title='333', altems = a.id)
b.save()

On Aug 24, 1:28 am, ernando  wrote:
> Hi all,
>
> maybe it's newbie question but I wasn't able to find clear answer/
> solution on it.
>
> For example, we have the following models:
>
> class A(models.Model):
>     id = models.AutoField(primary_key=True)
>     title = models.CharField(max_length=30)
>
> class B(models.Model):
>     id = models.AutoField(primary_key=True)
>     title = models.CharField(max_length=30)
>     aItems = models.OneToOneField(A)
>
> And try to save them in the following way:
>
> a = A(title="123")
> b = B(title="333", aItems = a)
> b.save()
>
> This code runs with the error: (1364, "Field 'aItems_id' doesn't have
> a default value")
> if I firstly save a object - everything goes smoothly. So, the
> question is - should we always save all related objects manually?
> According to django docs we have to create object at first. But that's
> now always convenient - e.g. I receive full model from the 3rd part
> service and want to save it into DB with one call and not do it for
> each item.
>
> Regards,
> Dmitry

-- 
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: Could not connect postgresql database

2011-08-23 Thread SSozuer
I solved the problem. I just added,
   LD_LIBRARY_PATH=/usr/local/pgsql/lib
   PATH=/usr/local/pgsql/bin:$PATH

lines to my .bashrc startup shell. After that there is no error.

Selcuk


On Aug 23, 10:50 pm, Landy Chapman  wrote:
> I reinstalled postgresql after deleting config files.  in
> postgresql.conf I changed this line:
> #   listen = "localhost"
> to read:
>
>    listen = "*"
>
> Also make sure this line is uncommented:
>    port = 5432
>
> Then I restarted the server.
>     /etc/init.d/postgresql restart
>
> One way to see if postgresql is running would be:
>    lsof | grep "postgres"
>
> >  createdb conntest
>
> I asked you to create a database because  if the server ISNT running
> you would not be able to.
>
> >   psql -d conntest
>
> As another suggested, this will try to use the postgres client.  If
> all that worked, I would've asked you to run
>
>   psql  -h 127.0.0.1 -d conntest
>
> Which, in a DEFAULT debian lenny install result in:
>    "psql: FATAL:  password authentication failed for user "postgres"
>
> I set a password for postgres:
>    su
>    passwd postgres
>
> Next I change pg_hba.conf to "trust" for localhost, restarted the
> server, and
>     psql  -h 127.0.0.1 -d conntest
>
> does work.  The last step would be to use my local IP address
>     psql  -h 192.168.1.211 -d conntest
>
> This would make sure remote machines could connect also.

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



saving several models with one save() call

2011-08-23 Thread ernando
Hi all,

maybe it's newbie question but I wasn't able to find clear answer/
solution on it.

For example, we have the following models:

class A(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=30)

class B(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=30)
aItems = models.OneToOneField(A)

And try to save them in the following way:

a = A(title="123")
b = B(title="333", aItems = a)
b.save()

This code runs with the error: (1364, "Field 'aItems_id' doesn't have
a default value")
if I firstly save a object - everything goes smoothly. So, the
question is - should we always save all related objects manually?
According to django docs we have to create object at first. But that's
now always convenient - e.g. I receive full model from the 3rd part
service and want to save it into DB with one call and not do it for
each item.

Regards,
Dmitry

-- 
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: Problems on using multiple databases

2011-08-23 Thread Jim
Still stuck on this problem. Can anybody help me out, please? It would be 
much appreciated.

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



pydra

2011-08-23 Thread hinnack
hi all,

Anyone ever used pydra?
http://code.osuosl.org/projects/pydra/wiki

could not find a thread on the list...

Regards

Henrik

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



Re: Problem updating data

2011-08-23 Thread Karen McNeil
No, that's not the problem. Even if I redo the query now, I still get
the same count (see below). And, like I said, the change does not show
up in the admin either -- THE VALUE HAS NOT BEEN CHANGED.

This behavior is so unexpected I'm not sure how to even begin trouble-
shooting it.

~Karen

PS -- What's wrong with querying by "active=0"? I did it that way
because that's what the admin interface does for filters... is there
any difference?


NEW SHELL SESSION FROM TODAY, TESTING SAME THING:

>>> from dictionary.models import Entry
>>> entries = Entry.objects.filter(active=False)
>>> entries.count()
3642
>>> e1 = entries[0]
>>> e1

>>> e1.active
False

-- 
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: HttpResponseRedirect adds hostname?

2011-08-23 Thread Roy Smith
Thanks for the explanation.  We ended up re-arranging which pieces were 
listening on which ports so the nginx front end is on port 80.  Reading the 
nginx docs, it seems like we might have been able to make our current set up do 
what we wanted, but shuffling the ports was easier :-)

Regarding:

> The munging is I think being done by whatever web
> server you're using (Apache? Nginx? It's hard to tell from your
> description; you just say "Django on port 9200"), 

it's the built-in runserver for testing, gunicorn in production.


On Aug 23, 2011, at 5:03 PM, Jacob Kaplan-Moss wrote:

> On Tue, Aug 23, 2011 at 4:01 PM, Jacob Kaplan-Moss  wrote:
>> However, I believe it's not actually Django doing the rewriting.
> 
> Scratch that: I'm wrong. Actually, Django *is* doing the re-writing:
> see 
> https://code.djangoproject.com/browser/django/trunk/django/http/utils.py#L11.
> 
> Still, the point stands that it's necessary -- standards and all that
> -- and that you should be fixing it in your proxy layer.
> 
> Jacob
> 
> -- 
> 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.
> 


---
Roy Smith
r...@panix.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: HttpResponseRedirect adds hostname?

2011-08-23 Thread Jacob Kaplan-Moss
On Tue, Aug 23, 2011 at 4:01 PM, Jacob Kaplan-Moss  wrote:
> However, I believe it's not actually Django doing the rewriting.

Scratch that: I'm wrong. Actually, Django *is* doing the re-writing:
see 
https://code.djangoproject.com/browser/django/trunk/django/http/utils.py#L11.

Still, the point stands that it's necessary -- standards and all that
-- and that you should be fixing it in your proxy layer.

Jacob

-- 
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: HttpResponseRedirect adds hostname?

2011-08-23 Thread Jacob Kaplan-Moss
On Tue, Aug 23, 2011 at 3:50 PM, Roy Smith  wrote:
> Why does it do this?  It seems like it should just take the string I passed 
> it and stick that into the header, no?

No - that might seem intuitive, but it's incorrect. The HTTP standard
specifies that the Location header should contain an absolute URI (see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30), so
Django's got to add one.

Practically, most web browsers correctly support relative URIs in
Location headers, but there're a lot more to consuming HTTP than just
browsers (spiders/crawlers, API clients, testing utilities, ...).

However, I believe it's not actually Django doing the rewriting. if
you peer through the implementation of HttpResponseRedirect
(https://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L689),
you'll see that i there's nowhere in that code path that's munging the
location header. The munging is I think being done by whatever web
server you're using (Apache? Nginx? It's hard to tell from your
description; you just say "Django on port 9200"), and that's where
you'd need to go to fix it. In Nginx, for example, I sometimes need to
mess with the proxy_redirect directive
(http://wiki.nginx.org/HttpProxyModule#proxy_redirect) to fix
situations like this.

Hope that helps,

Jacob

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



HttpResponseRedirect adds hostname?

2011-08-23 Thread Roy Smith
I've got a view which does returns HttpResponseRedirect('/').  When I look at 
the HTTP traffic in tcpdump, I can see that the location header has had the 
hostname added:

Location: http://gilbert.lic.songza.com/

Why does it do this?  It seems like it should just take the string I passed it 
and stick that into the header, no?

The problem is that we've got a complicated setup with django (on port 9200) 
and apache (on port 80) both behind nginx (on port 9300).  When I redirect to 
'/', my browser sees the absolute URL and ends up going to the apache server on 
port 80 (which is the wrong place; the nginx config would route to the django 
side).

It seems like a django bug that the string I pass HttpResponseRedirect is 
modified before generating the location header.  What do you guys think?


---
Roy Smith
r...@panix.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: why can't I access a dictionary with an initial form field value from my django template?

2011-08-23 Thread Reinout van Rees

On 23-08-11 21:16, Tony Schmidt wrote:

I thought this should be the proper syntax in my template:

{{ MYDICT.myform.somefield.value }}

But I get a "can't parse remainder error."

Just putting {{ myform.somefield.value }} gives me "3" and {{ MYDICT.
3 }} gives me the dictionary value I want.

Am I missing something?


MYDICT.myform looks up an 'myform' attribute on MYDICT or the 'myform' 
key in the MYDICT dictionary. Which doesn't exist.


There's no way the template language can know that it first has to look 
up the last three items and then apply that to the first item. That's 
the basic problem.


Best solution probably: just do the MYDICT[myform.somefield.value] in 
your view and pass the value to the template?



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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: can django be used in destop application?

2011-08-23 Thread h3
Django is modular enough that most of its parts could probably be
replaced with desktop oriented
modules, like rendering QT templates instead of HTML templates.. which
is great.

If not you can probably use a embed browser engine (like webkit) and
run your app like a website
locally and get somewhat the look and feel of a desktop application.

That said, your real problem will arise when your application will
need to do things that doesn't adhere to
the REST api. Then you'll need to find a way to save your application
state and that's pretty much
when shit will hit the fan IMHO.

If the desktop application(s) you want to build are all easily
translatable for the web (using a REST api that is),
I think it's theoretically possible. But try to do anything out of
this scope and you will bitten at every corners.

In other words, not really worth the troubles.

regards,

Max


On Aug 23, 1:36 pm, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Curious concept, using Django for a desktop application.
>
> Can't think of any reason why you couldn't at least try it :)
>
> Cal
>
> On Tue, Aug 23, 2011 at 3:49 PM, Andy McKay  wrote:
>
> > On 2011-08-23, at 4:17 AM, smith jack wrote:
>
> > > i mean not use django for web site development, but for desktop
> > application,
> > > it seems its orm can be used in destop application, isn't it?
>
> > Yes.
> > --
> >  Andy McKay
> >  a...@clearwind.ca
> >  twitter: @andymckay
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Re: Could not connect postgresql database

2011-08-23 Thread Landy Chapman
I reinstalled postgresql after deleting config files.  in
postgresql.conf I changed this line:
#   listen = "localhost"
to read:

   listen = "*"

Also make sure this line is uncommented:
   port = 5432

Then I restarted the server.
/etc/init.d/postgresql restart

One way to see if postgresql is running would be:
   lsof | grep "postgres"


>  createdb conntest
I asked you to create a database because  if the server ISNT running
you would not be able to.

>   psql -d conntest
As another suggested, this will try to use the postgres client.  If
all that worked, I would've asked you to run

  psql  -h 127.0.0.1 -d conntest

Which, in a DEFAULT debian lenny install result in:
   "psql: FATAL:  password authentication failed for user "postgres"

I set a password for postgres:
   su
   passwd postgres

Next I change pg_hba.conf to "trust" for localhost, restarted the
server, and
psql  -h 127.0.0.1 -d conntest

does work.  The last step would be to use my local IP address
psql  -h 192.168.1.211 -d conntest

This would make sure remote machines could connect also.

-- 
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: Could not connect postgresql database

2011-08-23 Thread SSozuer
You're so right, sorry about that.
OS: ubuntu 11.04
Database: postgresql 8.4.8
Django Version: 1.3
All of them are running on same machine.

I install the current postgresql database version from source code. I
think i missed something related to enviroment variables.

I think, i just need to "PATH=/usr/local/pgsql/bin:$PATH"  statement
to  affects all users.
So there is only one question right now
How can i add that statement my shell start-up file to affects all
users?

thanks
Selcuk


On Aug 23, 10:20 pm, Landy Chapman  wrote:
> Ignore my long-winded rant/reply above.
>
> the command should be
>
> psql -d test2db
>
> Cheers

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



Uniform database interaction API using django ORM

2011-08-23 Thread venky
Hi,

I have a requirement to constantly update data in my database tables
(after the final schema has been designed) based on some external data
source. I have written scripts to auto populate them (create/modify/
delete entries). I have been using a crude method for database
interactions and I am presently in the process of standardizing it.
Can you please help with some ideas?

This is one of the scenario

I get list of current users from an external source, add new users,
modify few attributes of current users (if changed), remove/deactivate
those entries who are not present in source. I do a similar activity
for 8 more tables.


Current Procedure I follow

- loop over all entries in the source
- verify if the entry is present in database with all its attributes
same as in source
- update and create entries as required from above result
- In parallel get a list of all entries which are in database and not
in source remove them.

I use django ORM. I have hard coded Model classes names with their
arguments in the populating scripts which does seem bad.

Standardization

As part of standardizing, I have decided to set up a uniform database
interactions (starting with insertions)  for any model with any number
of  arguments where I should not hardcode model name and arguments in
the script.

One simple way of doing this would be as follows  (though not it does
not work for deleting the entries)

- Write scripts to build dictionaries in the standard format which can
then be deserialzed using serializers.deserialize.
- While saving the deserialized objects a new entry will be created if
the entry does not exist.
- using natural keys is helpful for updating entries (without querying
for pk value)

- I am still exploring about deleting stale entries in database

Can some one quickly  help me with better ideas or pointers for my
purpose?

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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman
Ignore my long-winded rant/reply above.

the command should be

psql -d test2db


Cheers

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



why can't I access a dictionary with an initial form field value from my django template?

2011-08-23 Thread Tony Schmidt
I thought this should be the proper syntax in my template:

{{ MYDICT.myform.somefield.value }}

But I get a "can't parse remainder error."

Just putting {{ myform.somefield.value }} gives me "3" and {{ MYDICT.
3 }} gives me the dictionary value I want.

Am I missing something?

-- 
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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman

> there are lots of questions about this problem on net , but there is
> no point solution

There's no FixItNow(tm) text that works for all use cases.   Sometimes
over-familiarity will cause  maddening (though simple-to-fix)
problems.  My basic point is, since nothing you did solved the
problem, help us be systematic.  We need to examine things step by
step.  So please do what we ask and post the results.  I'm not talking
down to you; this is basic troubleshooting.  I don't even know what OS
you are running. (Linux, I presume?)

Your already posted pg_hba.conf file looks fine.
If you want help you must provide ALL information we ask for, or we'll
be shooting in the dark.
Are you running linux?  What distro?
Are django, postgresql and pgadmin all running on the same machine?

Answer the above, and post your postgresql.conf file.  Then I/we can
be more specific in narrowing down 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.



Re: Could not connect postgresql database

2011-08-23 Thread bikkit
Also, might be worth looking at the steps of this:

Installing PostgreSQL on Ubuntu 11.04 using PPA: http://bit.ly/mTZcp4 

Maybe you'll see something in the steps that will help you?


Sent from my BlackBerry® from Vodafone

-Original Message-
From: SSozuer 
Sender: django-users@googlegroups.com
Date: Tue, 23 Aug 2011 12:06:06 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Could not connect postgresql database

Guys,
When i command ;
postgres@laptop:~$ /usr/local/pgsql/bin/createdb test2db

there is no problem and ".s.PGSQL.5432" file appeared in tmp directory
which is ok according my postgresql.conf settings.But when i command;

postgres@laptop:~$ psql test2db
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
5432"?

and also when i tried to connect to database with django same error
above occured.
I think, there is a problem related to enviroment variables. But i
dont know how to handle it.

thanks again
Selcuk



On Aug 23, 9:19 pm, SSozuer  wrote:
> nothing changed...
> there are lots of questions about this problem on net , but there is
> no point solution
>
> On Aug 23, 9:09 pm, Subhranath Chunder  wrote:
>
>
>
>
>
>
>
> > Seems to me like it has something to do with pg_hba.conf settings.
>
> > Maybe you can try out by commenting out the existing entries in it, and
> > inserting one specific to your requirement.
> > You should probably try it out. And don't forget to restart the db server
> > everytime you make a change.
>
> > On Tue, Aug 23, 2011 at 11:23 PM, SSozuer  wrote:
> > > i am taking error below:
>
> > > psql: could not connect to server: No such file or directory
> > >         Is the server running locally and accepting
> > >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > > 5432"?
>
> > > but there is no such a .s.PGSQL.5432 file. I really dont understand
> > > what is going on
>
> > > Selcuk
>
> > > On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> > > > You may try to test the connection using the command line interface
> > > 'psql'.
>
> > > > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer 
> > > wrote:
> > > > > Settings in postgresql.conf are ok. And also postgresql is running
> > > > > without no problem. As i said, i can connect database with pgAdmin
> > > > > with no error.
> > > > > Selcuk
>
> > > > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > > > Also did the the server actually start?  On debian,
> > > > > >   /etc/init.d/postgresql start
>
> > > > > > > > > Try connecting on the local system. I would guess you can't. 
> > > > > > > > > It
> > > > > looks
> > > > > > > > > like you have a problem with the socket directory. 
> > > > > > > > > Permissions?
>
> > > > > > > remember to edit postgresql.conf -- make sure to change
> > > > > > >  listen_addresses = '*'
> > > > > > >  port = 5432
>
> > > > > --
> > > > > 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.
>
> > > > --
> > > > Thanks,
> > > > Subhranath Chunder.www.subhranath.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.
>
> > --
> > Thanks,
> > Subhranath Chunder.www.subhranath.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.

-- 
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: Could not connect postgresql database

2011-08-23 Thread bikkit
I might be completely stating the obvious, or something mentioned already, but 
ok, you create the database, but is the deamon running..?

Sent from my BlackBerry® from Vodafone

-Original Message-
From: SSozuer 
Sender: django-users@googlegroups.com
Date: Tue, 23 Aug 2011 12:06:06 
To: Django users
Reply-To: django-users@googlegroups.com
Subject: Re: Could not connect postgresql database

Guys,
When i command ;
postgres@laptop:~$ /usr/local/pgsql/bin/createdb test2db

there is no problem and ".s.PGSQL.5432" file appeared in tmp directory
which is ok according my postgresql.conf settings.But when i command;

postgres@laptop:~$ psql test2db
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
5432"?

and also when i tried to connect to database with django same error
above occured.
I think, there is a problem related to enviroment variables. But i
dont know how to handle it.

thanks again
Selcuk



On Aug 23, 9:19 pm, SSozuer  wrote:
> nothing changed...
> there are lots of questions about this problem on net , but there is
> no point solution
>
> On Aug 23, 9:09 pm, Subhranath Chunder  wrote:
>
>
>
>
>
>
>
> > Seems to me like it has something to do with pg_hba.conf settings.
>
> > Maybe you can try out by commenting out the existing entries in it, and
> > inserting one specific to your requirement.
> > You should probably try it out. And don't forget to restart the db server
> > everytime you make a change.
>
> > On Tue, Aug 23, 2011 at 11:23 PM, SSozuer  wrote:
> > > i am taking error below:
>
> > > psql: could not connect to server: No such file or directory
> > >         Is the server running locally and accepting
> > >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > > 5432"?
>
> > > but there is no such a .s.PGSQL.5432 file. I really dont understand
> > > what is going on
>
> > > Selcuk
>
> > > On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> > > > You may try to test the connection using the command line interface
> > > 'psql'.
>
> > > > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer 
> > > wrote:
> > > > > Settings in postgresql.conf are ok. And also postgresql is running
> > > > > without no problem. As i said, i can connect database with pgAdmin
> > > > > with no error.
> > > > > Selcuk
>
> > > > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > > > Also did the the server actually start?  On debian,
> > > > > >   /etc/init.d/postgresql start
>
> > > > > > > > > Try connecting on the local system. I would guess you can't. 
> > > > > > > > > It
> > > > > looks
> > > > > > > > > like you have a problem with the socket directory. 
> > > > > > > > > Permissions?
>
> > > > > > > remember to edit postgresql.conf -- make sure to change
> > > > > > >  listen_addresses = '*'
> > > > > > >  port = 5432
>
> > > > > --
> > > > > 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.
>
> > > > --
> > > > Thanks,
> > > > Subhranath Chunder.www.subhranath.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.
>
> > --
> > Thanks,
> > Subhranath Chunder.www.subhranath.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.

-- 
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: Could not connect postgresql database

2011-08-23 Thread SSozuer
Guys,
When i command ;
postgres@laptop:~$ /usr/local/pgsql/bin/createdb test2db

there is no problem and ".s.PGSQL.5432" file appeared in tmp directory
which is ok according my postgresql.conf settings.But when i command;

postgres@laptop:~$ psql test2db
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
5432"?

and also when i tried to connect to database with django same error
above occured.
I think, there is a problem related to enviroment variables. But i
dont know how to handle it.

thanks again
Selcuk



On Aug 23, 9:19 pm, SSozuer  wrote:
> nothing changed...
> there are lots of questions about this problem on net , but there is
> no point solution
>
> On Aug 23, 9:09 pm, Subhranath Chunder  wrote:
>
>
>
>
>
>
>
> > Seems to me like it has something to do with pg_hba.conf settings.
>
> > Maybe you can try out by commenting out the existing entries in it, and
> > inserting one specific to your requirement.
> > You should probably try it out. And don't forget to restart the db server
> > everytime you make a change.
>
> > On Tue, Aug 23, 2011 at 11:23 PM, SSozuer  wrote:
> > > i am taking error below:
>
> > > psql: could not connect to server: No such file or directory
> > >         Is the server running locally and accepting
> > >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > > 5432"?
>
> > > but there is no such a .s.PGSQL.5432 file. I really dont understand
> > > what is going on
>
> > > Selcuk
>
> > > On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> > > > You may try to test the connection using the command line interface
> > > 'psql'.
>
> > > > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer 
> > > wrote:
> > > > > Settings in postgresql.conf are ok. And also postgresql is running
> > > > > without no problem. As i said, i can connect database with pgAdmin
> > > > > with no error.
> > > > > Selcuk
>
> > > > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > > > Also did the the server actually start?  On debian,
> > > > > >   /etc/init.d/postgresql start
>
> > > > > > > > > Try connecting on the local system. I would guess you can't. 
> > > > > > > > > It
> > > > > looks
> > > > > > > > > like you have a problem with the socket directory. 
> > > > > > > > > Permissions?
>
> > > > > > > remember to edit postgresql.conf -- make sure to change
> > > > > > >  listen_addresses = '*'
> > > > > > >  port = 5432
>
> > > > > --
> > > > > 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.
>
> > > > --
> > > > Thanks,
> > > > Subhranath Chunder.www.subhranath.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.
>
> > --
> > Thanks,
> > Subhranath Chunder.www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread SSozuer
nothing changed...
there are lots of questions about this problem on net , but there is
no point solution

On Aug 23, 9:09 pm, Subhranath Chunder  wrote:
> Seems to me like it has something to do with pg_hba.conf settings.
>
> Maybe you can try out by commenting out the existing entries in it, and
> inserting one specific to your requirement.
> You should probably try it out. And don't forget to restart the db server
> everytime you make a change.
>
>
>
>
>
>
>
>
>
> On Tue, Aug 23, 2011 at 11:23 PM, SSozuer  wrote:
> > i am taking error below:
>
> > psql: could not connect to server: No such file or directory
> >         Is the server running locally and accepting
> >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > 5432"?
>
> > but there is no such a .s.PGSQL.5432 file. I really dont understand
> > what is going on
>
> > Selcuk
>
> > On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> > > You may try to test the connection using the command line interface
> > 'psql'.
>
> > > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer 
> > wrote:
> > > > Settings in postgresql.conf are ok. And also postgresql is running
> > > > without no problem. As i said, i can connect database with pgAdmin
> > > > with no error.
> > > > Selcuk
>
> > > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > > Also did the the server actually start?  On debian,
> > > > >   /etc/init.d/postgresql start
>
> > > > > > > > Try connecting on the local system. I would guess you can't. It
> > > > looks
> > > > > > > > like you have a problem with the socket directory. Permissions?
>
> > > > > > remember to edit postgresql.conf -- make sure to change
> > > > > >  listen_addresses = '*'
> > > > > >  port = 5432
>
> > > > --
> > > > 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.
>
> > > --
> > > Thanks,
> > > Subhranath Chunder.www.subhranath.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.
>
> --
> Thanks,
> Subhranath Chunder.www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman
I apologize.. What user are you running psql as?  Try this:
  cd /tmp
 su postgres
 createdb conntest
 psql -d conntest


That should since you can connect from pgadmin.  If it doesn't. run
(as root)
   /etc/init.d/postgresql force-restart

and try the above again.

On the django side, I would check settings.py for something like this:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add
'postgr...
'NAME': 'conntest',  # Or path to database
file if using sqlite3.
'USER': 'postgres',  # Not used with
sqlite3.
'PASSWORD': 'mypgpass',  # Not used with
sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT':'5432',  # Set to empty string for
default. Not used with sqlite3.
}
}


On Aug 23, 1:53 pm, SSozuer  wrote:
> i am taking error below:
>
> psql: could not connect to server: No such file or directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> 5432"?
>
> but there is no such a .s.PGSQL.5432 file. I really dont understand
> what is going on
>
> Selcuk
>
> On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
>
>
>
> > You may try to test the connection using the command line interface 'psql'.
>
> > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer  wrote:
> > > Settings in postgresql.conf are ok. And also postgresql is running
> > > without no problem. As i said, i can connect database with pgAdmin
> > > with no error.
> > > Selcuk
>
> > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > Also did the the server actually start?  On debian,
> > > >   /etc/init.d/postgresql start
>
> > > > > > > Try connecting on the local system. I would guess you can't. It
> > > looks
> > > > > > > like you have a problem with the socket directory. Permissions?
>
> > > > > remember to edit postgresql.conf -- make sure to change
> > > > >  listen_addresses = '*'
> > > > >  port = 5432
>
> > > --
> > > 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.
>
> > --
> > Thanks,
> > Subhranath Chunder.www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread Subhranath Chunder
Seems to me like it has something to do with pg_hba.conf settings.

Maybe you can try out by commenting out the existing entries in it, and
inserting one specific to your requirement.
You should probably try it out. And don't forget to restart the db server
everytime you make a change.


On Tue, Aug 23, 2011 at 11:23 PM, SSozuer  wrote:

> i am taking error below:
>
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
>connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> 5432"?
>
> but there is no such a .s.PGSQL.5432 file. I really dont understand
> what is going on
>
> Selcuk
>
> On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> > You may try to test the connection using the command line interface
> 'psql'.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Aug 23, 2011 at 10:39 PM, SSozuer 
> wrote:
> > > Settings in postgresql.conf are ok. And also postgresql is running
> > > without no problem. As i said, i can connect database with pgAdmin
> > > with no error.
> > > Selcuk
> >
> > > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > > Also did the the server actually start?  On debian,
> > > >   /etc/init.d/postgresql start
> >
> > > > > > > Try connecting on the local system. I would guess you can't. It
> > > looks
> > > > > > > like you have a problem with the socket directory. Permissions?
> >
> > > > > remember to edit postgresql.conf -- make sure to change
> > > > >  listen_addresses = '*'
> > > > >  port = 5432
> >
> > > --
> > > 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.
> >
> > --
> > Thanks,
> > Subhranath Chunder.www.subhranath.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.
>
>


-- 
Thanks,
Subhranath Chunder.
www.subhranath.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: Django Development environment

2011-08-23 Thread Mike Seidle
On Monday, August 22, 2011 06:07:24 PM Stephen Jackson wrote:
> I am new to the world of Django. I would like to hear from other django
> developers describe their dev environment (tools, os, editors, etc.).

Dev: Kubuntu (Natty), Emacs (sometimes Aptana), git, Cherokee (web server), 
MySQL

Production: Debian Lenny, Cherokee or Apache, MySQL

Couldn't survive without South :)

-- 
Mike Seidle

-- 
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: Could not connect postgresql database

2011-08-23 Thread SSozuer
i am taking error below:

psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
5432"?

but there is no such a .s.PGSQL.5432 file. I really dont understand
what is going on

Selcuk

On Aug 23, 8:12 pm, Subhranath Chunder  wrote:
> You may try to test the connection using the command line interface 'psql'.
>
>
>
>
>
>
>
>
>
> On Tue, Aug 23, 2011 at 10:39 PM, SSozuer  wrote:
> > Settings in postgresql.conf are ok. And also postgresql is running
> > without no problem. As i said, i can connect database with pgAdmin
> > with no error.
> > Selcuk
>
> > On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > > Also did the the server actually start?  On debian,
> > >   /etc/init.d/postgresql start
>
> > > > > > Try connecting on the local system. I would guess you can't. It
> > looks
> > > > > > like you have a problem with the socket directory. Permissions?
>
> > > > remember to edit postgresql.conf -- make sure to change
> > > >  listen_addresses = '*'
> > > >  port = 5432
>
> > --
> > 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.
>
> --
> Thanks,
> Subhranath Chunder.www.subhranath.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: can django be used in destop application?

2011-08-23 Thread Cal Leeming [Simplicity Media Ltd]
Curious concept, using Django for a desktop application.

Can't think of any reason why you couldn't at least try it :)

Cal

On Tue, Aug 23, 2011 at 3:49 PM, Andy McKay  wrote:

>
> On 2011-08-23, at 4:17 AM, smith jack wrote:
>
> > i mean not use django for web site development, but for desktop
> application,
> > it seems its orm can be used in destop application, isn't it?
>
> Yes.
> --
>  Andy McKay
>  a...@clearwind.ca
>  twitter: @andymckay
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Custom Validation on Inline Generic Foreign Key

2011-08-23 Thread John
Hi there,

I am writing an app with Django where I have a model with a generic
foreign key. I
am looking to do some validation on this model based on the
content_type of the
generic foreign key. When I am modifying this model on its admin page,
I am
able to easily determine the content_type because it is in the form
data. Then I
can do a 'switch' on the content type to perform the correct
validations.

When I use the Model with the generic foreign key inline in another
model, I
can't seem to find the content_type or content_id in the form data. I
would expect
there is a way to get that models content_type from within the inline
model's form.

So am I missing something here, or is there a better way to approach
this problem?

Thanks is advance.

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



Re: dynamic field display

2011-08-23 Thread Subhranath Chunder
Manipulating the form instance attributes at runtime in your view might be
possible by modifying some internal fields, but that leads to dirty code and
not-so-clean views.

You can rather use different django forms with different field definitions
in your view. This might be the cleanest.

You can also consider creating some generator function which can return you
a django form class on the fly, depending upon the form definition
parameters provided to the generator function during runtime. Obviously you
need to be careful with this, and consider the cons coming with it.


On Tue, Aug 23, 2011 at 12:01 AM, Axel Bock
wrote:

> Hi group,
>
> I have another question about Django forms. I designed a Form for a Model,
> but now I want to remove fields depending on some user settings.
> Can I do that?
>
> Lets assume the following:
>
> class MyModel(models.Model):
>field1 = TextField(null=True, blank=True)
>field2 = Textfield(null=True, blank=True)
>
> class MyModelform(forms.Form):
>field1 = TextField()
>fiels2 = TextField()
>
> def viewform(request):
># some magic here :)
>return render_to_response(context_instance=RequestContext(request,
> {'form':MyModelForm()}))
>
> Now I want to disable field2 in the form on display, depending on the user
> settings. Any suggestions?
>
> Greetings & thanks,
> Axel.
>
> --
> 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.
>
>


-- 
Thanks,
Subhranath Chunder.
www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread Subhranath Chunder
You may try to test the connection using the command line interface 'psql'.


On Tue, Aug 23, 2011 at 10:39 PM, SSozuer  wrote:

> Settings in postgresql.conf are ok. And also postgresql is running
> without no problem. As i said, i can connect database with pgAdmin
> with no error.
> Selcuk
>
> On Aug 23, 8:03 pm, Landy Chapman  wrote:
> > Also did the the server actually start?  On debian,
> >   /etc/init.d/postgresql start
> >
> >
> >
> >
> >
> >
> >
> > > > > Try connecting on the local system. I would guess you can't. It
> looks
> > > > > like you have a problem with the socket directory. Permissions?
> >
> > > remember to edit postgresql.conf -- make sure to change
> > >  listen_addresses = '*'
> > >  port = 5432
>
> --
> 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.
>
>


-- 
Thanks,
Subhranath Chunder.
www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread SSozuer
Settings in postgresql.conf are ok. And also postgresql is running
without no problem. As i said, i can connect database with pgAdmin
with no error.
Selcuk

On Aug 23, 8:03 pm, Landy Chapman  wrote:
> Also did the the server actually start?  On debian,
>   /etc/init.d/postgresql start
>
>
>
>
>
>
>
> > > > Try connecting on the local system. I would guess you can't. It looks
> > > > like you have a problem with the socket directory. Permissions?
>
> > remember to edit postgresql.conf -- make sure to change
> >  listen_addresses = '*'
> >  port = 5432

-- 
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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman
Also did the the server actually start?  On debian,
  /etc/init.d/postgresql start


> > > Try connecting on the local system. I would guess you can't. It looks
> > > like you have a problem with the socket directory. Permissions?
>
> remember to edit postgresql.conf -- make sure to change
>  listen_addresses = '*'
>  port = 5432

-- 
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: can django be used in destop application?

2011-08-23 Thread Subhranath Chunder
If ORM is what you are looking for, then you could try SQLAlchemy.


On Tue, Aug 23, 2011 at 4:47 PM, smith jack  wrote:

> i mean not use django for web site development, but for desktop
> application,
> it seems its orm can be used in destop application, isn't it?
>
> --
> 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.
>
>


-- 
Thanks,
Subhranath Chunder.
www.subhranath.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: Could not connect postgresql database

2011-08-23 Thread Landy Chapman

> > On Tue, Aug 23, 2011 at 2:05 PM, SSozuer  wrote:
> > >        Is the server running locally and accepting
> > >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > > 5432"?
>
> > Try connecting on the local system. I would guess you can't. It looks
> > like you have a problem with the socket directory. Permissions?

remember to edit postgresql.conf -- make sure to change
 listen_addresses = '*'
 port = 5432

-- 
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: extending the User profile - which way to go?

2011-08-23 Thread Tom Evans
On Sun, Aug 21, 2011 at 2:52 PM, Matt Schinckel  wrote:
> You haven't really provided a reason why to 'do it the django way', rather
> than inheriting from User.

Here is the top one: Extending the user object will make your project
incompatible with 3rd party pluggable apps, as they will not be using
your inherited User model, they will be using
django.contrib.auth.models.User.

UserProfiles, however you implement them, are cumbersome and unwieldy,
but for interop reasons they remain the best way of extending the user
model. Using a separate profile for each app is also wise, since it
separates logically unrelated data.

There is also very little reason to define
settings.AUTH_PROFILE_MODULE apart from making user.get_profile()
work, and if you use a one-to-one field, the difference is then
user.get_profile() // user.myapp_profile .

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: Could not connect postgresql database

2011-08-23 Thread SSozuer
l checked the /var/run/postgresql/... directory. But there is no
directory called that. I'll reinstall postgresql from package, the
current was installed from source code
thanks for advice

Selcuk

On Aug 23, 6:06 pm, Simon Riggs  wrote:
> On Tue, Aug 23, 2011 at 2:05 PM, SSozuer  wrote:
> >        Is the server running locally and accepting
> >        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> > 5432"?
>
> Try connecting on the local system. I would guess you can't. It looks
> like you have a problem with the socket directory. Permissions?
>
> > Here is my pg_hba.conf file  settings:
>
> That looks correct.
>
> --
>  Simon Riggs  http://www.2ndQuadrant.com/
>  PostgreSQL Development, 24x7 Support, Training & Services

-- 
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: Model caching per python session

2011-08-23 Thread Tom Evans
On Tue, Aug 23, 2011 at 3:15 PM, Julian Hodgson
 wrote:
> FYI: this does the trick:
>
> from django.db import connection
> connection.close()
>

This should work better:

from django.db import transaction

transaction.enter_transaction_management()
transaction.managed(True)
# do some work
transaction.commit()
# do some more work
transaction.commit()

transaction.leave_transaction_management()
transaction.managed(False)
# exit

As documented here:

https://docs.djangoproject.com/en/1.3/topics/db/transactions/

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: Could not connect postgresql database

2011-08-23 Thread Simon Riggs
On Tue, Aug 23, 2011 at 2:05 PM, SSozuer  wrote:

>        Is the server running locally and accepting
>        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> 5432"?

Try connecting on the local system. I would guess you can't. It looks
like you have a problem with the socket directory. Permissions?

> Here is my pg_hba.conf file  settings:

That looks correct.

-- 
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
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 highlighting for template files and file suffix

2011-08-23 Thread Tom Evans
On Tue, Aug 23, 2011 at 12:09 PM, Gelonida N  wrote:
> Hi,
>
> I'm rather new to Django and just start working with a little more with
> templates.
>
> I wondered how to make a distinction between html files and html templates.
>
> Shall I used different suffixes or is the directory location enough.
>
> If I don't have different file suffixes, how do you teach your editor,
> when editing an html file and when editing a template file.
>
>
> I am using vim
>
> Are there any 'best practices'?
>

I tell vim (in ~/.vimrc) to assume that files named */templates/*.html
are django templates:

au BufRead */templates/*.html set ft=htmldjango sw=2 ts=2

This is good enough for me, you may want to adjust the pattern if you
often edit html files within a directory named templates that are not
django templates.

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: can django be used in destop application?

2011-08-23 Thread Yaşar Arabacı
I had written something about this earlier, Although the article is in
Turkish, you can still understand the django part I guess. It demonstrates
how to use django component with other applications, by creating a dummy
package manager.
http://yasar.serveblog.net/post/djangoda-paket-yoneticisi-yapalm/

2011/8/23 Andy McKay 

>
> On 2011-08-23, at 4:17 AM, smith jack wrote:
>
> > i mean not use django for web site development, but for desktop
> application,
> > it seems its orm can be used in destop application, isn't it?
>
> Yes.
> --
>  Andy McKay
>  a...@clearwind.ca
>  twitter: @andymckay
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
http://yasar.serveblog.net/

-- 
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: can django be used in destop application?

2011-08-23 Thread Andy McKay

On 2011-08-23, at 4:17 AM, smith jack wrote:

> i mean not use django for web site development, but for desktop application,
> it seems its orm can be used in destop application, isn't it?

Yes.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Re: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-23 Thread Andy McKay

On 2011-08-23, at 1:08 AM, Leon van der Ree wrote:
> that explains why I experience this issue. However doesn't it suppose
> to work like this; Why should a safe string become unsafe again after
> deserialisation? I understand this is a current limitation of the
> serialisation process, but this is not exactly what you would expect,
> is it. So in my eyes this is still a bug.

Nothing advertises it would work this way, so its a feature request.

> Are there any known workarounds?

You could store more than a string in the message I bet, for example 
{'msg':'hello', 'safe':True} and then cope with it when you deserialize.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

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



Re: Problem updating data

2011-08-23 Thread Shawn Milochik
The main issue is that your queryset entries wasn't refreshed from the 
database. Do your queryset again and you'll see one fewer.


Also, instead of zero you should use False when querying a boolean field.

Shawn


--
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: Model caching per python session

2011-08-23 Thread Julian Hodgson
FYI: this does the trick:

from django.db import connection
connection.close()



On Tue, Aug 23, 2011 at 12:29 AM, Julian Hodgson <
julian.of.lon...@googlemail.com> wrote:

> Ok, that makes sense.
>
> The thing is, we've written some python plugins for Softimage to read and
> write to the db that get loaded and stay in memory.   When the plugins are
> loaded, the django models are imported.  So during the lifetime of the host
> application, the python session is the same.
>
> So I really need a way of closing the transaction or flushing the sql in
> django,  without starting a new python session.
>
> Any ideas warmly received.
>
> Julian.
> On Aug 22, 2011 8:30 PM, "Daniel Roseman"  wrote:
> > On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote:
> >>
> >> Hi there,
> >>
> >> I'm running a production linux django server using wsgi, and have found
> the
> >> following issue. Django version (1, 2, 5, 'final', 0).
> >>
> >> If I open a python shell I get:
> >>
> >> >>> from passion.cg.models import *
> >> >>> print Sequence.objects.all()
> >> [, , , ]
> >>
> >>
> >> But if I go into the admin and delete sequence DD, leaving the python
> >> session running, then I still get
> >>
> >> >>> print Sequence.objects.all()
> >> [, , , ]
> >>
> >> so the Sequence table doesn't appear to be updated as far as the model
> is
> >> concerned.
> >>
> >> It's pretty fundamental that this can be resolved since many different
> >> users will be using the database at the same time, and it should be
> possible
> >> for each user to see the latest state of the DB.
> >>
> >> Any suggestions welcomed.
> >>
> >> Cheers,
> >>
> >> Julian
> >>
> >
> > This isn't anything to do with caching. It's a result of the fact that
> the
> > shell session is running within a single transaction, and therefore
> doesn't
> > see changes from outside that. If you quit the shell and restart it,
> you'll
> > be able to see the change.
> >
> > This isn't a problem in production, because transactions in views are
> tied
> > to the request/response cycle, which is short-lived.
> > --
> > 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/-/qX11CSPon3MJ.
> > 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: 2 url template tag questions

2011-08-23 Thread Tom Evans
2011/8/23 Yaşar Arabacı :
> Hi,
> If a use url template tag on a generic view, does urls.py supply required
> arguments? For example:
> urlpatterns = patterns('django.views.generic.date_based',
>     (r'^arsiv/(?P\d{4})/$','archive_year',{
>             'template_name' : 'blog/yillar.html',
>             'date_field' : 'pub_date',
>             'queryset' : Post.objects.filter(yayinlandi=True),
>             'extra_context' : common_data,
>             'make_object_list' : True,
>             'template_object_name' : 'makale'
>     }),
> )
> Can I access this url with {% url
> django.views.generic.date_based.archive_index asdfasdf.year %}

No, that information is associated with the URL, not the view that
serves the URL. If you gave the URL a name in urls.py, then you could
use that name to refer to the view + attached extra info.

> And also, I am using rss framework like this:
> from feeds import LatestPosts, TagFeed
> urlpatterns += patterns('',
> (r'^rss/$', LatestPosts()),
> (r'^tag/(?P[^/]+)/rss/$', TagFeed()),
> )
> Can I access this via url template tag?

If you give them names. To give them names, either define a 4-tuple of
(regular expression, view function, optional dictionary, optional
name), or use the url() shortcut and pass name as a keyword argument.
See:

https://docs.djangoproject.com/en/1.3/topics/http/urls/#patterns

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.



Custom attributes of Form Fields

2011-08-23 Thread vpetkov
Hi,

  I have run into a problem that doesn't seem to have a trivial
solution in Django:  I would like to have a form field that contains
parts of the html output so that it is not rendered directly by
Widget.render(), but in the template itself.

On a more concrete basis, let there be a forms.Form  with a
MultipleChoiceField form field whose widget produces a collection of
checkboxes. I could simply override the CheckboxSelectMultiple's
render() function in order to group them in various ways, but I am
aiming for a more flexible approach. Suppose that I have already
overridden the render() function so that it produces a dictionary
containing the html code for each checkbox separately. What I would
like to have in the template is:

{{ form.tueren.A}}
{{ form.tueren.B }},
etc.

Now, adding attributes/methods to the MultipleChoiceField instance is
easy, but since what the template sees is a BoundField() instance, I
have no way to access my additional attributes. Did anybody encounter
this problem already and how can it be solved in an elegant way?

Best regards,
Venelin Petkov





-- 
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 testing with existing data

2011-08-23 Thread Carlos Brum
Hello guys,

I'm new in Django testing whith django test facilities.

I've read "https://docs.djangoproject.com/en/1.3/topics/testing/; but
couldn't find what i'm looking for.

I'm trying to begin TDD development but wanna use my old data. I don't
wanna have to build up all my database again. I already have data
there.

Is it possible!?

I know that by default the django test facilities create a brand new
database.
Is there a possibility of using old database?

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 Development environment

2011-08-23 Thread Pavlo Kapyshin
Xmonad, emacs, vim, git, darcs, nginx, supervisord, misultin, mochiweb,
haskell, bash, zsh, httperf, rabbitmq, zeromq. Things I use for
Django-specific development: ipdb, rdb, ipython, private forks of
third-party Django apps, virtualenv and pip.

I don’t use automatic database migration tools, on-the-fly syntax checkers,
debug toolbars, IDEs, MySQL, Mnesia, Apache and GPL License.


---
++[>++[>++[>++[>++<-]<-]<-]<-]<+++
[>++<-]>+.<+++[>+<
-]>.<+++[>---<-]>.<+[>-<-]>-.<+[>+<-]>+.<+
+[>++<-]>+.<+++[><-]>-.<+[>++<-]>+
.<+++[><-]>.<+++[>
+<-]>.<+++[><-]>.<+[>-
-<-]>-.<++[>++<-]>+.<++[>++<-]>+.<+++[>--<
-]>-.

-- 
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: Could not connect postgresql database

2011-08-23 Thread SSozuer
In addition i can connect database with pgAdmin III without any
error...

On Aug 23, 4:05 pm, SSozuer  wrote:
> Hi guys,
> When i was checking the database connection,i am taking that error:
>
>  File "", line 1, in 
>   File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
> __init__.py", line 250, in cursor
>     cursor = self.make_debug_cursor(self._cursor())
>   File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
> postgresql_psycopg2/base.py", line 140, in _cursor
>     self.connection = Database.connect(**conn_params)
> OperationalError: could not connect to server: No such file or
> directory
>         Is the server running locally and accepting
>         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
> 5432"?
>
> Here is my pg_hba.conf file  settings:
>
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
>
> # "local" is for Unix domain socket connections only
> local   all       postgres                             trust
> # IPv4 local connections:
> host    all       postgres        127.0.0.1/32          trust
> # IPv6 local connections:
> host    all         all         ::1/128               trust
>
> any help would be great, thanks
> Selcuk

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



Re: Django Development environment

2011-08-23 Thread Thorsten Sanders

IDE:
PyCharm (its for python with django support,not free but love it and not 
to expensive)


Database:
mysql/postgresql

Standard apps:
south (really a must have to apply database changes easy)
debug_toolbar

Am 23.08.2011 14:47, schrieb Yas,ar Arabac?:

Development setup (when on my own comp.):
arch linux, vim or leafpad, sqlite, django development server

Development setup (when on my brothers comp):
cygwin, notepad++, sqlite, django development server (both inside and 
outside of cygwin to make sure everything is same.)


Deployment:
ubuntu (cloud), nginx with uwsgi, supervisord, postgresql, south

MUST HAVES (on all platforms): git!

2011/8/23 Raul Alejandro Ascencio Trejo >


Emacs (https://code.djangoproject.com/wiki/Emacs), Postgre... :|


2011/8/22 Mario Gudelj >

Mac, sqlite, Eclipse with Pydev or AquaMacs, apache


On 23 August 2011 13:06, Jani Tiainen > wrote:

Ubuntu or windows, eclipse with pydev, apache, nginx,
virtualenv and Oracle.

Stephen Jackson > kirjoitti 23.8.2011
kello 1.07:


I am new to the world of Django. I would like to hear
from other django developers describe their dev
environment (tools, os, editors, etc.).
-- 
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/-/Fq-jCVxrK7AJ.

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.




-- 
r-ascencio 




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




--
http://yasar.serveblog.net/

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



Could not connect postgresql database

2011-08-23 Thread SSozuer
Hi guys,
When i was checking the database connection,i am taking that error:

 File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/
postgresql_psycopg2/base.py", line 140, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: could not connect to server: No such file or
directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.
5432"?

Here is my pg_hba.conf file  settings:

# TYPE  DATABASEUSERCIDR-ADDRESS  METHOD

# "local" is for Unix domain socket connections only
local   all   postgres trust
# IPv4 local connections:
hostall   postgres127.0.0.1/32  trust
# IPv6 local connections:
hostall all ::1/128   trust

any help would be great, thanks
Selcuk

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



Re: Django Development environment

2011-08-23 Thread Yaşar Arabacı
Development setup (when on my own comp.):
arch linux, vim or leafpad, sqlite, django development server

Development setup (when on my brothers comp):
cygwin, notepad++, sqlite, django development server (both inside and
outside of cygwin to make sure everything is same.)

Deployment:
ubuntu (cloud), nginx with uwsgi, supervisord, postgresql, south

MUST HAVES (on all platforms): git!

2011/8/23 Raul Alejandro Ascencio Trejo 

> Emacs (https://code.djangoproject.com/wiki/Emacs), Postgre... :|
>
>
> 2011/8/22 Mario Gudelj 
>
>> Mac, sqlite, Eclipse with Pydev or AquaMacs, apache
>>
>>
>> On 23 August 2011 13:06, Jani Tiainen  wrote:
>>
>>> Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and
>>> Oracle.
>>>
>>> Stephen Jackson  kirjoitti 23.8.2011 kello
>>> 1.07:
>>>
>>> I am new to the world of Django. I would like to hear from other django
>>> developers describe their dev environment (tools, os, editors, etc.).
>>>
>>> --
>>> 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/-/Fq-jCVxrK7AJ.
>>>
>>> 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.
>>
>
>
>
> --
> r-ascencio 
>
>
>
>  --
> 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.
>



-- 
http://yasar.serveblog.net/

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



Re: Django Development environment

2011-08-23 Thread Andre Terra
Aptana (aka Eclipse/Pydev) for no reason other than hyperlinks in the code

Vim/Notepad++ on occasion
virtualenv, git, pip, ack (grep on steroids)
nginx (proudly compiled from source with custom modules!)

ubuntu 10.04 (will only upgrade to LTS releases) or windows xp. All of
these tools are multiplatform! In addition I'd have to recommend
virtualenv wrapper for those of you running linux

In django:
django-cache-utils
django-form-utils
celery
redis
django-debug-toolbar
django-filter by Alex Gaynor (a must have)


Cheers,
AT

On 8/23/11, Raul Alejandro Ascencio Trejo  wrote:
> Emacs (https://code.djangoproject.com/wiki/Emacs), Postgre... :|
>
> 2011/8/22 Mario Gudelj 
>
>> Mac, sqlite, Eclipse with Pydev or AquaMacs, apache
>>
>>
>> On 23 August 2011 13:06, Jani Tiainen  wrote:
>>
>>> Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and
>>> Oracle.
>>>
>>> Stephen Jackson  kirjoitti 23.8.2011 kello
>>> 1.07:
>>>
>>> I am new to the world of Django. I would like to hear from other django
>>> developers describe their dev environment (tools, os, editors, etc.).
>>>
>>> --
>>> 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/-/Fq-jCVxrK7AJ.
>>>
>>> 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.
>>
>
>
>
> --
> r-ascencio 
>
> --
> 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.



Re: syntax highlighting for template files and file suffix

2011-08-23 Thread Paul Schewietzek
With vim, you can ':setfiletype htmldjango' for django templates (on Debian
6 at least).

Hope that helps.



2011/8/23 Herman Schistad 

> On Tue, Aug 23, 2011 at 13:09, Gelonida N  wrote:
> > I'm rather new to Django and just start working with a little more with
> > templates.
> >
> > I wondered how to make a distinction between html files and html
> templates.
> >
> > Shall I used different suffixes or is the directory location enough.
> >
> > If I don't have different file suffixes, how do you teach your editor,
> > when editing an html file and when editing a template file.
>
> If say you have all the .html files in your templates/ folder, it
> should all be good. Suffix is .html
>
> Best practice I guess is to create as base.html which defines your
> structure, and say:
> (...)
> 
>{% block content %}{% endblock %}
> 
> (...)
>
> And later in another document you just define the content like this:
> {% extends "base.html" %}
> (...)
> {% block content %}
>Your custom content here.
> {% endblock %}
> (...)
>
> --
> With regards, Herman Schistad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: What is Django?

2011-08-23 Thread Karen Tracey
On Tue, Aug 23, 2011 at 8:01 AM, Julian  wrote:

> Is there any document available that describes WHAT Django is? I am
> not looking for an installation guide, neither for tutorial, nor for
>

[snipped]

Perhaps the overview: https://docs.djangoproject.com/en/1.3/intro/overview/

?

Karen
-- 
http://tracey.org/kmt/

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



What is Django?

2011-08-23 Thread Julian
Is there any document available that describes WHAT Django is? I am
not looking for an installation guide, neither for tutorial, nor for
"Django is a high-level Python Web framework". But: What does this
framework include? What is it used for? How does it increase
productivity? Why shouldn't I use directly Python to create web apps/
pages? How could a sample app look like (without giving source code)?

Such explanations would be extremely helpful and maybe even worth to
be linked into https://www.djangoproject.com/

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



Re: Django Development environment

2011-08-23 Thread Raul Alejandro Ascencio Trejo
Emacs (https://code.djangoproject.com/wiki/Emacs), Postgre... :|

2011/8/22 Mario Gudelj 

> Mac, sqlite, Eclipse with Pydev or AquaMacs, apache
>
>
> On 23 August 2011 13:06, Jani Tiainen  wrote:
>
>> Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and
>> Oracle.
>>
>> Stephen Jackson  kirjoitti 23.8.2011 kello
>> 1.07:
>>
>> I am new to the world of Django. I would like to hear from other django
>> developers describe their dev environment (tools, os, editors, etc.).
>>
>> --
>> 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/-/Fq-jCVxrK7AJ.
>>
>> 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.
>



-- 
r-ascencio 

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



rich text field editor in admin panel with inlines?

2011-08-23 Thread EricSI
Hello all,

First a little background on what is installed:
django
django-cms
django-filer
cmsplugins-filer

I'm working on a project where the admin panel for a 'Product' needs to have 
a rich text editor for several textfields. I have found several examples of 
how to incorporate this but none have been successful so far.  I'm currently 
attempting to use this 
method 
since 
it uses WYMEditor which already comes with django-cms, without success. 
 Specifying the js property in class Meta does not seem to do anything. 
 When I view source on the rendered page, the js files specified are not 
included in the page.  I also added an alert call to editor.js that is not 
being triggered.

A secondary problem that I need to figure out is how to hook up django-filer 
to the rich text field so that the user can insert images from the media 
library, but that has to wait until this problem is solved.  Although if 
anyone has any suggestions on where to look for a solution, I'd love to hear 
it.

Here is how my current code looks.

admin.py:
static = settings.STATIC_URL

class ProductAdmin(admin.ModelAdmin):
inlines = (CategoryAssociationInline, ProductImageAssociationInline, 
ProductIconAssociationInline, RetailerAssociationInline, ProductTabInline, 
ReviewsInline)

class Meta:
js = (static + 'js/jquery/jquery.js', static + 
'js/wymeditor/jquery.wymeditor.js', static + 'js/editor.js')

Editor.js:
// File Name: editor.js
 
$(document).ready(function() {
alert("document ready");
$("#content").wymeditor({ // assuming content is field name with 
TextField.
updateSelector: "input:submit",
updateEvent:"click"
});
});


Several of the inlines need to use the rich textfield editor as well as the 
product description field.  Any help is much appreciated.  This is my first 
Django project so I may be missing some things that are obvious to others. 
 If you need any other info I'd be happy to provide it.

-- 
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/-/h2U2ZcNhkt0J.
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 highlighting for template files and file suffix

2011-08-23 Thread Herman Schistad
On Tue, Aug 23, 2011 at 13:09, Gelonida N  wrote:
> I'm rather new to Django and just start working with a little more with
> templates.
>
> I wondered how to make a distinction between html files and html templates.
>
> Shall I used different suffixes or is the directory location enough.
>
> If I don't have different file suffixes, how do you teach your editor,
> when editing an html file and when editing a template file.

If say you have all the .html files in your templates/ folder, it
should all be good. Suffix is .html

Best practice I guess is to create as base.html which defines your
structure, and say:
(...)

{% block content %}{% endblock %}

(...)

And later in another document you just define the content like this:
{% extends "base.html" %}
(...)
{% block content %}
Your custom content here.
{% endblock %}
(...)

-- 
With regards, Herman Schistad

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



Admin staticfiles stubbornly hiding behind 404s

2011-08-23 Thread Caomhin
I confess, I'm lost!  I've just tried starting my first new site since
upgrading to Django 1.3 and the new staticfiles settings seem to be
taunting me.  I've tried a number of variations but every setting I
have returns a 404 for the admin interface css.  Here's what I have
just now:

MEDIA_URL = 'media/'
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'

STATICFILES_DIRS = (
'/usr/local/lib/python/site-packages/django/contrib/admin/media',
)

I'll be honest, I didn't start that way, I was originally going to put
the admin static files in a different directory for my own crazy peace
of mind but I read a post on stackoverflow which said
ADMIN_MEDIA_PREFIX should simply be STATIC_URL with admin after it so
I've tried that and still no luck.  But here's what is confusing me...

(Just to clarify /usr/local/lib/python is a symlink to /usr/local/lib/
python2.7 and adding 2.7 to settings.py made no difference)

%python manage.py findstatic admin/css/dashboard.css
Found 'admin/css/dashboard.css' here:
  /usr/local/lib/python2.7/site-packages/django/contrib/admin/media/
css/dashboard.css
%python manage.py findstatic css/dashboard.css
Found 'css/dashboard.css' here:
  /usr/local/lib/python2.7/site-packages/django/contrib/admin/media/
css/dashboard.css
%python manage.py findstatic dashboard.css
No matching file found for 'dashboard.css'.

So I'm fairly happy that django is finding these files in a sane an
happy manner, and the failure on the final one gives me a sense of
reassurance that the paths are all making sense, but still the
templates are generating  and the stylesheets are not found.
I've been paranoid about permission denied, but it's just not found
despite findstatic finding it.

I've tried debug true and false, it makes no difference either.

I'm using Apache 2.2 and mod_wsgi, I've checked the configs for those
a few times and can't see anything but I may be blind through
familiarity now so if there's an obvious thing to check I'll happily
do so.

I just don't understand why findstatic can find the files but they 404
when served in a template, any suggestions greatly welcomed.

TIA,
Kevin

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



can django be used in destop application?

2011-08-23 Thread smith jack
i mean not use django for web site development, but for desktop application,
it seems its orm can be used in destop application, isn't it?

-- 
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 highlighting for template files and file suffix

2011-08-23 Thread Gelonida N
Hi,

I'm rather new to Django and just start working with a little more with
templates.

I wondered how to make a distinction between html files and html templates.

Shall I used different suffixes or is the directory location enough.

If I don't have different file suffixes, how do you teach your editor,
when editing an html file and when editing a template file.


I am using vim

Are there any 'best practices'?

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



Python requests library

2011-08-23 Thread Cal Leeming [Simplicity Media Ltd]
Nice looking library here:

https://github.com/kennethreitz/requests

Well over due, the amount of times I've had to monkey patch urllib2 to make
it do the most simplest of things is unreal :X

-- 
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: Debud setting behaves weird

2011-08-23 Thread Yaşar Arabacı
This makes sense :)


Warning

This view will only work if
DEBUG
 is True.

That's because this view is *grossly inefficient* and probably *insecure*.
This is only intended for local development, and should *never be used in
production*.

2011/8/23 Martin J. Laubach 

> You might want to read the documentation at
> https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/ --
> especially the big boxes labelled "Warning".
>
> mjl
>
>  --
> 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/-/IeEsxfoPtigJ.
>
> 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.
>



-- 
http://yasar.serveblog.net/

-- 
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: Debud setting behaves weird

2011-08-23 Thread Martin J. Laubach
You might want to read the documentation 
at https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/ -- 
especially the big boxes labelled "Warning".

mjl

-- 
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/-/IeEsxfoPtigJ.
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: Debud setting behaves weird

2011-08-23 Thread Yaşar Arabacı
I normally use my linux platform, but I am on my brothers computer which is
a win xp. I am on development server. And I just found out that I get 404
because I didn't had 500 template. Now I am getting my 500 template. So here
is sum of what is happening:

go to a static file while django dev server running, and see that file
served.
make DEBUG=False in settings
refresh page
see my 500 template

I can repeat this as much as I want.

2011/8/23 Kejun He 

> Hi
> Which platform did your project run?
> On the development platform or the publishing platform ?
>
> 2011/8/23 Yaşar Arabacı 
>
>> Hi,
>>
>> When I set debug=True in my settings module, my static files work. When I
>> set it to False, I get 404 on my static files. Anyone has an ide what is
>> going on here?
>>
>> --
>> http://yasar.serveblog.net/
>>
>>  --
>> 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.
>



-- 
http://yasar.serveblog.net/

-- 
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: Debud setting behaves weird

2011-08-23 Thread Kejun He
Hi
Which platform did your project run?
On the development platform or the publishing platform ?

2011/8/23 Yaşar Arabacı 

> Hi,
>
> When I set debug=True in my settings module, my static files work. When I
> set it to False, I get 404 on my static files. Anyone has an ide what is
> going on here?
>
> --
> http://yasar.serveblog.net/
>
>  --
> 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.contrib.markup question

2011-08-23 Thread Rodney Topor
Um, Markdown is supposed to allow users to enter marked-up text
safely, isn't it?  But the output of the markdown filter is assumed to
be safe.  Writing {{ input_text|escape|markdown }} in a template
doesn't appear to escape raw HTML in the input text before the
markdown filter is applied.  So how can one use markdown safely?

Rodney

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



Debud setting behaves weird

2011-08-23 Thread Yaşar Arabacı
Hi,

When I set debug=True in my settings module, my static files work. When I
set it to False, I get 404 on my static files. Anyone has an ide what is
going on here?

-- 
http://yasar.serveblog.net/

-- 
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: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-23 Thread Leon van der Ree
Thanks Andy

that explains why I experience this issue. However doesn't it suppose
to work like this; Why should a safe string become unsafe again after
deserialisation? I understand this is a current limitation of the
serialisation process, but this is not exactly what you would expect,
is it. So in my eyes this is still a bug.

Are there any known workarounds?

I think the solution should be to improve the serialiser, take the
meta-data into the process, but I haven't looked at how this can be
accomplished yet.


On 23 aug, 06:22, Andy McKay  wrote:
> > However, it seems that the redirect removes the safe_marking around my
> > message! since the result I get in my browser is html-encoded!
>
> It won't work that way, safe string alters the class not the contents of the 
> string [1]. The message module turns the string into JSON and stores it. Then 
> when read it does the reverse turning it back into a string.
>
> You'll have either to alter that behaviour or find another way around.
>
> [1]https://code.djangoproject.com/browser/django/trunk/django/utils/safe...
> --
>   Andy McKay
>   a...@clearwind.ca
>   twitter: @andymckay

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



Re: Newbe DateTimeField Question

2011-08-23 Thread Torsten
Thanks for that, but I still get the error message:

Exception Type: IntegrityError
Exception Value:invoice_invoice.payed_at may not be NULL

here my models.py:

from django.db import models

class Customer(models.Model):
company = models.CharField(max_length=255)
branch = models.CharField(max_length=255)
firstname = models.CharField(max_length=255)
lastname = models.CharField(max_length=255)
street = models.CharField(max_length=255)
zip = models.CharField(max_length=6)
country = models.CharField(max_length=255)
email = models.CharField(max_length=255)
created_at = models.DateTimeField('date created')

def __unicode__(self):
return self.company


class Project(models.Model):
title = models.CharField(max_length=255);
created_at = models.DateTimeField('date created')

def __unicode__(self):
return self.title


class Invoice(models.Model):
customer = models.ForeignKey(Customer)
project = models.ForeignKey(Project, null=True)
sum = models.FloatField(default=0)
tax = models.IntegerField(default=16)
payed_at = models.DateTimeField(default=None)
payable_at = models.DateField('payable at')
created_at = models.DateTimeField(False, True)

class InvoiceItem(models.Model):
invoice = models.ForeignKey(Invoice)
text = models.TextField()
unit = models.CharField(max_length=255)
amount = models.IntegerField()
sum = models.FloatField()


On 21 Aug., 15:19, dm03514  wrote:
> you can set default=None, that way you don't have to explicityly save
> that value as none every time you save an object.
>
> On Aug 21, 7:33 am, Torsten  wrote:
>
>
>
>
>
>
>
> > Hi
>
> > I simply want the DateTime to be set to null.
>
> > payed_at = models.DateTimeField(null=True)
>
> > but always get this as an error:
>
> > IntegrityError at /admin/invoice/invoice/add/
> > invoice_invoice.payed_at may not be NULL
>
> > Thanks for help.
>
> > Torsten

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



Bumper DjangoCon this year

2011-08-23 Thread Steve Holden
Early signs were that we would comfortably break the 255 limit we had to
place on last year. This year, with the change of venue, we can accommodate
more delegates. Just as well, because today the attendance went past the 300
mark with two weeks still to go!

Thanks to everyone who is supporting DjangCon so magnificently. For those of
you who are going, I look forward to seeing you there.

regards
 Steve
-- 
Steve Holden+1 571 484 6266  +1 800 494 3119
Holden Web LLC http://www.holdenweb.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: Weird Model question django

2011-08-23 Thread robin nanola
what is the use of the article foreignkey in the UserProfile model?

On Tue, Aug 23, 2011 at 2:34 PM, raj  wrote:

> nvm, I think i'm starting to figure it out. Need to read up on many-to-
> many fields.
>
> On Aug 23, 2:21 am, raj  wrote:
> > This may be difficult to explain. I'm a little new to django and the
> > whole idea of models.
> >
> > Let's say I'm making an article app, where each article has a creator,
> > but other users can edit the article at will. I'm having a little
> > difficult on how to create the models for this.
> >
> > Firstly, I extend the user profile with the following:
> >
> > class UserProfile(models.Model):
> > #Required field:
> > user = models.OneToOneField(User)
> >
> > #Other Fields:
> > headline = models.CharField()
> > industry = models.CharField()
> > article= models.ForeignKey(articleModel.article)
> >
> > Here is the first place I'm getting confused, do I put the foreignkey
> > field in the user model? My reasoning for it being placed here is
> > because each article can have many editors.
> >
> > Now here is my article model:
> >
> > class article(models.Model):
> > #primary key is already true
> > creator = models.ForeignKey(userModel.UserProfile)
> > title = models.CharField()
> > text = models.TextField()
> >
> > Over here, I put the ForeignKey field so it would relate back to the
> > creator, because every article has a single creator. (As a side note,
> > I do want to make it so an article can have multiple creators, but I
> > don't know what to do in this scenario). I'm finding it a bit odd that
> > the UserProfile model is referencing the article model, and the
> > article is referencing it back. Can someone please help me unjumble my
> > brain?
> >
> > 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.
>
>

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



2 url template tag questions

2011-08-23 Thread Yaşar Arabacı
Hi,

If a use url template tag on a generic view, does urls.py supply required
arguments? For example:

urlpatterns = patterns('django.views.generic.date_based',
(r'^arsiv/(?P\d{4})/$','archive_year',{
'template_name' : 'blog/yillar.html',
'date_field' : 'pub_date',
'queryset' : Post.objects.filter(yayinlandi=True),
'extra_context' : common_data,
'make_object_list' : True,
'template_object_name' : 'makale'
}),
)

Can I access this url with {% url
django.views.generic.date_based.archive_index asdfasdf.year %}

And also, I am using rss framework like this:

from feeds import LatestPosts, TagFeed
urlpatterns += patterns('',
(r'^rss/$', LatestPosts()),
(r'^tag/(?P[^/]+)/rss/$', TagFeed()),
)

Can I access this via url template tag?
-- 
http://yasar.serveblog.net/

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



Re: What I am missing is this Django "logout"?

2011-08-23 Thread Andre Lopes
Hi, thanks your your reply.

And what should be the right way of doing this?

Best Regards,



On Sun, Aug 21, 2011 at 5:00 AM, Subhranath Chunder
 wrote:
> No, it's working is not a mistake by itself. Because now, the regular
> expression is extracting an absolute path, and not a relative url path.
> But, you are surely using things "the wrong way". :)
>
> On Sun, Aug 21, 2011 at 4:57 PM, Andre Lopes  wrote:
>>
>> Hi,
>>
>> Thanks for the reply.
>>
>> I have discovered that If I use this:
>>
>> [code]
>> Welcome {{ request.user.username }}. Logout
>> [/code]
>>
>> Instead of:
>>
>> [code]
>> Welcome {{ request.user.username }}. Logout
>> [/code]
>>
>> I got the code working as expected. The thing is that I got an URL
>> like this: http://localhost:8080/logout//directorio//
>>
>> This should be working like this, or this is just a mistake that works?
>>
>>
>> PS: Sorry my english.
>>
>> On Sat, Aug 20, 2011 at 10:35 PM, Subhranath Chunder
>>  wrote:
>> >> Welcome {{ request.user.username }}. Logout
>> > This part of your code is generating a logout URL like this in your
>> > template: "/logout/directorio"
>> > Now, your urls.py has the pattern:
>> > url(r'^logout/(?P.*)/$',
>> > 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >
>> > This makes, the variable 'next_page' assign the value after the slash
>> > 'login/' section. i.e. next_page = 'directorio'
>> > Now, the logout view is invoked and it's code gets executed. But since
>> > you
>> > provided a relative url value to this view, a http 302 is issued to the
>> > client to fetch the new url. Formed as a result of joining you current
>> > url
>> > and the relative path. i.e. '/login/directorio/directorio'. Which is
>> > basically again matching with the last url pattern. So, this whole thing
>> > keeps on going in a loop where:
>> > '/logout/directorio' is requested the first time. In response, the
>> > client is
>> > requested to fetch url,
>> > '/logout/directorio/directorio' the second time...
>> > '/logout/directorio/directorio/directorio/directorio' the third time...
>> > and so on and on in a loop.
>> > This is why you never see the expected output in the page. The actual
>> > logout
>> > is done in the first request only.
>> > So, when you refresh the page, you are basically pre-empting your
>> > browser
>> > client to break the initial loop, and manually requesting for the new
>> > fetch
>> > request.
>> > I hope I was able to clear the reason behind the outcome you were
>> > experiencing.
>> >
>> >
>> > On Sat, Aug 20, 2011 at 2:39 PM, Andre Lopes 
>> > wrote:
>> >>
>> >> I am new to Django, and I am trying to put the logout to work...
>> >>
>> >> I have installed the an App called, Django-Registration.
>> >>
>> >> My problem is that I can do the logout, but the page does not get
>> >> refreshed, I must to press F5 after the logout to see the page for not
>> >> logged users.
>> >>
>> >> What I have done is the following:
>> >>
>> >> urls.py, added to urlpatterns:
>> >> [code]
>> >> url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':
>> >> '/'}, name='auth_logout'),
>> >> url(r'^logout/(?P.*)/$',
>> >> 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >> [/code]
>> >>
>> >> In the template I have this code:
>> >> [code]
>> >> {% if request.user.is_authenticated %}
>> >>    Welcome {{ request.user.username }}. Logout
>> >> {% else %}
>> >>    Welcome. Please login or > >> href="/accounts/register/">register
>> >> {% endif %}
>> >> [/code]
>> >>
>> >> When I click Logout I dont see this in the screen:
>> >> [code]
>> >> Welcome. Please login or > >> href="/accounts/register/">register
>> >> [/code]
>> >>
>> >> I only see this text if I use F5 to refresh the page.
>> >>
>> >> What I am missing here?
>> >>
>> >> Please give me a clue.
>> >>
>> >> Best Regards,
>> >>
>> >> --
>> >> 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.
>> >>
>> >
>> >
>> >
>> > --
>> > Thanks,
>> > Subhranath Chunder.
>> > www.subhranath.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.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to 

Re: Weird Model question django

2011-08-23 Thread raj
nvm, I think i'm starting to figure it out. Need to read up on many-to-
many fields.

On Aug 23, 2:21 am, raj  wrote:
> This may be difficult to explain. I'm a little new to django and the
> whole idea of models.
>
> Let's say I'm making an article app, where each article has a creator,
> but other users can edit the article at will. I'm having a little
> difficult on how to create the models for this.
>
> Firstly, I extend the user profile with the following:
>
> class UserProfile(models.Model):
>     #Required field:
>     user = models.OneToOneField(User)
>
>     #Other Fields:
>     headline = models.CharField()
>     industry = models.CharField()
>     article= models.ForeignKey(articleModel.article)
>
> Here is the first place I'm getting confused, do I put the foreignkey
> field in the user model? My reasoning for it being placed here is
> because each article can have many editors.
>
> Now here is my article model:
>
> class article(models.Model):
>     #primary key is already true
>     creator = models.ForeignKey(userModel.UserProfile)
>     title = models.CharField()
>     text = models.TextField()
>
> Over here, I put the ForeignKey field so it would relate back to the
> creator, because every article has a single creator. (As a side note,
> I do want to make it so an article can have multiple creators, but I
> don't know what to do in this scenario). I'm finding it a bit odd that
> the UserProfile model is referencing the article model, and the
> article is referencing it back. Can someone please help me unjumble my
> brain?
>
> 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.



Weird Model question django

2011-08-23 Thread raj
This may be difficult to explain. I'm a little new to django and the
whole idea of models.

Let's say I'm making an article app, where each article has a creator,
but other users can edit the article at will. I'm having a little
difficult on how to create the models for this.

Firstly, I extend the user profile with the following:

class UserProfile(models.Model):
#Required field:
user = models.OneToOneField(User)

#Other Fields:
headline = models.CharField()
industry = models.CharField()
article= models.ForeignKey(articleModel.article)

Here is the first place I'm getting confused, do I put the foreignkey
field in the user model? My reasoning for it being placed here is
because each article can have many editors.

Now here is my article model:

class article(models.Model):
#primary key is already true
creator = models.ForeignKey(userModel.UserProfile)
title = models.CharField()
text = models.TextField()

Over here, I put the ForeignKey field so it would relate back to the
creator, because every article has a single creator. (As a side note,
I do want to make it so an article can have multiple creators, but I
don't know what to do in this scenario). I'm finding it a bit odd that
the UserProfile model is referencing the article model, and the
article is referencing it back. Can someone please help me unjumble my
brain?

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: Quick question on importing

2011-08-23 Thread raj
Ya, well i got it to work by adding the project in front of it. Thank
you for the help!

On Aug 23, 1:55 am, Mike Dewhirst  wrote:
> On 23/08/2011 3:29pm, raj wrote:> I am editing my user model, and I want to 
> place a foreign key to a
> > class in another model, that is in a different app. How would I go
> > about importing it?
>
> > Tree:
> > /project/myapp/model1.py
> > /project/myapp2/model2.py
>
> > can i simply just say:
> > from myapp2 import model2
>
> The easy way to figure this out is to do it then start a Python
> interpreter and say "import myapp.model1"
>
> The fact is it depends on your python path and the existence of
> __init__.py files. Testing the import will show you the situation.
>
> Regards
>
> Mike
>
>
>
>
>
>
>
> > or do I need to edit something in the settings?
> > 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: Need help on admin page

2011-08-23 Thread Kejun He
Visit the django official document about admin

https://docs.djangoproject.com/en/1.3//ref/contrib/admin/

On Tue, Aug 23, 2011 at 2:01 PM, Temulen Odbayar wrote:

> I don't understand about admin page site thing. What should i do with
> this thing??? Sorry my bad english. Any help ^__^
>
> --
> 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.



Need help on admin page

2011-08-23 Thread Temulen Odbayar
I don't understand about admin page site thing. What should i do with
this thing??? Sorry my bad english. Any help ^__^

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