Re: DreamHost

2006-08-08 Thread Eugene Lazutkin

Rather obvious question: did you try to complain to DreamHost people 
about your problems? FastCGI is supposed to work.

Thanks,

Eugene

george webzary wrote:
> I tried everything. I touched the fcgi files, pkilled python. There is 
> no problem
> as far as django itself is concerned. It is working very well. I am able 
> to create apps, models, templates, acess the manage.py shell. I can do 
> whatever I can do on my Ubuntu PC
> 
> The problem is definitely with Fast CGI part.
> 
> I tried both on a domain and a sub domain. On the Domain something 
> seemed to work, ie it was throwing a 500 error. Subdomain it was 
> throwing a 404 error.
> 
> I have followed the instructions to the ditto. Have triple checked stuff.
> 
> DreamHost has really let me down. I am very very sad.
> 
> I even tried installing flup ( it got installed) and followed the stuff 
> what was recommended in Django new docs. Nothing is working!
> 
> George
> 
> On 8/9/06, *Jure Èuhalev* <[EMAIL PROTECTED] 
> > wrote:
> 
> 
> On 8/8/06, george webzary <[EMAIL PROTECTED]
> > wrote:
>  > Hi,
>  >
>  > Has anyone set up a web site on DreamHost with Django pre 0,96
> lately. I
>  > tried yesterday. It just does not seem to work. I tried Jeff Croft's
>  > tutorial first, then changed the code based on this link
>  >  http://www.djangoproject.com/documentation/fastcgi/
>  >
>  > And then tried the official version of dreamhost wiki. I am able
> to create
>  > projects and apps without a problem, but the website pages does
> not get
>  > loaded up.
>  >
>  > Help appreciated
>  >
>  > George Webzary
> 
> What error are you getting? Does the basic hello.py from their wiki
> work for you? On one of my DH hosts (whittier) I can't get python via
> fastcgi working at all, while on another one (overland) it works
> without a problem so you better make sure your fastcgi python is
> working at all.
> 
> Somewhere in the process of trying to convince tech support of this
> strange setup I gave up so I'm not really sure how to solve this
> problem.
> 
> regards,
> Jure Cuhalev
> 
> 
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MR: _manipulator_validate_FIELD() methods?

2006-08-08 Thread Tom Tobin

On 8/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Tom,
>
> Does the solution I posted [1] earlier in this thread not work for you?
>
>
> [1] http://groups.google.com/group/django-users/msg/a76be4c94631ec80

Getting these manipulator-aware validators working in the admin is
exactly the issue I want to solve; I came up with a proposal to
reinstate similar behavior to pre-MR-removal Django and posted it to
Django-dev.  I now have both mentioned potential solutions working;
it's just a matter of deciding which one I prefer (or, quite likely,
having someone else smarter than me hit me with a stick and point out
a superior way of doing 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MR: _manipulator_validate_FIELD() methods?

2006-08-08 Thread [EMAIL PROTECTED]

Tom,

Does the solution I posted [1] earlier in this thread not work for you?


[1] http://groups.google.com/group/django-users/msg/a76be4c94631ec80

matthew


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: DreamHost

2006-08-08 Thread george webzary
I tried everything. I touched the fcgi files, pkilled python. There is no problemas far as django itself is concerned. It is working very well. I am able to create apps, models, templates, acess the manage.py shell. I can do whatever I can do on my Ubuntu PC
The problem is definitely with Fast CGI part.I tried both on a domain and a sub domain. On the Domain something seemed to work, ie it was throwing a 500 error. Subdomain it was throwing a 404 error.
I have followed the instructions to the ditto. Have triple checked stuff. DreamHost has really let me down. I am very very sad.I even tried installing flup ( it got installed) and followed the stuff what was recommended in Django new docs. Nothing is working!
GeorgeOn 8/9/06, Jure Čuhalev <[EMAIL PROTECTED]> wrote:
On 8/8/06, george webzary <[EMAIL PROTECTED]> wrote:> Hi,>> Has anyone set up a web site on DreamHost with Django pre 0,96 lately. I> tried yesterday. It just does not seem to work. I tried Jeff Croft's
> tutorial first, then changed the code based on this link>  http://www.djangoproject.com/documentation/fastcgi/>> And then tried the official version of dreamhost wiki. I am able to create
> projects and apps without a problem, but the website pages does not get> loaded up.>> Help appreciated>> George WebzaryWhat error are you getting? Does the basic hello.py
 from their wikiwork for you? On one of my DH hosts (whittier) I can't get python viafastcgi working at all, while on another one (overland) it workswithout a problem so you better make sure your fastcgi python is
working at all.Somewhere in the process of trying to convince tech support of thisstrange setup I gave up so I'm not really sure how to solve thisproblem.regards,Jure Cuhalev

Re: Using Django with a non-relational back-end data store?

2006-08-08 Thread Malcolm Tredinnick

On Tue, 2006-08-08 at 18:41 -0700, felciano wrote:
> Hi --
> 
> I'm looking for a python web framework to build web apps talking to a
> non-SQL-based data store, similar to an RDF store for the semantic web.
> I'm trying to find a toolkit with a sufficiently-factored database
> abstraction layer that we could plug in our own. The server has its own
> query language, which you can call over HTTP (RESTian), XML-RPC, SOAP,
> etc, and which returns results as a serialized tuple list (i.e. a
> table), so hopefully the impedance mismatch would not be too extreme.

All you need to do is turn them into Python objects or dictionaries (see
below for why) and you're set.

> I have looked at TurboGears, and through that project have come across
> Django, which looks to be among the more mature frameworks. I am having
> a hard time figuring out where to look to understand the dependencies
> on SQLObject. Has anyone used Django to connect to a
> non-SQLObject-based data store,

Django does not use SQLObject. I think you are still thinking about
TurboGears here.

Anything in Django that inherits from django.db.models.Model is fairly
tightly tied to Django's database backend: so SQL databases, etc.

If you want to get your data from another location, you can do that and
then just use Django's views and templates to present your data. Things
like generic views will not work without a bit of work on your part
(since they require something that works exactly like a model's query
interface), but they are just an aid in any case -- you do not lose any
functionality if you do not use generic views.

Before diving too deeply into putting a custom backend into the existing
model infrastructure, you should probably have a think about whether you
really need to (think about whether your are customising the right place
in the hierarchy). If you already have a way of accessing data and
getting it into Python objects, then you can probably live without
Django's ORM layer. After all, the views are just Python code, so they
can work with anything you like. The templates access everything using
attributes or dictionary keys or methods, so you pass them objects or
dictionaries and they do not care whether it's from Django's ORM or not.

Although the various layers in Django (models, views, templates) all
work well together, they are sufficiently orthogonal that they don't
rely on each other to operate, so you can happily use your own "model"
layer and that might be easier than trying to extend Django's model
layer to talk to your own backend. 

Best wishes,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Andy Dustman

On 8/7/06, Niran Babalola <[EMAIL PROTECTED]> wrote:
>
> "UnicodeEncodeError: 'latin-1' codec can't encode characters in
> position 75-76: ordinal not in range(256)"

This indicates your default database connection character set is
latin1. You can change this in your server configuration, or you can
change it as a connect(charset="utf8") option in MySQLdb-1.2.1. Most
likely you'll have to hack on django.db.backends.mysql.base to set it
with the client.
-- 
The Pythonic Principle: Python works the way it does
because if it didn't, it wouldn't be Python.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



good at typing? get at me

2006-08-08 Thread numberslocker

lookin fer a data entry specialist:
--gotta be quick at typing
--serious attitude[serioulsy good, that is]
--part time/full time
--basic internet knowledge.

hit me at [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



formwrappers and manipulators

2006-08-08 Thread skullvulture

Are form wrappers and manipulators only for creating 'change object'
and 'add object' forms?  I'm creating a simple form that will have
several drop downs that correspond to fields in the database for one of
my objects, that will serve as a search form.  Right now I have a basic
addManipulator so I can use the form wrapper to automatically generate
form fields, but that will only generate text fields rather than drop
downs of existing objects.  Do I need to right my own form fields or is
there a way to get formwrappers and manipulators to do what I want?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: DateTime field milliseconds?

2006-08-08 Thread James Bennett

On 8/8/06, Gennan Chen <[EMAIL PROTECTED]> wrote:
> I am using MySQL as my DB and it seems datetime field did not store
> milliseconds. Is it the correct behavior? Any chance I can hack that/ I need
> Milliseconds resolution.

As far as I know, MySQL offers no support for storing such values; the
TIME column type will accept an "HH:MM:SS.fraction" input format, but
there is an explicit note in the manual that only the hours, minutes
and seconds will actually be stored. DATETIME and TIMESTAMP columns do
not accept units smaller than one second.

Postgres can store values up to a resolution of one microsecond, but I
don't know off the top of my head if Django's ORM will specify that
much precision.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: DreamHost

2006-08-08 Thread Jure Čuhalev

On 8/8/06, george webzary <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone set up a web site on DreamHost with Django pre 0,96 lately. I
> tried yesterday. It just does not seem to work. I tried Jeff Croft's
> tutorial first, then changed the code based on this link
>  http://www.djangoproject.com/documentation/fastcgi/
>
> And then tried the official version of dreamhost wiki. I am able to create
> projects and apps without a problem, but the website pages does not get
> loaded up.
>
> Help appreciated
>
> George Webzary

What error are you getting? Does the basic hello.py from their wiki
work for you? On one of my DH hosts (whittier) I can't get python via
fastcgi working at all, while on another one (overland) it works
without a problem so you better make sure your fastcgi python is
working at all.

Somewhere in the process of trying to convince tech support of this
strange setup I gave up so I'm not really sure how to solve this
problem.

regards,
Jure Cuhalev

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: DreamHost

2006-08-08 Thread Jay Parlar

On 8/8/06, george webzary <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Has anyone set up a web site on DreamHost with Django pre 0,96 lately. I
> tried yesterday. It just does not seem to work. I tried Jeff Croft's
> tutorial first, then changed the code based on this link
>  http://www.djangoproject.com/documentation/fastcgi/
>
> And then tried the official version of dreamhost wiki. I am able to create
> projects and apps without a problem, but the website pages does not get
> loaded up.
>
> Help appreciated

I'm running pre0.96, updated 2 minutes ago, and my Dreamhost site is
working just fine. I used Jeff Croft's tutorial to get going.

You're going to have to be a bit more helpful with what you're seeing
though. Any error output? Any output at all? Is your .htaccess file
setup properly? Did you remember to 'touch foo.com/django.fcgi' after
making your most recent changes?

Jay P.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



DateTime field milliseconds?

2006-08-08 Thread Gennan Chen
Hi!I am using MySQL as my DB and it seems datetime field did not store milliseconds. Is it the correct behavior? Any chance I can hack that/ I need Milliseconds resolution.  Gen-Nan Chen 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



Re: How to get a subset of records from a subset?

2006-08-08 Thread DavidA


PythonistL wrote:
> To explain:
> Let's suppose we have a command
>
> HistoryList=historys.get_list(id__exact='2',order_by=['-PostedDate'])
>
> that command extracts a few records and from them I would like to use
> for further processing all without the first or last record.
> How can I do that in Django version 0.91?
> Thank you for help
> L.

I'm rusty on 0.91 but I think you could do it in two calls with:
count=historys.get_count(id__exact='2',order_by=['-PostedDate'])

HistoryList=historys.get_list(id__exact='2',order_by=['-PostedDate'],
limit=count-2, offset=1)

Or in the post-mr world:

HistoryList=history.objects.filter(id='2').order_by('-PostedDate')[1:-1]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MR: _manipulator_validate_FIELD() methods?

2006-08-08 Thread Tom Tobin

On 5/6/06, Matthew Flanagan <[EMAIL PROTECTED]> wrote:
>
> On 5/6/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> >
> > Matthew Flanagan wrote:
> >
> > >Since MR merged the _manipulator_validate_FIELD() methods stopped
> > >working. The solution I came up with was to write custom manipulators
> > >(which was what I was trying to avoid all along).
> > >
> > Can you assign those validators to the validator_list of a field right
> > in a model? I never had a chance to use _manipulator_validate_FIELD() so
> > I don't know if there is any difference.
> >
>
> The validator functions assigned to a models validator_list only take
> two arguments eg. isValidField(field_data, all_data). Where as they
> _manipulator* ones looked like this _manipulator_validate_FIELD(self,
> field_data, all_data), where 'self' was the manipulator instance. The
> latter were automatically added to the model's manipulator in
> pre-magic-removal.

I know this is an old thread, but I just ran into the same issue on
trunk: I have no idea how to duplicate the _manipulator_validate_FIELD
behavior from pre-MR in order to access fields from the original
object in a validator.  I can't find anything in the current docs or
in the source which might indicate how to do this; anyone have any
pointers?  :-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



DreamHost

2006-08-08 Thread george webzary
Hi,Has anyone set up a web site on DreamHost with Django pre 0,96 lately. I tried yesterday. It just does not seem to work. I tried Jeff Croft's tutorial first, then changed the code based on this link 
http://www.djangoproject.com/documentation/fastcgi/And then tried the official version of dreamhost wiki. I am able to create projects and apps without a problem, but the website pages does not get loaded up. 
Help appreciatedGeorge Webzary

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---


Re: Contacts application

2006-08-08 Thread Sam Tran

On 8/8/06, Rares Vernica <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Do you know anybody trying a Contacts/Phonebook type of application in
> Django? I am thinking about building one.
>

We are writing such an interface for internal use.

The contact information includes:
- work phone numbers
- home phone numbers
- cell phone numbers
- pager phone numbers
It is stored in an LDAP directory.

Work phone numbers are viewable by anybody while the other numbers are
viewable only by authorized people. The interface allows
administrators to define who is authorized to view those personal
phone numbers at the user level (viewer-contact relationship),
department level (viewer-department relationship) or group level
(viewer-custom group relationship). We also support 'permission
inheritance'. Those relationships are stored in a SQL backend. A
regular user will be able to view somebody's personal phone numbers
based on these pre-defined relationships. The application performs the
lookups in LDAP.

Sam

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How can i modify default add method for a model?

2006-08-08 Thread Bryan Chow

Not sure I understand exactly what you're looking for, but have you
looked at the manipulators documentation?

http://www.djangoproject.com/documentation/forms/

Bryan


On 8/8/06, ElGranAzul <[EMAIL PROTECTED]> wrote:
> Hi all...
>
> I'm very newbie to django and python, and i'm testing it.
>
> I've created a model, and i would like to add a function to create a
> group item for each model item. I've thinkint to use __setitem__ or
> __add__, but i can't find documentation. Someone could help me or give
> me some doc or url, please? 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Http authentication and the multiple auth backend model.

2006-08-08 Thread Pawel J. Sawicki

Hello!

I'm developing a web based application using the Django framework.

One of the requirements for my software state that the program must,
whenever possible, automatically "deal" with users that had been
previously authenticated via http capabilities. It does not mean it
should always log them in - it just must be aware of the fact that the
user had previously proven its identity.

So I've searched a bit. I came across couple of sites, most notably
the:

http://code.djangoproject.com/ticket/689

It describes a way to deal with http authentication by the means of
middleware.

But there's a glitch... Adrian, on "02/28/06 22:19:22", changed the
status of that ticket to closed, stating this particular approach was
superseded by the multiauth branch.

Since I want to follow the development of the framework I tried to
apply the "new model" to my problem... without any luck.

At the very last I ended up with a backend, that had its authenticate()
method similar to:

def authenticate(self):
return User.objects.get(id=1)

So, at least in theory, it should always return a user. It did in fact,
but the login process still required that the user submitted a form -
which is redundant in case of the http authentication.

So my question is the following :)

Does the new "Multiple Auth Backend" model really make the "middleware
approach" for the http authentication obsolete?

If it is obsolete - could you please point me (rtfm/rtfc will do) to
the solution that uses the multi auth model? The only requirement is
that the user must input its credentials only once - and it must be the
http login form, provided by the web browser.

Just for the record - one of the arguments against implementing http
authentication in Django, that was presented on
http://www.djangoproject.com/weblog/2005/oct/24/http/, was that it is
impossible to logout a user. Since it is not quite true (see a comment
that I made here - http://code.djangoproject.com/ticket/689#change_10)
don't you think that having a http authentication capabilities in
django would be a plus?

Best regards,
Pawel Sawicki


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: 'Unindexable Object' Error In Template W/ Relation Manager

2006-08-08 Thread Waylan Limberg

On 8/8/06, Sarcastic Zombie <[EMAIL PROTECTED]> wrote:
>
> Oh man, I'm really grateful for the help. And for writing Django in the
> first place.
>
> Here's the fun part of my problem! It works fine in the ./manage.py
> shell. My view was loading the agency with an id of 141, so for
> consistency, we'll use that same object.
>
> >>> from commund.financial_database.models import *
> >>> a = Agency.objects.get(id=141)
> >>> a
>
> 
>
> >>> a.agent_set.all()
>
> []
>

What happens when you keep going? Try doing the loop here. Perhaps
something like:

>>> for agent in a.agent_set.all():
... print agent
...




-- 

Waylan Limberg
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Why 404?

2006-08-08 Thread Jarek Zgoda

Steven Armstrong wrote:

> Have you nuked any *.pyc files still lying around after applying the patch?

That was it, thanks. Did a clean SVN checkout and your patch works
fine.

Any chance for anybody else to check & review this patch? It would be
nice to have such problem fixed...

Cheers
Jarek Zgoda


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: 'Unindexable Object' Error In Template W/ Relation Manager

2006-08-08 Thread Sarcastic Zombie

> What happens when you keep going? Try doing the loop here. Perhaps
> something like:
>
> >>> for agent in a.agent_set.all():
> ... print agent
> ...


>>> for agent in a.agent_set.all():
...  print agent.first_name
...
Agent

No error. :-D


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How can i modify default add method for a model?

2006-08-08 Thread ElGranAzul

Ok... my newbie error... ;)

Now i've found it before 2 days of reads... the save function...

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



How can i modify default add method for a model?

2006-08-08 Thread ElGranAzul

Hi all...

I'm very newbie to django and python, and i'm testing it.

I've created a model, and i would like to add a function to create a
group item for each model item. I've thinkint to use __setitem__ or
__add__, but i can't find documentation. Someone could help me or give
me some doc or url, please? 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Has djangoproject.com's database been recently restored from a backup?

2006-08-08 Thread Pawel J. Sawicki

Adrian Holovaty wrote:

> I routinely go through the djangoproject.com comments and delete
> comments that either aren't directly related to the documentation or
> are incorrect. (...)

Well... I've just tried to follow the discussion that started in those
two topics.

I'll rephrase my question on the mailing list then :)

Best regards,
Pawel Sawicki


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: manage.py syncdb error

2006-08-08 Thread abe


Kenneth Gonsalves wrote:
> On 08-Aug-06, at 7:37 PM, abe wrote:
>
> >
> > I'm sometimes creating extra models, sometimes deleting an old model,
> > and then run syncdb to update the database.
>
> if you are deleting old model, syncdb wont do it for you
>

I know, but the complaint is about an currently existing model. 

abe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: 'Unindexable Object' Error In Template W/ Relation Manager

2006-08-08 Thread Kenneth Gonsalves


On 08-Aug-06, at 8:36 PM, Sarcastic Zombie wrote:

>
> I'm in the process of porting from .91 to the magic removal trunk  
> (lord
> have mercy).

my sympathies
>
> In one of the old templates, I do a:
>
>{% for agent in agency.get_agent_list %}
>
>blah blah
>
>{% endfor %}
>
> That worked great. So in my revised unmagical template I figured  
> I'd do
> a little:
>
>{% for agent in agency.agent_set.all %}

{% for agent in agency.agent.all %}


-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread John Sutherland

Not that I could find -- I believe I originally found it in a Ticket somewhere.

John.


On 8/8/06, ak <[EMAIL PROTECTED]> wrote:
>
> John, app_label made it work. Thanks !!!
>
> P.S. Is there a line in django docs about that ?
>
>
> >
>


-- 
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: manage.py syncdb error

2006-08-08 Thread Kenneth Gonsalves


On 08-Aug-06, at 7:37 PM, abe wrote:

>
> I'm sometimes creating extra models, sometimes deleting an old model,
> and then run syncdb to update the database.

if you are deleting old model, syncdb wont do it for you

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



'Unindexable Object' Error In Template W/ Relation Manager

2006-08-08 Thread Sarcastic Zombie

I'm in the process of porting from .91 to the magic removal trunk (lord
have mercy).

In one of the old templates, I do a:

   {% for agent in agency.get_agent_list %}

   blah blah

   {% endfor %}

That worked great. So in my revised unmagical template I figured I'd do
a little:

   {% for agent in agency.agent_set.all %}

   blah blah

   {% endfor %}

but I'm getting a screaming 'unindexable object' error. I've been
toying with this and even sought help in the #django channel on IRC,
and no one seems to understand why this is happening.

HALP!


Thanks in advance,

-Jason L


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin Manipulators

2006-08-08 Thread Adrian Holovaty

On 8/7/06, Seth Buntin <[EMAIL PROTECTED]> wrote:
> Can I extend the admin manipulator?  I want to change one ManyToMany
> select box to a text field.

Hey Seth,

No, it's not possible to extend the default model manipulators for use
in the admin.

Adrian

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



Related Models Repost

2006-08-08 Thread Dave

How can I create a relationship between two models, using a ForeignKey
in the second to take advantage of the Admin interface ability to add
an arbitrary number of them, but then also have the ability to create a
public view for adding objects based off the first model AND the
second?

So:

class ModelA(models.Model):
first_name = models.CharField(...)
last_name = models.CharField(...)

class ModelB(models.Model):
model_a = models.ForeignKey(ModelA, edit_inline=models.STACKED,
num_in_admin=4)
field_of_interest = models.CharField(...)

The above example works great for the Admin interfact, but how can I
access the ModelB fields via
django.views.generic.create_update.create_object and
django.views.generic.create_update.update_object? Is it even possible,
or will I need to create a custom view?

If I do have to create a custom view, how can I add two manipulators to
access the POST data to validate both objects?

Thanks,
Dave Worley


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Hack: middleware to prepend language code to url

2006-08-08 Thread gjiro

Hello there,

I modified "Advanced Locale from URL middleware" by Jonathan Schemoul a
bit and mixed in some parts of django.middleware.common.

It prepends the language code to the url if no language code was
present in request.path.

Can somebody check the code to suggest possible optimizations and
remove foolishness (especially the regular expressions...)? Untill now,
it just suits the purpose, nothing more.

Thank you,
Gjiro

###

from django.utils.cache import patch_vary_headers
from django.utils import translation
from django.conf import settings
import re

class LocaleURLMiddleware:

def get_match_from_request (self, request):
return re.match(r'/(\w\w)/.*', request.path)

def get_language_from_request (self, request):
changed = False
check_langstart = self.get_match_from_request(request)
lang = settings.LANGUAGE_CODE[:2]
supported = dict(settings.LANGUAGES)

if check_langstart is not None: # check if path contains 
language
t = check_langstart.group(1)
if t in supported:
lang = t
if hasattr(request, 'session'):
request.session['django_language'] = 
lang
else:
response.set_cookie('django_language', 
lang)
changed = True
if not changed:
if hasattr(request, 'session'):
lang = request.session.get('django_language', 
None)
if lang in supported and lang is not None:
return lang
else:
lang = request.COOKIES.get('django_language', 
None)
if lang in supported and lang is not None:
return lang
return lang

def process_request(self, request):
do_prepend = False
language = self.get_language_from_request(request) # get 
language
translation.activate(language)
request.LANGUAGE_CODE = translation.get_language()

check_langstart = self.get_match_from_request(request)
supported = dict(settings.LANGUAGES)
prepend_lang = settings.PREPEND_LANG

if settings.PREPEND_LANG:

check_slashend = re.match(r'/.*/$', request.path) # 
check if path
ends with slash

if check_slashend is not None: # path end with slash, 
no image, css,
js.
from django import http
host = http.get_host(request)
old_url = [host, request.path]
new_url = old_url[:]

if check_langstart is None: # no language 
specified
do_prepend = True
new_url[1] = '/' + language + 
new_url[1] # prepend language

else: # language specified
t = check_langstart.group(1)
if t not in supported: # language not 
supported
do_prepend = True
new_url[1] = 
re.sub(r'/([^/]*?)/(.*?)','/'+ language +'/',
request.path) # replace not supported language

if prepend_lang and do_prepend: # check 
conditions for redirect

if settings.DEBUG and request.method == 
'POST':
raise RuntimeError, "You called 
this URL via POST, but the URL
doesn't end in a slash and you have APPEND_SLASH set. Django can't
redirect to the slash URL while maintaining POST data. Change your form
to point to %s%s (note the trailing slash), or set APPEND_SLASH=False
in your Django settings." % (new_url[0], new_url[1])
request_path = "/%s/%s" % (language, 
request.path)
if new_url != old_url:
# Redirect
if new_url[0]:
newurl = "%s://%s%s" % 
(request.is_secure() and 'https' or
'http', new_url[0], new_url[1])
else:
newurl = new_url[1]
if request.GET:
newurl += '?' + 
request.GET.urlencode()

Re: Admin Manipulators

2006-08-08 Thread Seth Buntin

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



Re: Contacts application

2006-08-08 Thread Sarcastic Zombie

I have an internal company website that includes contact management. I
wrote an app that connects to an LDAP tree; LDAP handles all the
contact stuff (which it's good at) and I just wrote the interface to
view and do lookups, etc.

Just an idea.

Soon I'll be writing code to let django connect to hylafax (shudder).

-Jason L


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread ak

John, app_label made it work. Thanks !!!

P.S. Is there a line in django docs about that ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: manage.py syncdb error

2006-08-08 Thread abe


Seth Buntin wrote:
> Are you trying to insert initial data into you db when running this
> script?
not sure exactly what yuo mean by initial data.

I'm sometimes creating extra models, sometimes deleting an old model,
and then run syncdb to update the database. 

Eiso


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Related Models

2006-08-08 Thread Dave

How can I create a relationship between two models, using a ForeignKey
in the second to take advantage of the Admin interface ability to add
an arbitrary number of them, but then also have the ability to create a
public view for adding objects based off the first model AND the
second?

So:

class ModelA(models.Model):
first_name = models.CharField(...)
last_name = models.CharField(...)

class ModelB(models.Model):
model_a = models.ForeignKey(ModelA, edit_inline=models.STACKED,
num_in_admin=4)
field_of_interest = models.CharField(...)

The above example works great for the Admin interfact, but how can I
access the ModelB fields via
django.views.generic.create_update.create_object and
django.views.generic.create_update.update_object? Is it even possible,
or will I need to create a custom view?

If I do have to create a custom view, how can I add two manipulators to
access the POST data to validate both objects?

Thanks,
Dave Worley


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Gábor Farkas

Wade Leftwich wrote:
> Gábor Farkas wrote:
>> Niran Babalola wrote:
>>> I've been developing a Django application using SQLite, and now I'm
>>> trying to move over to MySQL and actually launch the site. The
>>> application is storing data from RSS/Atom feeds using Universal Feed
>>> Parser, which uses unicode strings for all its data. When I try to
>>> store information from a feed into my MySQL database, I get the
>>> following error:
>>>
>>> "UnicodeEncodeError: 'latin-1' codec can't encode characters in
>>> position 75-76: ordinal not in range(256)"
>>>
>>> Everything worked fine with SQLite, but I haven't been able to get past
>>> this problem with MySQL. I tried dropping the database and recreating
>>> it with utf8 as the default encoding, but that didn't help either. Any
>>> ideas?
>> hi,
>>
>> please give us the whole stacktrace, and the line of the code where this
>> happens.
>>
>> generally, this might happen because you're trying to directly put
>> unicode text into the database (i have no experience with mysql, so i
>> can be wrong here). the various database-backends react differently to
>> save-unicode-data (sqlite3 usually works ok, psycopg1 fails, psycopg2
>> works etc.).
>>
>> so, before saving the data, convert it explicitly to byte-strings with a
>> suitable charset (i assume you're using utf8).
>>
>> gabor
> 
> MySQL defaults to latin-1 encoding, though in version 5 you can specify
> UTF-8. So as Gabor says, you have to convert explicitly to byte-strings
> encoded so your db will accept them. From utf-8 to latin1:
> 
> def utf8tolatin1(s):
> return s.decode('utf-8', 'ignore').encode('latin1',
> 'xmlcharrefreplace')
> 
> In [8]: u'\u2014'.encode('utf-8')
> Out[8]: '\xe2\x80\x94'
> 
> In [9]: utf8tolatin1('\xe2\x80\x94')
> Out[9]: ''
> 
> Also see:
> http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html
> 

thanks for the info..

to the original-poster:
please note, that this way you might lose some character-data.. there's 
no better way, you simply cannot store every unicode character in latin1.

gabor

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



manage.py syncdb error

2006-08-08 Thread abe

if I apply syncdb for one of my apps

./manage.py syncdb xxapp

I get the traceback below that ends with
[...]
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry
'17-add_status' for key 2")

I can't find an obvious error in the database.
does anyone know what could be wrong.?

abe




Traceback (most recent call last):
  File "./manage.py", line 11, in ?
execute_manager(settings)
  File "/usr/lib/python2.3/site-packages/django/core/management.py",
line 1226, in execute_manager
execute_from_command_line(action_mapping)
  File "/usr/lib/python2.3/site-packages/django/core/management.py",
line 1152, in execute_from_command_line
action_mapping[action]()
  File "/usr/lib/python2.3/site-packages/django/core/management.py",
line 472, in syncdb
app=app, created_models=created_models)
  File
"/usr/lib/python2.3/site-packages/django/dispatch/dispatcher.py", line
347, in send
sender=sender,
  File
"/usr/lib/python2.3/site-packages/django/dispatch/robustapply.py", line
47, in robustApply
return receiver(*arguments, **named)
  File
"/usr/lib/python2.3/site-packages/django/contrib/auth/management.py",
line 34, in create_permissions
p.save()
  File "/usr/lib/python2.3/site-packages/django/db/models/base.py",
line 185, in save
','.join(placeholders)), db_values)
  File "/usr/lib/python2.3/site-packages/django/db/backends/util.py",
line 12, in execute
return self.cursor.execute(sql, params)
  File
"/usr/lib/python2.3/site-packages/django/db/backends/mysql/base.py",
line 31, in execute
return self.cursor.execute(sql, params)
  File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 137,
in execute
self.errorhandler(self, exc, value)
  File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line
33, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry
'17-add_status' for key 2")


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin Manipulators

2006-08-08 Thread Seth Buntin

Can this be done?  I just can't seem to find any documentation on
extending the admin module this way.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to get a subset of records from a subset?

2006-08-08 Thread John Sutherland

Hi PythonistL,

I wonder if you can do the following:

histories = historys...
ids = [history.id for history in histories]
histories = historys.get_list(id__in=ids, date__year=1066)

It's a while since I did any .91 ;)

John.


On 8/8/06, PythonistL <[EMAIL PROTECTED]> wrote:
>
>
> To explain:
> Let's suppose we have a command
>
> HistoryList=historys.get_list(id__exact='2',order_by=['-PostedDate'])
>
> that command extracts a few records and from them I would like to use
> for further processing all without the first or last record.
> How can I do that in Django version 0.91?
> Thank you for help
> L.
>
>
> >
>


-- 
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: manage.py syncdb error

2006-08-08 Thread Seth Buntin

Are you trying to insert initial data into you db when running this
script?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Contacts application

2006-08-08 Thread Chris Moffitt


> Do you know anybody trying a Contacts/Phonebook type of application in
> Django? I am thinking about building one.

We don't have a contacts application but within Satchmo (the shopping cart
framework we're developing) there are some address and contact models that
might be helpful.  Check the wiki out here -
http://satchmo.python-hosting.com/wiki

You should look at the Contact directory within the trunk.
http://satchmo.python-hosting.com/browser/trunk/satchmo/contact/

Hope this helps,
Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Wade Leftwich

Gábor Farkas wrote:
> Niran Babalola wrote:
> > I've been developing a Django application using SQLite, and now I'm
> > trying to move over to MySQL and actually launch the site. The
> > application is storing data from RSS/Atom feeds using Universal Feed
> > Parser, which uses unicode strings for all its data. When I try to
> > store information from a feed into my MySQL database, I get the
> > following error:
> >
> > "UnicodeEncodeError: 'latin-1' codec can't encode characters in
> > position 75-76: ordinal not in range(256)"
> >
> > Everything worked fine with SQLite, but I haven't been able to get past
> > this problem with MySQL. I tried dropping the database and recreating
> > it with utf8 as the default encoding, but that didn't help either. Any
> > ideas?
>
> hi,
>
> please give us the whole stacktrace, and the line of the code where this
> happens.
>
> generally, this might happen because you're trying to directly put
> unicode text into the database (i have no experience with mysql, so i
> can be wrong here). the various database-backends react differently to
> save-unicode-data (sqlite3 usually works ok, psycopg1 fails, psycopg2
> works etc.).
>
> so, before saving the data, convert it explicitly to byte-strings with a
> suitable charset (i assume you're using utf8).
>
> gabor

MySQL defaults to latin-1 encoding, though in version 5 you can specify
UTF-8. So as Gabor says, you have to convert explicitly to byte-strings
encoded so your db will accept them. From utf-8 to latin1:

def utf8tolatin1(s):
return s.decode('utf-8', 'ignore').encode('latin1',
'xmlcharrefreplace')

In [8]: u'\u2014'.encode('utf-8')
Out[8]: '\xe2\x80\x94'

In [9]: utf8tolatin1('\xe2\x80\x94')
Out[9]: ''

Also see:
http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

-- Wade Leftwich
Ithaca, NY


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Why 404?

2006-08-08 Thread Jarek Zgoda

Steven Armstrong wrote:

> Don't know if this is related to your problem, but if you're using
> sqlite the patch at [1] may help.
>
> If this does solve your problem, and you have a moment, you could add
> some more background info about the bug to that ticket and confirm that
> the patch worked. I was in a rush when I created it and haven't yet
> taken time to add some more info for the devs.

This patch didn't solve my problem, I see no difference in behaviour.

The object with date field value of 2006-08-07 definitely exists (it is
listed in month view), but trying to make a view of objects at URL
2006/08/07/ results in empty list, thus 404 if allow_empty == False. My
urlconf contains entry for
^(?P\d{4})/(?P\d{2})/(?P\d{2})/$, so above given URL
should add items 'year': '2006', 'month': '08', 'day': '07' to generic
view call arguments list. Month format is already '%m', day format is
default. It seems that SQLite3 database contains character value of
'2006-08-07' in this field.

Will try with MySQL, although it's a bit of overkill to me.

Cheers
Jarek Zgoda


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread John Sutherland

Hi Anton,

You may need to add the Meta class in too:

mycompany/models.py:
from django.db import models
class Subnet(models.Model):
field = models.CharField(maxlength=255)
...

class Admin:
pass

class Meta:
app_label = 'administration'

And then in your mycompany/.../administration/models.py:
from mycompany.models import *
# Add some comment about app_label.

Good luck, John.

PS. There's not much in the way of documentation for app_label.


On 8/8/06, ak <[EMAIL PROTECTED]> wrote:
>
> Malcolm, my models are imported into application,models and do have
> Admin inner class. Take a look:
> 1. Model:
> $ cat subnet.py
> # -*- coding: windows-1251 -*-
>
> from django.db import models
>
> class Subnet(models.Model):
> address = models.IPAddressField()
> mask = models.IPAddressField()
>
> class Meta:
> db_table = 'subnets'
>
>
> def __str__(self):
> return self.address + "/" + self.mask
>
>
> class Admin:
> pass
>
> 2. application.models:
> $ cat models.py
> from django.db import models
>
> # Create your models here.
> from mycompany.models import Subnet
>
>
> >
>


-- 
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Why 404?

2006-08-08 Thread Jarek Zgoda

Jay Parlar wrote:

> > I had a similar problem (not seeing the records I just inserted into
> > database - actually they were the only one) because I left the
> > timezone variable set to "America/Chicago" and i live in Europe (and
> > my timezone is Chicago + 8). So the date filter considered all the
> > records 'in the future'.
>
> Note that 'allow_future' is now a valid argument to those generic views.
>
> My guess though is that Steven is right: SQLite is causing your
> problem. I was having the exact same issue the other day (archive_day
> wasn't working) and a switch to MySQL fixed it.

Thank you all. My timezone is set to my current TZ (Europe/Warsaw).
Setting allow_future = True has no effect, but I'll try with other
database backend.

I was wondering if the time part of datetime object may have any impact
on this (some databases insert '00:00:00' as the time part for dates
only, other insert current time), but looking at data from sqlite
interactive client I see '2006-08-07 00:00:00'.

Anyway, thanks for advice.

Cheers
Jarek Zgoda


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Invalid character error using Oracle backed

2006-08-08 Thread Bill de hÓra

Malcolm Tredinnick wrote:

> For now, if you want to hack on the source for your initial
> testing/debugging, have a look in django/core/management.py around line
> 206. There's a line that says
> 
> r_name = '%s_refs_%s_%x' % (r_col, col, abs(hash((r_table,
> table
> 
> (it's the only place we use hash() in the code in that file, so search
> for that word). Change this to anything you like that will make your
> backend happy. That will tide you over until we can get a more
> reasonable solution in place.

Being able to read the DATABASE_ENGINE from management.py would help. 
Can it be picked by importing django.conf.settings, or is there some 
other thing you need to do?

cheers
Bill


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread ak

Malcolm, my models are imported into application,models and do have
Admin inner class. Take a look:
1. Model:
$ cat subnet.py
# -*- coding: windows-1251 -*-

from django.db import models

class Subnet(models.Model):
address = models.IPAddressField()
mask = models.IPAddressField()

class Meta:
db_table = 'subnets'


def __str__(self):
return self.address + "/" + self.mask


class Admin:
pass

2. application.models:
$ cat models.py
from django.db import models

# Create your models here.
from mycompany.models import Subnet


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread Malcolm Tredinnick

On Tue, 2006-08-08 at 00:37 -0700, ak wrote:
> Hello guys
> 
> Today I discovered a strange problem which may be caused by my
> misunderstanding or by a bug in django and i would like to shed some
> light on it with your help.

I think you are misunderstanding how the admin application interacts
with models.

Whether or not a model shows up in the administration interface is
*soley* determined by whether it has an inner Admin class on the model
definition. You don't need to write a separate application or anything
like that to control the admin appearance -- it's a property of the
model. For example:

class FirstModel(models.Model):
   # ... (field definitions) ...

class SecondModel(models.Model):
   # ... (field definitions) ...

   class Admin:
  pass # add options here if you like

The second model will appear in the admin interface. The first one will
not (because it does not have an Admin class).

[...]
> So is it possible to use classes defined outside application/models.py
> in application's admin ?

Not unless they are imported into application.models and have their own
Admin inner class.

Regards,
Malcolm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: MySQL UnicodeEncodeError

2006-08-08 Thread Gábor Farkas

Niran Babalola wrote:
> I've been developing a Django application using SQLite, and now I'm
> trying to move over to MySQL and actually launch the site. The
> application is storing data from RSS/Atom feeds using Universal Feed
> Parser, which uses unicode strings for all its data. When I try to
> store information from a feed into my MySQL database, I get the
> following error:
> 
> "UnicodeEncodeError: 'latin-1' codec can't encode characters in
> position 75-76: ordinal not in range(256)"
> 
> Everything worked fine with SQLite, but I haven't been able to get past
> this problem with MySQL. I tried dropping the database and recreating
> it with utf8 as the default encoding, but that didn't help either. Any
> ideas?

hi,

please give us the whole stacktrace, and the line of the code where this 
happens.

generally, this might happen because you're trying to directly put 
unicode text into the database (i have no experience with mysql, so i 
can be wrong here). the various database-backends react differently to 
save-unicode-data (sqlite3 usually works ok, psycopg1 fails, psycopg2 
works etc.).

so, before saving the data, convert it explicitly to byte-strings with a 
suitable charset (i assume you're using utf8).

gabor

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Using custom forms with generic views

2006-08-08 Thread Ian Holsman
another alternative you may want to consider is to piggybak ontop of  the generic viewhave a look at http://svn.zyons.python-hosting.com/trunk/zilbo/common/utils/views/create_update.py for a examplewhich adds a 'change_user' and 'last_change' fieldseg.    if request.POST:        new_data = request.POST.copy()        now = datetime.datetime.today()        new_data['last_change_user_id'] = str(request.user.id)        new_data['last_change_user'] = new_data['last_change_user_id']        new_data['last_change_date'] = now.strftime('%Y-%m-%d')        new_data['last_change_time'] = now.strftime('%H:%M:%S')        new_data['create_user_id'] = new_data['last_change_user_id']        new_data['create_user'] = new_data['last_change_user_id']        new_data['creation_date_date'] = now.strftime('%Y-%m-%d')        new_data['creation_date_time'] = now.strftime('%H:%M:%S')        request._post = new_data    return create_object(request,                  model,                  template_name,                 template_loader, extra_context,                 post_save_redirect, login_required, follow)so in your case I would handle the 'tag' field here, and split it into multiple fields which the normal changemanipulator can handle.and it uses all the goodness of the generic update, without me having to duplicate the code.regardsIanOn 08/08/2006, at 2:45 AM, jeffmikels wrote:Thanks for your help. I ended up creating a view to do the work. If thedata is simple enough and just plain text, is there a compelling reasonto use AddManipulator or other manipulators instead of justobject.save()? --Ian Holsman[EMAIL PROTECTED]http://peopleintopoker.com/ -- where the poker people go 
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django users" group.  To post to this group, send email to django-users@googlegroups.com  To unsubscribe from this group, send email to [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/django-users  -~--~~~~--~~--~--~---



Re: Using custom forms with generic views

2006-08-08 Thread Gábor Farkas

jeffmikels wrote:
> Thanks for your help. I ended up creating a view to do the work. If the
> data is simple enough and just plain text, is there a compelling reason
> to use AddManipulator or other manipulators instead of just
> object.save()?
> 
> 

hi,

for example, if you want to validate that data (and more importantly, 
display a form with the error messages if something does not validate), 
then it's much easier to do using the manipulator/formwrapper mechanism.

gabor

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Admin interface for DB model classes defined outside application doesn't work ?

2006-08-08 Thread ak

Hello guys

Today I discovered a strange problem which may be caused by my
misunderstanding or by a bug in django and i would like to shed some
light on it with your help.

I have models package `mycompany.models` where are defined all the
models for all our apps. Same classes are used in a few applications.
Django ORM lets us to define model classes anywhere we want and works
with them fine and we created a lot of command line scripts using it.

Now i want to use default admin functionality. I created a new project
"adminpanel" where I added a new application "administration" and I
would like to put there management of all base tables. I thought I can
do in `administration/models.py` something like:

from django.db import models
# Create your models here.
from mycompany.models import Myclass1
# ... etc

and then see all imported classes in admin interface but I see just
nothing. When i put in models.py a copy of class code I see it working
in admin.

So is it possible to use classes defined outside application/models.py
in application's admin ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Contacts application

2006-08-08 Thread Rares Vernica

Hi,

Do you know anybody trying a Contacts/Phonebook type of application in 
Django? I am thinking about building one.

Thanks a lot,
Ray


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---