Re: how are you handling i18n and m10l content?

2006-11-09 Thread Carlos Yoder

> David Bleweet said:
>> Actually this could be integrated into the core.
>> When you create a model, you could add translatable=True to fields
>> that have to be in the language-specific table.
>> When you make selections, you would need to set the language name in
>> the following or a similar way:
>> MyModel.objects.by_language("EN").all()
>> MyModel.objects.by_language("EN").order_by('title')
>> which would form queries like:
>> SELECT * FROM myapp_mymodel INNER JOIN myapp_mymodel_translatable ON
>> myapp_mymodel.id = myapp_mymodel_translatable.id ORDER BY title
>
> What about using generic relations for this? You could have something
> like this:
>
> class I18NText(models.Model):
> language = models.ForeignKey(Language)
> field = models.CharField(maxlength=25)
> translated_text = models.TextField()
>
> content_type = models.ForeignKey(ContentType)
> object_id = models.PositiveIntegerField()
> translated_object = models.GenericForeignKey()
>
> def __str__(self):
> return self.translated_text
>
> class ModelNeedingTranslation(models.Model):
> foo = models.IntegerField()
> bar = models.TextField()
>
> translations = models.GenericRelation(I18NText)
>
> Then you can add translations of field(s) by doing:
> a = ModelNeedingTranslation(1, 'nothing')
> a.translations.create(field='bar', translated_text='nada',
> language=Language('Spanish'))
>
> You can get the text for a specific translation like this:
> a.translations.filter(field='bar', language=Language('Spanish'))

:-O

Would it be really that simple?

-- 
Carlos Yoder
http://blog.argentinaslovenia.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?hl=en
-~--~~~~--~~--~--~---



Re: how are you handling i18n and m10l content?

2006-11-09 Thread Carlos Yoder

> > Aidas Bendoraitis wrote:
> >> MyModel.objects.by_language("EN").all()
> >> MyModel.objects.by_language("EN").order_by('title')
> >
> > I think this would be greate.
>
> sensational is the word ;-)
>

Now we just need to get one of the Django-savvy developers to
implement it, since I'm sure they don't have anything else to do :-)

Now seriously, this would be fantastic. I'm in no position to help
with code (I started one of the reference threads, asking for help),
so I can only hope and cross my fingers for some guy(s) with with
enough time and skills will bite the bullet and start coding.

And now I read what I wrote. Enough time *and* skills? That could be tricky ;-)

Cheers,

-- 
Carlos Yoder
http://blog.argentinaslovenia.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?hl=en
-~--~~~~--~~--~--~---



Re: How would you do this on Django?

2006-11-06 Thread Carlos Yoder

Thank you Frankie.

I guess I'm OK with the i18n part of the idea. Not so sure about the
'best practises' to implement, though (that was the general idea of
this post).

But many thanks for the links anyway. Regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


>> Hello people, I have a question for you.
>>
>> I've been developing (in my head) a multilang, multisite, multiuser
>> blog application, that -at least for me- sounds like a very cool idea.
>> On to the details:
>>
>> The project is actually a group of sister websites dealing with a
>> common subject, localised for different languages/cultures. It's
>> centered around the old "you learn a thing a day" saying, so Authors
>> would be able to post the thing they learned that day on a -usually
>> small- post. Of course, they would have to be able to post in many
>> different languages (initially either English, Slovenian or Spanish).
>>
>> As to URLs, I'd need to support at least the following three schemes:
>>
>>  * Language codes mapped to directories (http://maindomain.com/en/ and
> > http://maindomain.com/sl/ and  http://maindomain.com/es/)
> >  * Language codes mapped to subdomains (http://en.maindomain.com/ and
> > http://sl.maindomain.com/ and http://es.maindomain.com)
> >  * Completely different starting URLs (http://athingaday.com/ and
> > http://nekajnovega.com and httpd://algonuevo.com/
> >
> > As to the post themselves, each different version would have to be
> > aware of its 'sister' posts in other languages, but that's already a
> > template thing I believe.
> >
> > It goes without saying that these multiple localised versions would
> > have to get data off a single database.
> >
> > OK, enough details for now, we all have work to do :-)
> >
> > Anyway, I thought about the "sites" app on Django, but never used it
> > and I'm at a loss. I must admit I first too a look at Polyglot, a
> > plugin for Wordpress, but I really want to stay away from PHP and do
> > things right.
> >
> > Could anyone help me a bit on how to approach this? Thanks a million,
> > and best regards,
>
> I personally know nothing about this. But I will give you some links
> to get started (in order of importance):
>
> http://www.djangoproject.com/documentation/i18n/
> http://trac.studioquattro.biz/djangoutils/wiki/TranslationService
> http://trac.studioquattro.biz/djangoutils
>
> That might give you a some general ideas.
>
> --
> http://grimboy.co.uk
>

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



How would you do this on Django?

2006-11-06 Thread Carlos Yoder

Hello people, I have a question for you.

I've been developing (in my head) a multilang, multisite, multiuser
blog application, that -at least for me- sounds like a very cool idea.
On to the details:

The project is actually a group of sister websites dealing with a
common subject, localised for different languages/cultures. It's
centered around the old "you learn a thing a day" saying, so Authors
would be able to post the thing they learned that day on a -usually
small- post. Of course, they would have to be able to post in many
different languages (initially either English, Slovenian or Spanish).

As to URLs, I'd need to support at least the following three schemes:

 * Language codes mapped to directories (http://maindomain.com/en/ and
http://maindomain.com/sl/ and  http://maindomain.com/es/)
 * Language codes mapped to subdomains (http://en.maindomain.com/ and
http://sl.maindomain.com/ and http://es.maindomain.com)
 * Completely different starting URLs (http://athingaday.com/ and
http://nekajnovega.com and httpd://algonuevo.com/

As to the post themselves, each different version would have to be
aware of its 'sister' posts in other languages, but that's already a
template thing I believe.

It goes without saying that these multiple localised versions would
have to get data off a single database.

OK, enough details for now, we all have work to do :-)

Anyway, I thought about the "sites" app on Django, but never used it
and I'm at a loss. I must admit I first too a look at Polyglot, a
plugin for Wordpress, but I really want to stay away from PHP and do
things right.

Could anyone help me a bit on how to approach this? Thanks a million,
and best regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.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?hl=en
-~--~~~~--~~--~--~---



Re: ado_mssql introspection patch

2006-10-27 Thread Carlos Yoder

Sean,

Good news!

I major blunder on my side. I was updating from SVN all the time, but
happily ignoring that install, since Python was 'seeing' and old stale
egg on site-packages. I removed everything, and svn'd from tunk
directly on site-packages, and voila. =)

Now I have a different problem, which I believe it could be a bug.
When inspecting my DB, which has a table called 'ADMIN', the indexing
part fails, with the following:

class Admin(models.Model):
Traceback (most recent call last):
  File "D:\dev\eclipse\eclipse_workspace\ceneje\manage.py", line 11, in ?
execute_manager(settings)
  File "D:\dev\Python23\lib\site-packages\django\core\management.py", line 1445,
 in execute_manager
execute_from_command_line(action_mapping, argv)
  File "D:\dev\Python23\lib\site-packages\django\core\management.py", line 1356,
 in execute_from_command_line
for line in action_mapping[action]():
  File "D:\dev\Python23\lib\site-packages\django\core\management.py", line 764,
in inspectdb
indexes = introspection_module.get_indexes(cursor, table_name)
  File "D:\dev\Python23\lib\site-packages\django\db\backends\ado_mssql\introspec
tion.py", line 97, in get_indexes
results.update(data)
AttributeError: keys

The first output line is class Admin(models.Model), and that should
point towards the fact that it could be a reserved name collision of
some sort. I'll try with a different test database, and also
temporarily renaming that ADMIN table, etc.

Thanks a lot! I'll keep you posted,

Carlos

On 10/27/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> OK, if we can narrow the possibilities down to a patch mistake, I can
> tell you what I did:
>
> cywgin
> go to django src dir (the 'trunk' directory of svn)
> patch -p0 mssql_update5.diff
>
> no errors reported, and TortoiseSVN's icons changed on selected
> folders under 'trunk', to indicate code was altered. I took this as
> proof the patch has worked ... but honestly, my patching abilities are
> almost 0 (i just followed a tutorial, iirc).
>
> My I'll give it another go before bugging you again. Thanks a million!
>
> And yes I'm in continental Europe, so there's a big timezone gap between us.
>
> Best,
>
> On 10/26/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> >
> > Carlos,
> >
> > This error, "Error: 'inspectdb' isn't supported for the currently
> > selected database backend.", is usually thrown when the patch hasn't
> > been applied correctly.  Otherwise, you'd see a different error.  Look
> > at your \django\db\backends\ado_mssql\intropspection.py
> > file.  Does the logic in this file match the patch?  If you are not
> > sure, attach it to the email and I'll take a look at it.
> >
> > Sean
> >
> >
> > On 10/25/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > >
> > > OK, here I go.
> > >
> > > I'm running the following, from my project's dir. Note: the SQL server
> > > is not local, I connect to it via a VPN, and testing it, it works OK,
> > > but who knows.
> > >
> > > D:\dev\eclipse\eclipse_workspace\ceneje>manage.py inspectdb
> > > # This is an auto-generated Django model module.
> > > # You'll have to do the following manually to clean this up:
> > > # * Rearrange models' order
> > > # * Make sure each model has one field with primary_key=True
> > > # Feel free to rename the models, but don't rename db_table values or 
> > > field name
> > > s.
> > > #
> > > # Also note: You'll have to insert the output of 'django-admin.py 
> > > sqlinitialdata
> > >  [appname]'
> > > # into your database.
> > >
> > > from django.db import models
> > >
> > > Error: 'inspectdb' isn't supported for the currently selected database 
> > > backend.
> > >
> > >
> > > My settings.py
> > >
> > > DATABASE_ENGINE = 'ado_mssql'
> > > DATABASE_NAME = 'obspm_testing'
> > > DATABASE_USER = '*'
> > > DATABASE_PASSWORD = '***'
> > > DATABASE_HOST = '192.169.5.8'
> > > DATABASE_PORT = '1433'
> > >
> > > Hope this sheds some light!
> > >
> > > Best regards and thank you.
> > >
> > > On 10/26/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > > > As soon as I get to the office I'll let you know... thanks for replying!
> > > >
> > > > > Hmm.  What's the exact error you are getting?  I'm running the code on
> > > > > 3 different boxes (2 Win XP Pro and 1 Windows Server 2003) against
> > > > > MSDE and SQL Server 2000 witho

Re: ado_mssql introspection patch

2006-10-26 Thread Carlos Yoder

Looks like both abc123 and myself are experiencing the same problem
(at least one of them). Since I'm running MSSQL2000, wouldn't this
rule out MSSQL2005 being the problem?

Carlos

On 10/26/06, abc123 <[EMAIL PROTECTED]> wrote:
>
> Sean De La Torre wrote:
> > Can you post the entire traceback?  I don't see this behavior with SQL
> > Server 2000 or MSDE.  I may have to get a copy of SQL Server 2005.
>
> I can, the full traceback is rather long:
>
> E:\test>python manage.py syncdb
[snip snip snip]
-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: ado_mssql introspection patch

2006-10-26 Thread Carlos Yoder
hon23\lib\site-packages\adodbapi\adodbapi.py", line 539, in e
xecuteHelper
raise DatabaseError(e)
 DatabaseError: (-2147352567, 'Exception occurred.', (0, 'ADODB.Parameters', 'It
em cannot be found in the collection corresponding to the requested name or ordi
nal.', 'C:\\WINNT\\HELP\\ADO270.CHM', 1240649, -2146825023), None)


---
Strategy 4: Traceback:Traceback (most recent call last):
   File "D:\dev\Python23\lib\site-packages\adodbapi\adodbapi.py", line 540, in e
xecuteHelper
adoRetVal=self.cmd.Execute()
   File "", line 3, in Execute
   File "D:\dev\Python23\lib\site-packages\win32com\client\dynamic.py", line 258
, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes
) + args)
 com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB Provider
for SQL Server', "Line 1: Incorrect syntax near 's'.", None, 0, -2147217900), No
ne)

--- ADODBAPI on command:SELECT [Filters].[idFilters],[Filters].[idKategorije],[F
ilters].[filterName],[Filters].[filterType],[Filters].[filterDesc] FROM [Filters
] WHERE ([Filters].[idFilters] = %s) with parameters: [19]
>>>

Checking it with SQL Profiler, I see where the error lies:

SELECT 
[Filters].[idFilters],[Filters].[idKategorije],[Filters].[filterName],[Filters].[filterType],[Filters].[filterDesc]
FROM [Filters] WHERE ([Filters].[idFilters] = %s)

In this query, %s is not being interpolated to my requested value ("19").

Sorry for the long, ugly pastes. Hope this helps you helping us :-)

Regards,

Carlos



> OK, here I go.
>
> I'm running the following, from my project's dir. Note: the SQL server
> is not local, I connect to it via a VPN, and testing it, it works OK,
> but who knows.
>
> D:\dev\eclipse\eclipse_workspace\ceneje>manage.py inspectdb
> # This is an auto-generated Django model module.
> # You'll have to do the following manually to clean this up:
> # * Rearrange models' order
> # * Make sure each model has one field with primary_key=True
> # Feel free to rename the models, but don't rename db_table values or field 
> name
> s.
> #
> # Also note: You'll have to insert the output of 'django-admin.py 
> sqlinitialdata
>  [appname]'
> # into your database.
>
> from django.db import models
>
> Error: 'inspectdb' isn't supported for the currently selected database 
> backend.
>
>
> My settings.py
>
> DATABASE_ENGINE = 'ado_mssql'
> DATABASE_NAME = 'obspm_testing'
> DATABASE_USER = '*'
> DATABASE_PASSWORD = '***'
> DATABASE_HOST = '192.169.5.8'
> DATABASE_PORT = '1433'
>
> Hope this sheds some light!
>
> Best regards and thank you.
>
> On 10/26/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > As soon as I get to the office I'll let you know... thanks for replying!
> >
> > > Hmm.  What's the exact error you are getting?  I'm running the code on
> > > 3 different boxes (2 Win XP Pro and 1 Windows Server 2003) against
> > > MSDE and SQL Server 2000 without issues.  What system and server are
> > > you using?
> > >
> > > You should be able to use either manage.py in the project directory or
> > > django-admin.py in the directory below the project directory.
> > > Remember to run django-admin.py with the --settings option so it knows
> > > where to look for your settings file.
> > >
> > > Sean

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: ado_mssql introspection patch

2006-10-25 Thread Carlos Yoder

As soon as I get to the office I'll let you know... thanks for replying!

> Hmm.  What's the exact error you are getting?  I'm running the code on
> 3 different boxes (2 Win XP Pro and 1 Windows Server 2003) against
> MSDE and SQL Server 2000 without issues.  What system and server are
> you using?
>
> You should be able to use either manage.py in the project directory or
> django-admin.py in the directory below the project directory.
> Remember to run django-admin.py with the --settings option so it knows
> where to look for your settings file.
>
> Sean

-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: ado_mssql introspection patch

2006-10-25 Thread Carlos Yoder

I'm afraid I already applied that patch. Actually I tried many
combinations but no luck.

I'm running (from the project's directory, where settings.py is)
"manage.py inspectdb". Maybe that's the problem, and I must absolutely
run it from django-admin.py ?

I admin this just crossed my mind, when i'm already at home and rested
;-) Thanks a million,

Carlos

On 10/25/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> Take a look at this ticket: http://code.djangoproject.com/ticket/2358.
>
> I combined that previous patch (2563) with 2358 because my patch was
> dependent on it.  Make sure that you've applied the latest patch
> (mssql_update5.diff) to your Django installation.  If you still have
> problems, please let me know.
>
> On 10/25/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> > Take a look at this ticket: http://code.djangoproject.com/ticket/2358.
> >
> > I combined that previous patch (2563) with 2358 because my patch was
> > dependent on it.  Make sure that you've applied the latest patch
> > (mssql_update5.diff) to your Django installation.  If you still have
> > problems, please let me know.
> >
> > Sean
> >
> > On 10/25/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > > Hey Sean, I'm trying to give this a go. Running into walls, I'm  afraid.
> > >
> > > I read 'introspection' and thought this patched "manage.py inspectdb"
> > > to handle mssql servers. Unless I did something wrong (very possible),
> > > that doesn't seem to work.
> > >
> > > Could you explain how do I get to the 'full instrospection' part? :-)
> > > Thanks a lot,
> > >
> > > Carlos
> > >
> > > On 8/26/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> > > > Sorry for the double-post :)
> > > >
> > > >
> > > > On 8/25/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > I've posted a patch that adds full introspection functionality for
> > > > > ado_mssql backends
> > > > (http://code.djangoproject.com/ticket/2563).  I'd
> > > > > appreciate it if those of you who run Django/mssql could test it out
> > > > > and let me know if any problems are found.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Sean
> > > > >
> > > > > * Note: the patch relies on the changes in
> > > > > http://code.djangoproject.com/ticket/2358
> > > > >
> > > > >
> > > > >
> > > > > > > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > Carlos Yoder
> > > http://blog.argentinaslovenia.com/
> > >
> >
>


-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: ado_mssql introspection patch

2006-10-25 Thread Carlos Yoder

Hey Sean, I'm trying to give this a go. Running into walls, I'm  afraid.

I read 'introspection' and thought this patched "manage.py inspectdb"
to handle mssql servers. Unless I did something wrong (very possible),
that doesn't seem to work.

Could you explain how do I get to the 'full instrospection' part? :-)
Thanks a lot,

Carlos

On 8/26/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> Sorry for the double-post :)
>
>
> On 8/25/06, Sean De La Torre <[EMAIL PROTECTED]> wrote:
> >
> > I've posted a patch that adds full introspection functionality for
> > ado_mssql backends
> (http://code.djangoproject.com/ticket/2563).  I'd
> > appreciate it if those of you who run Django/mssql could test it out
> > and let me know if any problems are found.
> >
> > Thanks,
> >
> > Sean
> >
> > * Note: the patch relies on the changes in
> > http://code.djangoproject.com/ticket/2358
> >
> >
> >
> > > >
> >
>


-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: Migrating from ASP.NET to Django?

2006-10-23 Thread Carlos Yoder

Julio,

>   Sure there is hope.
>
>   I haven't found any website that couldn't be made with Django. After
> all, it's about HTTP communication. There are even two websites that
> deal with price comparison in the wiki
> (http://code.djangoproject.com/wiki/DjangoPoweredSites):
>
>   http://www.gutata.com/ and http://niftylist.co.uk/

Thanks for those, I had missed them.

> But I believe none can answer your question besides yourself. Are
> you sure you can code in Python this C# specific code that you have?
> Does your database serves others apps which you'll have to modify? And
> what's a small website or a large one? I've seen Django powering
> social networks with more than one million members, but what's the
> load? Does it use cache? Does the DBA knows what she do?

All interesting and meaningful questions that I'm trying to answer
myself. Over the weekend I fetched all our C# code from SVN, and
started the 'migration', so to speak, to my Kubuntu laptop. As I
thought, the biggest monster to tackle would be the database. A 6GB+
behemoth of MSSQL2K goodies is not something you could call a piece of
cake. But the experience of removing so much cruft from the
'templates' (or aspx files) was almost rapturous.

I'm more and more convinced I can do with the Python code for the
views and such, but the database would have to remain in place as it
is: hundreds of stored procedures, a huge, mission-critical DTS
process running every day, etc preclude me from going the
fundamentalist way and migrate everything away to Postgres :-)

Say, if I can successfully introspect my DB into Django models (as
much as possible, I don't expect magic here), I could technically use
Django just for the Front End's views, right? (initially I'd keep our
own admin, since it's the primary interface for our dataentry people).

What do you people say? How would Django running on Windows/IIS6 (now
it's possible, I hear), talking to a MSSQL database, and being used
'just' for the frontend's views sound to you? =)

>   If you're confident you can do whatever you do in Django, I say go for it.

That's the thing -- I'm getting very hooked on Django and by
extension, Python. It just makes too much sense to let it go. Myself I
started coding webpages by hand back in '96, with CGI (bash), Perl,
PHP, and then ASP (because of market share), and finally I've been
forced to work in ASP.NET for the last 3 years or so. Don't get me
wrong, I prefer C# over VBScript any day, but I was longing for the
same feeling I got when I first got a whiff of Perl back in the day --
and Python did *just* that.

Anyways, thanks for everything, obrigado, etc. Best regards,
-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Migrating from ASP.NET to Django?

2006-10-20 Thread Carlos Yoder

Hello folks,

I have this idea in my head going for a lng time now. Since I
already deployed my first Django app and everybody's happy (especially
me), I'm getting excited about migrating my main project to Django.

First of all, it's a not a small site, so planning is of the absolute
essence (we do price comparisons for a big catalogue of products).

Has anybody tried to tackle this yet? At all? It's the whole deal:
MSSQL database (I know, I know), IIS6+, C#, a lot of very specific
code, etc.

Is there hope, doctor?

-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

Patrick, thanks for your reply.

I had actually tried similar methods to what you wrote -- the trouble
was with using the default Manipulators, since they need the passed
request collection to have the proper names, and since I was
"injecting" my PK via a template, the trouble was there... no idea why
this was not triggered in my local environment (maybe Sqlite is not as
picky ;-)

Regards and thanks again,

Carlos

On 10/6/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> don´t know if this might help, but:
>
> let´s say you have this in your manipulator:
>
>  def save(self, data):
>  temp = UserExtendedProfile(
>  user = data['user'],
> 
>  )
>  temp.save()
>
> you could also use this:
>
>  def save(self, data):
>  temp = UserExtendedProfile(
>  user_id = data['user_id'],
> 
>  )
>  temp.save()
>
> so, depending on which version you choose ... your view could look
> like this:
>
> new_data = request.POST.copy()
> new_data['user'] = request.user
> errors = manipulator.get_validation_errors(new_data)
>
> or this:
>
> new_data = request.POST.copy()
> new_data['user_id'] = request.user.id
>     errors = manipulator.get_validation_errors(new_data)
>
> patrick.
>
>
>
> Am 06.10.2006 um 09:04 schrieb Carlos Yoder:
>
> >
> > Here you go Gábor, it's three views. my_data(request) find out what to
> > do (change or add), and calls the proper view, either userprofile_add
> > or userprofile_change.
> >
> > Hope the python code is not too ugly!
> >
> > Thanks a million for taking the time to help, köszönöm szépen!
> >
> >
> > def my_data(request):
> > """ allow a logged user to change his data. proxy view that
> > calls proper views (add or change) """
> >
> > if request.user.is_anonymous():
> > return redirect_to_login(request.path)
> >
> > u = User.objects.get(pk=request.user.id)
> > try:
> > up = u.userprofile # trigger exception, if not found
> > return userprofile_change(request, u.id)
> > except UserProfile.DoesNotExist:
> > return userprofile_add(request)
> >
> > def userprofile_add(request):
> > """ Handle adding new userprofiles (one2one rel to User
> > objects) """
> >
> > from django import forms
> >
> > manipulator = UserProfile.AddManipulator()
> >
> > if request.POST:
> > # If data was POSTed, we're trying to create a new
> > UserProfile.
> > new_data = request.POST.copy()
> > user_id = request.user.id
> >
> > # Check for errors.
> > errors = manipulator.get_validation_errors(new_data)
> >
> > if not errors:
> > # No errors. This means we can save the data!
> > manipulator.do_html2python(new_data)
> > if new_data['user_id']:
> > pass
> > else:
> > new_data['user_id'] = user_id
> > new_userprofile = manipulator.save(new_data)
> >
> > # Redirect to the object's "edit" page. Always
> > use a redirect
> > # after POST data, so that reloads don't
> > accidently create
> > # duplicate entires, and so users don't see
> > the confusing
> > # "Repost POST data?" alert box in their
> > browsers.
> > return HttpResponseRedirect("/my_data/")
> > else:
> > # No POST, so we want a brand new form without any
> > data or errors.
> > errors = new_data = {}
> >
> > # Create the FormWrapper, template, context, response.
> > form = forms.FormWrapper(manipulator, new_data, errors)
> >
> > rc = RequestContext(request, {
> > 'form': form,
> > })
> > return render_to_response('userprofile.html', rc)
> >
> >
> > def userprofile_change(request, userprofile_id):
> > """ Handle editing userprofiles (one2one rel to User
> > objects) """
> > f

Re: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

ATTENTION ATTENTION ATTENTION!

I fixed it!

Brownie points to Raj for pointing to the right direction, so boys and
girls, when you're trying to pass a PK (such as user.id for a OneToOne
field exntending the User model) via a form, make sure you do it as
follows:



and NOT something like:



... because it won't work, and you'll get all sorts of crazy errors.
Trust me, I've been there!

Thanks all, and once again, the Django community rocks!


-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


> Here you go Gábor, it's three views. my_data(request) find out what to
> do (change or add), and calls the proper view, either userprofile_add
> or userprofile_change.
>
> Hope the python code is not too ugly!
>
> Thanks a million for taking the time to help, köszönöm szépen!
>
>
> def my_data(request):
> """ allow a logged user to change his data. proxy view that
> calls proper views (add or change) """
>
> if request.user.is_anonymous():
> return redirect_to_login(request.path)
>
> u = User.objects.get(pk=request.user.id)
> try:
> up = u.userprofile # trigger exception, if not found
> return userprofile_change(request, u.id)
> except UserProfile.DoesNotExist:
> return userprofile_add(request)
>
> def userprofile_add(request):
> """ Handle adding new userprofiles (one2one rel to User objects) """
>
> from django import forms
>
> manipulator = UserProfile.AddManipulator()
>
> if request.POST:
> # If data was POSTed, we're trying to create a new 
> UserProfile.
> new_data = request.POST.copy()
> user_id = request.user.id
>
> # Check for errors.
> errors = manipulator.get_validation_errors(new_data)
>
> if not errors:
> # No errors. This means we can save the data!
> manipulator.do_html2python(new_data)
> if new_data['user_id']:
> pass
> else:
> new_data['user_id'] = user_id
> new_userprofile = manipulator.save(new_data)
>
> # Redirect to the object's "edit" page. Always
> use a redirect
> # after POST data, so that reloads don't
> accidently create
> # duplicate entires, and so users don't see
> the confusing
> # "Repost POST data?" alert box in their browsers.
> return HttpResponseRedirect("/my_data/")
> else:
> # No POST, so we want a brand new form without any
> data or errors.
> errors = new_data = {}
>
> # Create the FormWrapper, template, context, response.
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> })
> return render_to_response('userprofile.html', rc)
>
>
> def userprofile_change(request, userprofile_id):
> """ Handle editing userprofiles (one2one rel to User objects) """
> from django import forms
>
> from django.http import Http404
>
> try:
> manipulator = UserProfile.ChangeManipulator(userprofile_id)
> except UserProfile.DoesNotExist:
> raise Http404
>
> # Grab the  object in question for future use.
> userprofile = manipulator.original_object
>
> if request.POST:
> new_data = request.POST.copy()
> errors = manipulator.get_validation_errors(new_data)
> if not errors:
> manipulator.do_html2python(new_data)
> manipulator.save(new_data)
> # Do a post-after-redirect so that reload works, etc.
> return HttpResponseRedirect("/my_data/")
> else:
> errors = {}
> # This makes sure the form accurately represents the
> fields of the object.
> new_data = manipulator.flatten_data()
>
> form = forms.FormWrapper(manipulator, new_data, errors)
>
> rc = RequestContext(request, {
> 'form': form,
> 'userprofile': userprofile,
> })
>
> return render_to_response('userprofile.html', rc)
>
> Best regards,
>
> --
> Car

Re: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

Here you go Gábor, it's three views. my_data(request) find out what to
do (change or add), and calls the proper view, either userprofile_add
or userprofile_change.

Hope the python code is not too ugly!

Thanks a million for taking the time to help, köszönöm szépen!


def my_data(request):
""" allow a logged user to change his data. proxy view that
calls proper views (add or change) """

if request.user.is_anonymous():
return redirect_to_login(request.path)

u = User.objects.get(pk=request.user.id)
try:
up = u.userprofile # trigger exception, if not found
return userprofile_change(request, u.id)
except UserProfile.DoesNotExist:
return userprofile_add(request)

def userprofile_add(request):
""" Handle adding new userprofiles (one2one rel to User objects) """

from django import forms

manipulator = UserProfile.AddManipulator()

if request.POST:
# If data was POSTed, we're trying to create a new UserProfile.
new_data = request.POST.copy()
user_id = request.user.id

# Check for errors.
errors = manipulator.get_validation_errors(new_data)

if not errors:
# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
if new_data['user_id']:
pass
else:
new_data['user_id'] = user_id
new_userprofile = manipulator.save(new_data)

# Redirect to the object's "edit" page. Always
use a redirect
# after POST data, so that reloads don't
accidently create
# duplicate entires, and so users don't see
the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/my_data/")
else:
# No POST, so we want a brand new form without any
data or errors.
errors = new_data = {}

# Create the FormWrapper, template, context, response.
form = forms.FormWrapper(manipulator, new_data, errors)

rc = RequestContext(request, {
'form': form,
})
return render_to_response('userprofile.html', rc)


def userprofile_change(request, userprofile_id):
""" Handle editing userprofiles (one2one rel to User objects) """
from django import forms

from django.http import Http404

try:
manipulator = UserProfile.ChangeManipulator(userprofile_id)
except UserProfile.DoesNotExist:
raise Http404

# Grab the  object in question for future use.
userprofile = manipulator.original_object

if request.POST:
new_data = request.POST.copy()
errors = manipulator.get_validation_errors(new_data)
if not errors:
manipulator.do_html2python(new_data)
manipulator.save(new_data)
# Do a post-after-redirect so that reload works, etc.
return HttpResponseRedirect("/my_data/")
else:
errors = {}
# This makes sure the form accurately represents the
fields of the object.
new_data = manipulator.flatten_data()

form = forms.FormWrapper(manipulator, new_data, errors)

rc = RequestContext(request, {
'form': form,
    'userprofile': userprofile,
})

    return render_to_response('userprofile.html', rc)

Best regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


> Carlos Yoder wrote:
> > I'm really sorry to bug you like this, but I don't know what to do --
> > being a newbie to both Python and Django, debugging for me is more
> > like 'aha, the problem should be around here', but nothing concrete
> > about fixing!
> >
>
> hi,
>
> could you also post your view code?
>
> 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: Manipulators problem -- anyone? please help!

2006-10-06 Thread Carlos Yoder

Raj,

thanks a lot for your reply! It really *is* a tight situation,
especially since I can only reproduce the error at Bluehost... so
debugging is not simple, and definitely not fast.

I believe the user field used to be called "user" first, and later I
changed to user_id or something, but honestly I'm now sending the
'user' value from request.user's context.

As to changing to a ChangeManipulator, that'd solve part of the
problem only, no? In any case, it's another thing to try out.

Thanks a million, again!

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/


On 10/5/06, RajeshD <[EMAIL PROTECTED]> wrote:
>
> Disclaimer: I may be totally off the track here but seeing your
> desperate plea, I thought I would share this anyway:
>
> AddManipulator is probably discarding your primary key coming from the
> POST. The user field, in your case, serves as a primary key (since it
> is defined as a OneToOneField). Try ChangeManipulator and see if that
> improves the situation.
>
> Also, I am not sure if the field name should be user_id or user. So,
> try changing it to 'user'.
>
> Sorry, if this doesn't help.
>
> -Raj
>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Manipulators problem -- anyone? please help!

2006-10-05 Thread Carlos Yoder

I'm really sorry to bug you like this, but I don't know what to do --
being a newbie to both Python and Django, debugging for me is more
like 'aha, the problem should be around here', but nothing concrete
about fixing!

If anyone has the time to read this, please lend me a hand.

I know, I sound like Luke Skywalker on A New Hope, sorry about that!

Regards,

-- 
Carlos Yoder
http://blog.argentinaslovenia.com/

-- Forwarded message --
From: Carlos Yoder <[EMAIL PROTECTED]>
Date: Oct 5, 2006 10:19 AM
Subject: Manipulators problem
To: django-users@googlegroups.com


Hello djangoers.

This is related to my last post (cry for help would be more proper) on
an AddManipulator 'losing' a primary key's value.

I guess the problem's here (pasted from dynamic trace), on
django/db/models/manipulators.py in save (line 101):

auto_now_addFalse
f   
new_data  
new_object   
param  True
params  {'newsletter_email': '[EMAIL PROTECTED]',
'receive_modif_cars_newsletter': True,  'receive_new_cars_newsletter':
True,  'user_id': None}
self 

I hope you understand what I pasted. Let me clarify:

new_data is your typical MultiValueDict, and it HAS the user_id value
properly set (or so I believe). But something happens at the "params"
dict, since there 'user_id' is set to None, and naturally the creation
fails.

So I managed to get 'new_data' filled properly to the AddManipulator's
save method, but still a key field is lost.

What might I be doing wrong, I wonder? I repeat, this only happens on
my production server, on Bluehost with Linux+MySql. On my test/dev box
(windows+sqlite) it works without a hitch.

Here's the UserProfile model, for all it's worth:

class UserProfile(models.Model):
user = models.OneToOneField(User)
newsletter_email = models.EmailField("E-mail to send newsletters",
blank=False, null=False)
receive_new_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)
receive_new_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)
receive_modif_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)

def __str__(self):
try:
return ("%s" % self.user)
except:
return("")

I hope anyone can lend a hand... i'm running into more and more
walls...! THanks a million,

--
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Manipulators problem

2006-10-05 Thread Carlos Yoder

Hello djangoers.

This is related to my last post (cry for help would be more proper) on
an AddManipulator 'losing' a primary key's value.

I guess the problem's here (pasted from dynamic trace), on
django/db/models/manipulators.py in save (line 101):

auto_now_addFalse
f   
new_data  
new_object   
param  True
params  {'newsletter_email': '[EMAIL PROTECTED]',
'receive_modif_cars_newsletter': True,  'receive_new_cars_newsletter':
True,  'user_id': None}
self 

I hope you understand what I pasted. Let me clarify:

new_data is your typical MultiValueDict, and it HAS the user_id value
properly set (or so I believe). But something happens at the "params"
dict, since there 'user_id' is set to None, and naturally the creation
fails.

So I managed to get 'new_data' filled properly to the AddManipulator's
save method, but still a key field is lost.

What might I be doing wrong, I wonder? I repeat, this only happens on
my production server, on Bluehost with Linux+MySql. On my test/dev box
(windows+sqlite) it works without a hitch.

Here's the UserProfile model, for all it's worth:

class UserProfile(models.Model):
user = models.OneToOneField(User)   
newsletter_email = models.EmailField("E-mail to send newsletters",
blank=False, null=False)
receive_new_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)
receive_new_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)
receive_modif_cars_newsletter = models.BooleanField("Subscribed to
daily 'new cars' newsletter?", null=False, blank=False, default=True)

def __str__(self):
try:
return ("%s" % self.user)
except:
return("")

I hope anyone can lend a hand... i'm running into more and more
walls...! THanks a million,

-- 
Carlos Yoder
http://blog.argentinaslovenia.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
-~--~~~~--~~--~--~---



Re: Request data dissapearing after do_html2python

2006-10-04 Thread Carlos Yoder
Forgot to say, the model I'm  trying to create an object to has the user as a OneToOne relationship, which apparently MySQL does not like very much. Why? Because phpMyAdmin, when accessing the homepage for the model's datatable, says this:
PRIMARY and INDEX keys should not both be set for column `user_id`Does this run deeper than I thought?Thakns a million for your help,CarlosOn 10/4/06, 
Carlos Yoder <[EMAIL PROTECTED]> wrote:
Hello guys,I'm experiencing a weird thing. On my production setup, an OperationalError exception is being triggered while trying to invoke an AddManipulator.I've zeroed in down to this (excerpt of my view follows)
def userprofile_add(request):    """ Handle adding new userprofiles (one2one rel to User objects) """    from django import forms    manipulator = UserProfile.AddManipulator

()    if request.POST:        # If data was POSTed, we're trying to create a new UserProfile.        new_data = request.POST.copy()        # Check for errors.        errors = manipulator.get_validation_errors

(new_data)        if not errors:            # No errors. This means we can save the data!            manipulator.do_html2python(new_data)            new_userprofile = manipulator.save(new_data)

            # Redirect to the object's "edit" page. Always use a redirect            # after POST data, so that reloads don't accidently create            # duplicate entires, and so users don't see the confusing
            # "Repost POST data?" alert box in their browsers.            return HttpResponseRedirect("/my_data/")    else:        # No POST, so we want a brand new form without any data or errors.
        errors = new_data = {}As you can see, this is ver simple AddManipulator. For some reason my  request MultiValueDict has properly set a NOT NULL value I pass via a hidden HTML input field, but the new_data dict doesn't.  This field is the ubiquitous "user_id", that comes from 
request.user. As I said, it's properly passed from the form, and seen by request.POST... only new_data lacks it (it's set to None).So, this should be centered aroudn either request.POST.copy() or do_html2python(), right?
This is funny, since on my dev environment (sqlite+windows) everything runs smoothly. This error only occurs on the production environment, which is on Bluehost (mysql+Linux). Any ideas? I'm very very very close of finishing my first Django project, yay!
Best regards,-- Carlos Yoderhttp://blog.argentinaslovenia.com/


-- Carlos Yoderhttp://blog.argentinaslovenia.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  -~--~~~~--~~--~--~---


Request data dissapearing after do_html2python

2006-10-04 Thread Carlos Yoder
Hello guys,I'm experiencing a weird thing. On my production setup, an OperationalError exception is being triggered while trying to invoke an AddManipulator.I've zeroed in down to this (excerpt of my view follows)
def userprofile_add(request):    """ Handle adding new userprofiles (one2one rel to User objects) """    from django import forms    manipulator = UserProfile.AddManipulator
()    if request.POST:        # If data was POSTed, we're trying to create a new UserProfile.        new_data = request.POST.copy()        # Check for errors.        errors = manipulator.get_validation_errors
(new_data)        if not errors:            # No errors. This means we can save the data!            manipulator.do_html2python(new_data)            new_userprofile = manipulator.save(new_data)
            # Redirect to the object's "edit" page. Always use a redirect            # after POST data, so that reloads don't accidently create            # duplicate entires, and so users don't see the confusing
            # "Repost POST data?" alert box in their browsers.            return HttpResponseRedirect("/my_data/")    else:        # No POST, so we want a brand new form without any data or errors.
        errors = new_data = {}As you can see, this is ver simple AddManipulator. For some reason my  request MultiValueDict has properly set a NOT NULL value I pass via a hidden HTML input field, but the new_data dict doesn't.  This field is the ubiquitous "user_id", that comes from 
request.user. As I said, it's properly passed from the form, and seen by request.POST... only new_data lacks it (it's set to None).So, this should be centered aroudn either request.POST.copy() or do_html2python(), right?
This is funny, since on my dev environment (sqlite+windows) everything runs smoothly. This error only occurs on the production environment, which is on Bluehost (mysql+Linux). Any ideas? I'm very very very close of finishing my first Django project, yay!
Best regards,-- Carlos Yoderhttp://blog.argentinaslovenia.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  -~--~~~~--~~--~--~---


Re: Help with related objects

2006-10-03 Thread Carlos Yoder
Just FYI, I cracked it myself.Me gets smarter! =)If anyone googles for this and is in a similar situation, pls let me know.On 10/3/06, Carlos Yoder
 <[EMAIL PROTECTED]> wrote:
Hello all, I'm asking for help again, this time with related objects.I need to do what I think is a very simple task: allow users to edit their own preferences (using a custom 'admin' like interface).Their own preferences are located in an extension of the User model, as follows:
class UserProfile(models.Model):    user = models.ForeignKey (User, core=True, edit_inline=False, max_num_in_admin=1, min_num_in_admin=1, num_in_admin=1, num_extra_on_change=0, unique=True)    receive_new_cars_newsletter = 
models.BooleanField("Subscribed to daily 'new cars' newsletter?", null=False, blank=False, default=True)    receive_modif_cars_newsletter = models.BooleanField("Subscribed to daily 'new cars' newsletter?", null=False, blank=False, default=True)
        def __str__(self):        return ("%s" % self.user)    When users are created by the superadmin (via the normal Admin interface), these related fields are not populated, naturally. So, I'd have to present the users with default values for receive_new_cars_newsletter and receive_modif_cars_newsletter (only a checkbox, as it is), and allow them to set their values.
This is an excruciatingly easy thing to do, but still I can't find my way around generic views, forms, manipulators, related objects, the undocumented 'follow' and the rest of the pie. It's -of course- the first time I tackle this, so I want to do things right, but I'm honestly running out of time. 
I wanted to have a special URL such as /my_data/, that would display
the change form (the proper object_id being inferred from
request.user). That's why  I couldn't do it with generic views.
Could anyone point me into the right place (admin sources is OK) to have a look and borrow what's needed for this?BTW, everything works as expected from the shell, the interface is what I'm not getting. 

Thanks a million, and best regards-- Carlos Yoderhttp://carlitosyoder.blogspot.com


-- Carlos Yoderhttp://blog.argentinaslovenia.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  -~--~~~~--~~--~--~---


Help with related objects

2006-10-03 Thread Carlos Yoder
Hello all, I'm asking for help again, this time with related objects.I need to do what I think is a very simple task: allow users to edit their own preferences (using a custom 'admin' like interface).Their own preferences are located in an extension of the User model, as follows:
class UserProfile(models.Model):    user = models.ForeignKey (User, core=True, edit_inline=False, max_num_in_admin=1, min_num_in_admin=1, num_in_admin=1, num_extra_on_change=0, unique=True)    receive_new_cars_newsletter = 
models.BooleanField("Subscribed to daily 'new cars' newsletter?", null=False, blank=False, default=True)    receive_modif_cars_newsletter = models.BooleanField("Subscribed to daily 'new cars' newsletter?", null=False, blank=False, default=True)
        def __str__(self):        return ("%s" % self.user)    When users are created by the superadmin (via the normal Admin interface), these related fields are not populated, naturally. So, I'd have to present the users with default values for receive_new_cars_newsletter and receive_modif_cars_newsletter (only a checkbox, as it is), and allow them to set their values.
This is an excruciatingly easy thing to do, but still I can't find my way around generic views, forms, manipulators, related objects, the undocumented 'follow' and the rest of the pie. It's -of course- the first time I tackle this, so I want to do things right, but I'm honestly running out of time. 
I wanted to have a special URL such as /my_data/, that would display
the change form (the proper object_id being inferred from
request.user). That's why  I couldn't do it with generic views.
Could anyone point me into the right place (admin sources is OK) to have a look and borrow what's needed for this?BTW, everything works as expected from the shell, the interface is what I'm not getting. 
Thanks a million, and best regards-- Carlos Yoderhttp://carlitosyoder.blogspot.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  -~--~~~~--~~--~--~---


Re: Simple manipulator to 'reserve' an item?

2006-09-29 Thread Carlos Yoder
In lieu of using a manipulator for this simple task, you could use yourown HTML form. Have your form submit to a view method that grabs your
product's id/slug from the request.POST MultiValueDict and performs anupdate of your model as needed.Rajesh, thank you very much! I knew it was overkill. Namaskar,
-- Carlos Yoderhttp://carlitosyoder.blogspot.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  -~--~~~~--~~--~--~---


Simple manipulator to 'reserve' an item?

2006-09-29 Thread Carlos Yoder
Hello djangonauts!I'm facing the task of writing my first manipulator, and they look extremely cool -- (un)fortunately, my needs are extremely simple. I must allow users to 'reserve' a certain product, by just clicking on a button, which in turn would only need to modify a couple fields in the DB (who reserved it, and for how long, which is a default value anyway).
I already have a generic view handling the item page (using django.views.generic.list_detail.object_detail, of course) . What would be simplest way to get this working? I was reading the docs on Manipulators and Validators, and they seem fantastic -- but too much for this first little requirement.
Any help greatly appreciated. Best regards,-- Carlos Yoderhttp://carlitosyoder.blogspot.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  -~--~~~~--~~--~--~---


Re: Any good Python book recommendations?

2006-07-23 Thread Carlos Yoder

>> Any recommendations? I'm brand new to Python and want to learn for
>> use with Django.
> The "Learning Python" O'Reilly book is really, really good - one of
> the best "Learning X" books I've read for any language.


Even better than "Learnin Perl"? =)

(ducks)


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Django WORKS at Servage.net!

2006-07-20 Thread Carlos Yoder

Awake, Fear Fire Foes!

I finally made it! After hitting many walls with customer support at
Servage.net, I got Django runnning on their servers!

Following on the steps of Jeff Croft's excellent DreamHost tutorial, I
first installed Django on BlueHost (with a couple of modifications
that I'll have to write down and share), and later I bit the bullet
and went out to get Servage.net.

It runs OK, though with many restrictions:

 * FastCGI only
 * No shell access, so forget about anything related to manage.py
 * MySQL databases only

I'll definitely write the experience down and share it with the world
-- it just took too much effort NOT to do it (imagine all sorts of
silly quirks flying around at the same time).

So there, I'm happy I managed! =)

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Related tags query, many-to-many double join

2006-07-19 Thread Carlos Yoder
I second Simon on that -- it's still light years ahead of spaghetti code! =)

On 7/19/06, Simon Willison <[EMAIL PROTECTED]> wrote:
>
>
> On 19 Jul 2006, at 13:50, Maciej Bliziñski wrote:
>
> > is it possible to make the same thing without writing custom SQL code?
>
> No it isn't - but that's fine, that's exactly why Django allows (and
> encourages) you to roll your own SQL when you need to:
>
> http://www.djangoproject.com/documentation/model_api/#executing-
> custom-sql
>
> My philosophy with respect to the Django ORM (and ORMs in general) is
> that it should be used strictly for convenience - it should make the
> usual dull collection of queries as simple as possible. If the ORM is
> ever less convenient than writing a raw SQL query, write a raw SQL
> query!
>
> As long as you keep all of the SQL interactions in your Django model
> classes your database logic will all be in the same place and
> maintenance should be simple.
>
> Cheers,
>
> Simon
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-19 Thread Carlos Yoder
> For full i18n pluralization use:
>
> (from http://www.djangoproject.com/documentation/i18n/#pluralization)
> [
> {% blocktrans count list|counted as counter %}
> There is only one {{ name }} object.
> {% plural %}
> There are {{ counter }} {{ name }} objects.
> {% endblocktrans %}
> ]
>
> And in sl/django(js).po file add:
>
> (from 
> http://www.gnu.org/software/gettext/manual/html_chapter/gettext_10.html#SEC150)
> [
> Four forms, special case for one and all numbers ending in 02, 03, or 04
> The header entry would look like this:
>
> Plural-Forms: nplurals=4; \
> plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
>
> Languages with this property include:
>
> Slavic family
> Slovenian
> ]
>
> You can look for example in sr translation because current sl translation 
> don't have
> Plural-Forms defined.
>
> --
> Neboj¹a Ðorðeviæ - nesh

Hvala Neboj¹a!

Unfortunately, I believe there's a couple of caveats still here, but
this is definitely a source to investigate!


Regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: ifequal template problem

2006-07-18 Thread Carlos Yoder

OK, I fixed it, by defining a 'computed' method that returns the int
value in str form. So silly!

def prva_registracija_mm_str (self):
return str(self.prva_registracija_mm)

Ohwell :-)


On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> Forgot to say, I have the same logic working with no problem, but for
> a CharField, so this issue must be related to the field's datatype...
>
> On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > Hello there,
> >
> > I'm using a object_detail generic view to display some data. One of
> > the object's fields is an IntegerField, with choices limited to
> > MONTHS, a tuple of tuples mapping the values.
> >
> > Now, on the template I want to expand the stored values to the
> > 'human_readable' val, using somehting like:
> >
> > 
> > Prva registracija:
> > 
> > {% for data in MONTHS.items %}
> > {% ifequal data.0 object.prva_registracija_mm %}
> > {{ data.1 }}
> > {% else%}
> > debug: {{ data.0}} is not equal to {{ 
> > object.prva_registracija_mm }} 
> > {% endifequal %}
> > {% endfor %}
> > {{ object.prva_registracija_mm}}.{{ 
> > object.prva_registracija_}}
> > 
> >
> > The dictionary arrives correctly at the template via this code:
> >
> > (r'^(?P\d+)/$',
> > 'django.views.generic.list_detail.object_detail',
> > dict(info_dict, extra_context={'MONTHS': dict(MONTHS) })),
> >
> > ...and everything seems to be fine. When I run the template on the
> > browser, the stored value (an integer 2) never matches what I suppose
> > is a string '2'.
> >
> > How should I convert this to same datatypes? I'm sure this is a very
> > common task (expanding admin choices), isn't it?
> >
> > Best regards and big thanks,
> >
> > --
> > Carlos Yoder
> > http://carlitosyoder.blogspot.com
> >
>
>
> --
> Carlos Yoder
> http://carlitosyoder.blogspot.com
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Admin and limit_choices_to, part XXXIII =)

2006-07-18 Thread Carlos Yoder

Hello,

I know many before me have asked about making a dynamic
limit_choices_to tag. So far, I've had no luck (note to Aidas:
couldn't make your solution work!).

Anyway, I'm thinking on doing it the old school way, which is creating
arrays of JS objects with the relationships between 2 
objects, wiring the first 's onChange even to a selectChild()
function, etc.

Now, the question would be... is there a way of accessing a
ForeignKey's rendered widget's events, so I can play around with
"onChange"? I believe I can output the necessary arrays via the
Meta.js property.

Ideas? Help much appreciated,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Error with "media" dir on Windows, Python 2.3, etc

2006-07-18 Thread Carlos Yoder

Hello people,

On my dev box I'm having problems using the MEDIA_URL. I'm running the
development server  with the 'not-recommended' hack for serving static
files, and I believe MEDIA_URL and MEDIA_PATH are correct (similar
config work fine on production).

Mind you, files get uploaded and saved via admin, but when trying to
accessing them I get:

Page not found:
d:\dev\python23\lib\site-packages\django-0.95-py2.3.egg\django/contrib/admin/media\cars/alfa145_.jpg


That path certainly looks suspicious... ideas?

Mil gracias,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

> I'd do it the "classic" way.

Thank you Javier, that did it.

Little thing remains though. My admin console for a Car is quite
large, and it's organized neatly using Admin.fields. However, the
SpecialPrices table (linked here using edit_inline=True), always
appear at the end of the page.

Do you know of a way to configure and alter this behaviour?

Mil gracias,


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

I guess I found a lead at tests\modeltests\m2m_intermediary\

if anyone knows if that's correct (or wrong as hell), please let me know :-)



On 7/17/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm building a sort of b2b app that lists a car catalogue. A car can
> have multiple 'special prices', linked to groups of wholesalers. So
> when wholesaler W logs into the app, he should  see a 'special price
> just for you' control, displaying the proper price.
>
> In a custom app I'd have a 'modified' m2m relationship, sort of like this:
>
> SpecialPrices
> idCars (int FK)
> idWholesalers (int FK)
> Price (float)
>
> The problem is, I don't know how to do this in Django. I tried doing:
>
> class SpecialPrice(models.Model):
> """ A price for a special user (company)"""
> user= models.ForeignKey(User)
> special_price = models.FloatField("Custom Price", max_digits=9,
> decimal_places=2)
>
> class Car(models.Model):
> #...
> special_prices = models.ManyToManyField(SpecialPrice,
> filter_interface=models.HORIZONTAL)
>
>
> ... but that's not what I mean. I need the special prices to be unique
> to Car and Wholesaler.
>
>
> Could anyone be so kind as to shed some light on how to do this, the Django 
> way?
>
> Mil gracias,
>
> --
> Carlos Yoder
> http://carlitosyoder.blogspot.com
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Not sure how to do this (many to many problem)

2006-07-17 Thread Carlos Yoder

Hello!

I'm building a sort of b2b app that lists a car catalogue. A car can
have multiple 'special prices', linked to groups of wholesalers. So
when wholesaler W logs into the app, he should  see a 'special price
just for you' control, displaying the proper price.

In a custom app I'd have a 'modified' m2m relationship, sort of like this:

SpecialPrices
idCars (int FK)
idWholesalers (int FK)
Price (float)

The problem is, I don't know how to do this in Django. I tried doing:

class SpecialPrice(models.Model):
""" A price for a special user (company)"""
user= models.ForeignKey(User)
special_price = models.FloatField("Custom Price", max_digits=9,
decimal_places=2)

class Car(models.Model):
#...
special_prices = models.ManyToManyField(SpecialPrice,
filter_interface=models.HORIZONTAL)


... but that's not what I mean. I need the special prices to be unique
to Car and Wholesaler.


Could anyone be so kind as to shed some light on how to do this, the Django way?

Mil gracias,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Filter on count of ManyToManyField

2006-07-17 Thread Carlos Yoder

I had a similar problem, and just used custom SQL. It's easy:


from django.db import connection
cursor = connection.cursor()
cursor.execute("""
SELECT cars_model.id, cars_model.opis,
cars_znamka.id, cars_znamka.opis,
COUNT(*)
FROM cars_model, cars_vozilo, cars_znamka
WHERE cars_model.id=cars_vozilo.model_id
AND cars_znamka.id = cars_model.znamka_id
GROUP BY cars_model.id, cars_model.opis, cars_znamka.id, 
cars_znamka.opis
HAVING COUNT(*)>0
""")
result_list = []
for row in cursor.fetchall():
# create the dictionary object, that you'll pass to your 
template.
 dict_obj = {
"id" : row[0],
"opis" : "%s %s" % (row[3], row[1]),
"cars_count":row[4]
 }
 result_list.append(dict_obj)

# template expects "model_list"
model_list = result_list


Hope this helps,

Carlos

On 7/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi.
>
> This is probably trivial, but I've not managed to find the solution.
> How do I filter objects based on the count of a ManyToManyField?
>
> My example:
>
> I have two classes -- Blog and Submission:
>
> class Blog( models.Model ):
> entries = models.ManyToManyField( Submission )
>
> class Submission( models.Model ):
>   [... whatever ]
>
> I want to fetch a list of all Blog instances which have at least one
> Submission , i.e. entries.count() > 0. Changing the model is not an
> option.
>
> I've been trying all kinds of permutations of filter, entries, count,
> gt, etc, such as:
> Blog.objects.filter(entries__count__gt = 0)
>
> No luck so far.
>
> Can somebody please help me?
>
> Thanks,
> Daniel
>
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



ifequal template problem

2006-07-17 Thread Carlos Yoder

Hello there,

I'm using a object_detail generic view to display some data. One of
the object's fields is an IntegerField, with choices limited to
MONTHS, a tuple of tuples mapping the values.

Now, on the template I want to expand the stored values to the
'human_readable' val, using somehting like:


Prva registracija:

{% for data in MONTHS.items %}
{% ifequal data.0 object.prva_registracija_mm %}
{{ data.1 }}
{% else%}
debug: {{ data.0}} is not equal to {{ 
object.prva_registracija_mm }} 
{% endifequal %}
{% endfor %}
{{ object.prva_registracija_mm}}.{{ object.prva_registracija_}}


The dictionary arrives correctly at the template via this code:

(r'^(?P\d+)/$',
'django.views.generic.list_detail.object_detail',
dict(info_dict, extra_context={'MONTHS': dict(MONTHS) })),

...and everything seems to be fine. When I run the template on the
browser, the stored value (an integer 2) never matches what I suppose
is a string '2'.

How should I convert this to same datatypes? I'm sure this is a very
common task (expanding admin choices), isn't it?

Best regards and big thanks,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-16 Thread Carlos Yoder

> Well... A tag (or rather a filter) choosing one of three forms would be
> very simple. In fact I've heard gettext already has such functionality
> but I'm not very familliar with it. What is required in Django itself is
> some mechanism choosing the right pluralization plugin based on page
> language. But this looks more like a separate topic for
> django-developers already :-)

Whoops, I didn't think this would get so deep..., at least for me!
(complete newbie at frameworkds, no previous Python experience, etc).

But I guess I'll follow Adrian's advice, if nothing else for his as
Benign Dictator For Life in Djangoland. I'll hack my way into
extending pluralize to work with the Slovenian language, and later on
I'll share it. Who knows, maybe later down the road we'll have
something like pluralize_$iso-lang-code, easily pluggable into
contrib?

Thanks for all the feedback, and I'll get back to work :-)


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-14 Thread Carlos Yoder

Russel, I wrote my last comment before seeing yours. Just so that you know :-)

On 7/14/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> > > The problem is that it's not 1, 2, 3, 4 and others :-). For Russian it's:
> > >
> > > 1 form, if it ends with 1 but excluding 11
> > > 2 form, if it ends with 2, 3, 4 but excluding 12, 13, 14
> > > 3 form, for everything else and all previous exclusions.
> > >
> > > So this is not compatible with English at all because 21 and 1 should
> > > work the same in Russian but different in English. May be other slavic
> > > languages have their forms and exceptions also.
> >
> > Thank you Ivan for clarifying that... I was just going to ask you for
> > the cases in Russian. Honestly I can't see a universal way of doing
> > this -- languages are the very definition of diversity! :-P
> >
> > What do you think, Russell?
>
> How about using array slices? (I mean the [:] syntax). Maybe in that
> way you could specify something along the lines of:
>
> plural[1:3] = "i"  # if items are 1, 2 or 3, use 'i' as ending
>
> As I type this I realize this would be not enough. This new pluralize
> method should accomodate for all possibilities (for only 1 item, items
> 2-5, default plurarizer and so on), so... does this mean we're stuck
> with a dictionary?
>
> Honestly I never saw a proper implementation of a pluralize function,
> that was universal enough... can we get a shot at this, at all?
>
> OTOH, the dictionary approach Ivan mentioned would still have to be in
> place, since nouns of different genders have different plural
> families.
>
>
> ps to all of you native English speakers: lucky you! =)
> --
> Carlos Yoder
> http://carlitosyoder.blogspot.com
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-14 Thread Carlos Yoder

> > The problem is that it's not 1, 2, 3, 4 and others :-). For Russian it's:
> >
> > 1 form, if it ends with 1 but excluding 11
> > 2 form, if it ends with 2, 3, 4 but excluding 12, 13, 14
> > 3 form, for everything else and all previous exclusions.
> >
> > So this is not compatible with English at all because 21 and 1 should
> > work the same in Russian but different in English. May be other slavic
> > languages have their forms and exceptions also.
>
> Thank you Ivan for clarifying that... I was just going to ask you for
> the cases in Russian. Honestly I can't see a universal way of doing
> this -- languages are the very definition of diversity! :-P
>
> What do you think, Russell?

How about using array slices? (I mean the [:] syntax). Maybe in that
way you could specify something along the lines of:

plural[1:3] = "i"  # if items are 1, 2 or 3, use 'i' as ending

As I type this I realize this would be not enough. This new pluralize
method should accomodate for all possibilities (for only 1 item, items
2-5, default plurarizer and so on), so... does this mean we're stuck
with a dictionary?

Honestly I never saw a proper implementation of a pluralize function,
that was universal enough... can we get a shot at this, at all?

OTOH, the dictionary approach Ivan mentioned would still have to be in
place, since nouns of different genders have different plural
families.


ps to all of you native English speakers: lucky you! =)
-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-14 Thread Carlos Yoder

> The problem is that it's not 1, 2, 3, 4 and others :-). For Russian it's:
>
> 1 form, if it ends with 1 but excluding 11
> 2 form, if it ends with 2, 3, 4 but excluding 12, 13, 14
> 3 form, for everything else and all previous exclusions.
>
> So this is not compatible with English at all because 21 and 1 should
> work the same in Russian but different in English. May be other slavic
> languages have their forms and exceptions also.

Thank you Ivan for clarifying that... I was just going to ask you for
the cases in Russian. Honestly I can't see a universal way of doing
this -- languages are the very definition of diversity! :-P

What do you think, Russell?

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Can I use HAVING clause on a query?

2006-07-14 Thread Carlos Yoder

Hello there,

Now I'm trying to do a simple thing, and I can't get around to it. I
have a list of car objects that can be filtered by Model and FuelType
(usign standard  controls).

Since the list of models is huge, I want to make it smart in two ways:

1. Display the number of existing cars between brackets, next to the
Model name (did it already)
2. Limit the Model choices to those which have 1+ cars, so that the
filters are tighter (and the code for the s smaller!)

In plain SQL I'd do something with a HAVING clause, effectively
filtering the COUNT(*) on the cars.

Has anybody done sth like this before? Any clues?

Best regards,




-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Extending pluralize?

2006-07-14 Thread Carlos Yoder

>> How would a newbie to both Python and Django such as me be able to
>> extend pluralize? Has anyone already faced this?
>
> Being Russian, a lot! Russian has 3 basic forms of pluralizing nouns
> with many variants of these forms for different declinations. So to
> solve this problem universally you have to have a not-so-small language
> dictionary for every different case. I don't know if such things exist
> and it's actually my dream project to make one (for Russian).

That makes two of us!

> As for now I tend to have a template tag working like this
[snip] [snip] [snip]
> And then adding new words that I need to form as necessary.

Interesting... it was kind as I though it'd be. With all my newbie
questions being answered as I thought they would, Django is becoming a
much warmer place :-)

Spasiva! =)

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Extending pluralize?

2006-07-14 Thread Carlos Yoder

Hello there,

I'm currently developing my first app on Django, and it happens to be
in Slovenia, land in which the beautiful Slovenian language is spoken.

In this language, the rules of pluralization go very crazy, as the
following example (for the word for 'dolphin') shows:

0 delfinov
1 delfin
2 delfina
3 delfini
3 delfini
5 delfinov

So, as you can see, the template tag pluralize falls a little short,
when it faces ancient, little crazy Slavic languages such as this :-)

How would a newbie to both Python and Django such as me be able to
extend pluralize? Has anyone already faced this?

Best regards and thanks in advance,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Please fix my ugly code

2006-07-14 Thread Carlos Yoder

Jorge, muchas gracias!

I have not got as close as a mile from manipulators yet, even though
they look pretty cool. I'll certainly save your code around for later.

Who would have thought my code was not that off-track as I thought! =)

Anyway, a big thank you for the time you took to write this, I really
appreciate it!!!

On 7/13/06, Jorge Gajon <[EMAIL PROTECTED]> wrote:
>
> Hi again Carlos,
>
> I suggested this change in your code:
> > results = Vozilo.objects.all()
> > if selected_model_id != 0:
> > results = results.filter(model_id__exact=selected_model_id)
> > if selected_gorivo_id != 0:
> > results.extend(results.filter(gorivo_id__exact=selected_gorivo_id))
> >
> But I'm totally wrong there. Your original code should be fine,
> because you were chaining the filters. The 'extends' is not necessary
> and in fact it is wrong.
>
> I also realized that the filter logic in the code that I proposed is
> wrong. With that code you would get a list of cars that match the
> specified model, along with all the cars that match the gorivo type
> (regardless of model).
>
> The correct thing is to chain the filters like you did in your
> original code. This should work, I tested it with a model I have here.
>
> results = Vozilo.objects.all()
> if model:
> results = results.filter(model=model)
> if gorivo:
> results = results.filter(gorivo=gorivo)
>
>
> I'm sorry if I caused any confusion and for not paying more attention
> to that filtering part :)
>
> Cheers,
> Jorge
>
>
>
> On 7/13/06, Jorge Gajon <[EMAIL PROTECTED]> wrote:
> > Hi Carlos,
> >
> > I think your code is going good so far. Of course I'm not a guru but I
> > think your code is fine. Is there something that you don't feel
> > comfortable with? With respect to adding the results of both filters,
> > you need to extend the results of the first results (if any), like
> > this:
> >
> > results = Vozilo.objects.all()
> > if selected_model_id != 0:
> > results = results.filter(model_id__exact=selected_model_id)
> > if selected_gorivo_id != 0:
> > results.extend(results.filter(gorivo_id__exact=selected_gorivo_id))
> >
> >
> >
> > If I were to code that view I would use a custom manipulator and it
> > would end up something like the following. But PLEASE, PLEASE, be
> > aware that it's just my personal way of doing things, I am no one to
> > tell you how to do things.
> >
> > class FilterResultsManipulator(forms.Manipulator):
> > def __init__(self):
> > model_choices = [(m.id, m) for m in Model.objects.all()]
> > gorivo_choices = [(g.id, g) for g in
> > Gorivo.objects.all().order_by('opis')]
> > self.fields = (
> > forms.SelectField(field_name='model', choices=model_choices),
> > forms.SelectField(field_name='gorivo', choices=gorivo_choices),
> > )
> >
> > def home(request):
> > results = []
> > filter_manipulator = FilterResultsManipulator()
> > filter_data = {}
> >
> > if request.POST:
> > filter_data = request.POST.copy()
> >
> > model = None
> > gorivo = None
> > if filter_data.get('model'):
> > model = get_object_or_404(Model, pk=filter_data['model'])
> > if filter_data.get('gorivo'):
> > gorivo = get_object_or_404(Gorivo, pk=filter_data['gorivo'])
> >
> > if model:
> > results = Vozilo.objects.filter(model=model)
> > if gorivo:
> > results.extend(Vozilo.objects.filter(gorivo=gorivo))
> > else:
> > results = Vozilo.objects.order_by('?')[:5]
> >
> > filter_form = forms.FormWrapper(filter_manipulator, filter_data, {})
> >
> > return render_to_response('cars/home.html', {
> > 'results': results,
> > 'filter_form': filter_form,
> > })
> >
> > And the template you only need to display the form fields.
> >
> > 
> > Search by:
> > Model: {{ filter_form.model }}
> > Gorivo: {{ filter_form.gorivo }}
> > 
> > 
> >
> >
> > The custom manipulator and associated form wrapper takes care of
> > displaying the select fields in your form and maintaining the selected
> > option between posted pages. The use of the utility
> > get_object_or_404() frees you of worrying if the incoming data is
> > invalid or malformed, if it is a 404 exception will be raised and the
> > user will get 

Re: Django hosting

2006-07-13 Thread Carlos Yoder

www.no-ip.com

!

On 7/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have not static ip :(
>
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Please fix my ugly code

2006-07-13 Thread Carlos Yoder

Hello people, my ongoing adventures in firstdjangoappland continue thus:

I'm putting together a simple search app for a car project. On entry,
user sees a list of 5 random cars. He can use up to two comboboxes to
filter the results (car model and fuel type).

This is what I've come up with on my home() view, so far, and it looks
really ugly.

def home(request):

results = {}

# these 2 guys are the filters
model_list = Model.objects.all()
gorivo_list = Gorivo.objects.all().order_by('opis')

selected_model_id = 0
selected_gorivo_id = 0

if request.POST:
# this handles 'SELECTED' attribute on comboboxes
try:
selected_model_id = int(request.POST['model_id'])
except:
pass
try:
selected_gorivo_id = int(request.POST['gorivo_id'])
except:
pass

# and this should take care of the filtering... but I'm stumped 
really
# both filters should add up
results = Vozilo.objects.all()
if selected_model_id != 0:
results = 
results.filter(model_id__exact=selected_model_id)
if selected_gorivo_id != 0:
results = 
results.filter(gorivo_id__exact=selected_gorivo_id)
else:
# no POST, we show 5 random cars.
results = Vozilo.objects.order_by('?')[:5]

return render_to_response('cars/home.html', {
'model_list':model_list,
'gorivo_list':gorivo_list,
'selected_model_id':selected_model_id,
'selected_gorivo_id':selected_gorivo_id,
'results': results
})


There must be a better way of doing this, right? I'm a terrible newbie
both at Python and Django --and I'm not a kid anymore, so no more time
to spare hitting my head on walls :-)

Insights? Ideas?

Thanks a million,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: admin ordering question

2006-07-13 Thread Carlos Yoder

I solved it!

The problem was because I was trying to sort by a field that was not
listed on Admin.list_display


Updated code:

class Model(models.Model):
opis= models.CharField(maxlength=50)
znamka  = models.ForeignKey(Znamka)

def __str__(self):
return "%s %s" % (self.znamka, self.opis)

class Admin:
list_filter = ['znamka']# 
sidebar with handy filters
list_display = ('znamka', 'opis')

class Meta:
verbose_name_plural = "Modeli"
ordering = ['znamka','opis']

Like a charm, it works.

=)


On 7/13/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> >> class Item(models.Model):
> > > name = models.Charfield(maxlength=100)
> > > user = models.ForeignKey(User)
> > >
> > > def get_user_name(self):
> > > return self.user.name
> > >
> > > class Admin:
> > > list_display = ('name', 'get_user_name')
> > > ordering = ('get_user_name', 'name')
> >
> > Hi Mikael,
> >
> > You can't order by the result of a Python function, because the
> > ordering clause happens at the SQL level, not in Python.
>
>
> How about ordering by a ForeignKeyField?
>
> snippet follows:
>
> class Model(models.Model):
> opis= models.CharField(maxlength=50)
> znamka  = models.ForeignKey(Znamka)
>
> def __str__(self):
> return "%s %s" % (self.znamka, self.opis)
>
> class Admin:
> list_filter = ['znamka']# 
> sidebar with handy filters
>
> class Meta:
> verbose_name_plural = "Modeli"
> ordering = ['znamka', 'opis']
>
>
> In the memorable words of Dr. Jones... "this doesn't seem to work" =)
>
> Regards,
>
>
> --
> Carlos Yoder
> http://carlitosyoder.blogspot.com
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: admin ordering question

2006-07-13 Thread Carlos Yoder

>> class Item(models.Model):
> > name = models.Charfield(maxlength=100)
> > user = models.ForeignKey(User)
> >
> > def get_user_name(self):
> > return self.user.name
> >
> > class Admin:
> > list_display = ('name', 'get_user_name')
> > ordering = ('get_user_name', 'name')
>
> Hi Mikael,
>
> You can't order by the result of a Python function, because the
> ordering clause happens at the SQL level, not in Python.


How about ordering by a ForeignKeyField?

snippet follows:

class Model(models.Model):
opis= models.CharField(maxlength=50)
znamka  = models.ForeignKey(Znamka)

def __str__(self):
return "%s %s" % (self.znamka, self.opis)

class Admin:
list_filter = ['znamka']# 
sidebar with handy filters

class Meta:
verbose_name_plural = "Modeli"
ordering = ['znamka', 'opis']


In the memorable words of Dr. Jones... "this doesn't seem to work" =)

Regards,


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Alternative to PIL (Python Imaging Library)?

2006-07-13 Thread Carlos Yoder

Aidas, thanks for the great tip!

I'll get cracking.

Best regards,

On 7/13/06, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote:
>
> Carlos,
>
> If you need to get started quickly, you can use FileField instead of
> ImageField, so the PIL won't be necessary. The requirements of the
> uploaded image may be written in help_text. Maybe some validation of
> the image width and height can be done using Javascript. I'm not sure
> about that, you should check, whether it is posible to retrieve the
> dimensions of the selected file through Javascript, writing something
> like that:
> oImg = new Image();
> oImg.onload = function() {
>   alert(oImg.width + "x" + oImg.height);
> }
> oImg.src = document.getElementById("fileUploadFieldId").value;
> (The script is written on the fly, I am not sure whether it works correctly)
>
> Good luck!
> Aidas Bendoraitis [aka Archatas]
>
> On 7/13/06, Carlos Yoder <[EMAIL PROTECTED]> wrote:
> >
> > >> Don't think so. I don't have root access to my box in Bluehost. Can
> > >> anythone think of an alternative, short of telling support to install
> > >> it themselves?
> > > Technically all PIL is needed for is determining height, width and what
> > > not of the image. If you do not need it or can ask the user, then PIL is
> > > nice but not required. May take a little hacking, but it should be
> > > feasible to ignore the warning.
> > >
> > > Another option is to see if imagemagick / graphicsmagick is installed
> > > and write a wrapper which uses that instead of PIL. Also feasible and
> > > should be relatively easy.
> >
> > Maybe so, but unfortunately I'm just too much of a Python newbie to
> > try tackling that, while the clock is ticking for the Django app I
> > must get thru the door.
> >
> > It's getting frustrating, all of this obstacles (which I believe are
> > not Django's fault, but related to sysadmins' ignorance). We *really*
> > need to think of a "providing Django support" tutorial for sysadmins,
> > as we discussed briefly in the last few days... otherwise a lot of
> > people would be scared away from Django because it's "too hard" or
> > "unsupported".
> >
> > Anyway, I'll keep you posted, thanks a lot to you all!
> > --
> > Carlos Yoder
> > http://carlitosyoder.blogspot.com
> >
> > >
> >
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django and MySQLdb on Bluehost

2006-07-13 Thread Carlos Yoder

Hey Steve, seems like I'm not the only one struggling with Django+Bluehost.

If you manage to get ImageFields running on your models, let me
know... I can't make PIL work.

Regards,

Carlos

On 7/13/06, Steve <[EMAIL PROTECTED]> wrote:
>
> Nevermind, I figured it out.  Gosh I get smarter just by writing to
> this group :)
>
> All I had to do was add the local path of MySQLdb to my .fcgi file
> under my web root directory.  So:
> sys.path += ['/homedir/pythondir']
>
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Alternative to PIL (Python Imaging Library)?

2006-07-13 Thread Carlos Yoder

>> Don't think so. I don't have root access to my box in Bluehost. Can
>> anythone think of an alternative, short of telling support to install
>> it themselves?
> Technically all PIL is needed for is determining height, width and what
> not of the image. If you do not need it or can ask the user, then PIL is
> nice but not required. May take a little hacking, but it should be
> feasible to ignore the warning.
>
> Another option is to see if imagemagick / graphicsmagick is installed
> and write a wrapper which uses that instead of PIL. Also feasible and
> should be relatively easy.

Maybe so, but unfortunately I'm just too much of a Python newbie to
try tackling that, while the clock is ticking for the Django app I
must get thru the door.

It's getting frustrating, all of this obstacles (which I believe are
not Django's fault, but related to sysadmins' ignorance). We *really*
need to think of a "providing Django support" tutorial for sysadmins,
as we discussed briefly in the last few days... otherwise a lot of
people would be scared away from Django because it's "too hard" or
"unsupported".

Anyway, I'll keep you posted, thanks a lot to you all!
-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Alternative to PIL (Python Imaging Library)?

2006-07-13 Thread Carlos Yoder

>> Is there a way around PIL? Can Django use another kind of library? If
>> not, has anyone got around this? Maybe by getting a precompiled Linux
>> PIL?

> http://packages.debian.org/unstable/python/python-imaging
> ?

Don't think so. I don't have root access to my box in Bluehost. Can
anythone think of an alternative, short of telling support to install
it themselves?

Regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Alternative to PIL (Python Imaging Library)?

2006-07-12 Thread Carlos Yoder
Hello there guys,

Recently I found out that in Django uses PIL to handle image uploads.
I managed to get  a Bluehost account to run Django (it works! and I'll
be putting a *real* tutorial RealSoonNow), but I can't find my way
around installing PIL. Installation finishes with gcc belching a lot
of warnings and dying miserably. Bluehost¶  support guys haven't been
helpful yet, so... I turn to you.

Is there a way around PIL? Can Django use another kind of library? If
not, has anyone got around this? Maybe by getting a precompiled Linux
PIL?

Thanks a lot!
-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Are choices supported on DateField?

2006-07-11 Thread Carlos Yoder

Hello there,

Is there a way to constrain a DateField with a choices tuple? I want
the admin to restrict dates to valid months and years only.

Maybe I should make this happen with two different IntegerFields?

Best regards,


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Please help - FCGI installation woes

2006-07-11 Thread Carlos Yoder

Gábor,

I'm reading Jeff's tutorial, and I believe I'm seeing the light at the
end of the tunnel.


Will update later, thank you!

On 7/11/06, Gábor Farkas <[EMAIL PROTECTED]> wrote:
>
> Carlos Yoder wrote:
> > Hello guys,
> >
> > I'm having a lot of trouble trying to install a Django app on a shared
> > hosting (servage.net).
> >
> > The support people, even though they're very friendly an all, don't
> > know crap about Django or how to install it. They're OK for normal
> > tasks, but it gets a little deeper, they forward my request to a
> > 'Senior' tech, and that can take a full day until the ticket gets
> > answered (usually unsuccessfully).
> >
> > The problem is, I'm stuck with them and must get this app to work VERY
> > soon (remember, perfectionists with deadlines?). I really want this to
> > happen, since the alternative is to continue regurgitating C# crap
> > that I'm just sick and tired of.
> >
> > So, enough of ranting.
> >
> > Can anybody direct me into a step-by-step explanation of the install
> > process? I've look here
> > (http://www.djangoproject.com/documentation/fastcgi/) but I just don't
> > know what to do. I tried the last entry (create .htaccess and
> > mysite.fcgi), but to no avail -- I don't really know how to test or
> > see whether Django is installed, running, or whatever.
> >
> > Since I don't have shell access (they don't support ssh for 'security
> > reasons'), I understand I won't be able to use manage.py, so "syncdb"
> > will have to be via phpMyAdmin or similar, and so on.
> >
> > Here's what I did:
> >
> >  * Downloaded the latest DJango snapshot onto $webroot/django_src
> >  * Created a file for my project at $webroot/avtopage
> >
> > I don't really know how to continue. Questions arising are:
> >
> >  * How do I tell the installed Python to 'see' django_src? If that's
> > thru symlinking to $python/site-packages/, the tech support guys told
> > me they can do it.
> >  * What do I do to have my 'avtopage' directory (accesible via
> > http://domain/avtopage) to be Django-enabled?
> >
> > ... but I'm sure I'm missing something big here. (it shows it used the
> > development server to work on the app, doesn't it?)
> >
> >  I just don't know where to look, sorry to sound so whiny, but I don't
> > have anybody else to turn to but you, the community.
> >
> > Thanks for the time to read this, and if you can help me out, you
> > don't know how big of a Django evangeliser you'll find in me! (at
> > least in Slovenia, where I'm currently based) =)
> >
> > Best regards and thanks a million,
> >
>
>
> hi,
>
> first thing: you have to make sure that they support FASTCGI.
>
> when you know that they do, ask them how they do it.
>
> (ask them how they manage Ruby-on-Rails projects for example. i saw on
> their webpage that they do support Ruby-on-Rails, and that one is
> usually hosted using fastcgi)
>
> there are some documents about how to set up django on dreamhost.com. it
> should be similar to servage.net:
>
> http://wiki.dreamhost.com/index.php/Django
> http://www2.jeffcroft.com/2006/may/11/django-dreamhost/
>
> regarding the ftp+syncdb problem:
>
> then probably the easiest way is to syncdb somewhere else, and then dump
> the database to a file, and restore it on the servage-database.
>
> also to make python know about django, is nothing magical. as you see in
> the dreamhost-wiki django howto, they simple create a suitable
> django-fastcgi python script, and inside they add the django-dir to
> sys.path.
>
> i hope this helps. if not, reply :-)
>
> gabor
>
> >
>


-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Please help - FCGI installation woes

2006-07-11 Thread Carlos Yoder

Hello guys,

I'm having a lot of trouble trying to install a Django app on a shared
hosting (servage.net).

The support people, even though they're very friendly an all, don't
know crap about Django or how to install it. They're OK for normal
tasks, but it gets a little deeper, they forward my request to a
'Senior' tech, and that can take a full day until the ticket gets
answered (usually unsuccessfully).

The problem is, I'm stuck with them and must get this app to work VERY
soon (remember, perfectionists with deadlines?). I really want this to
happen, since the alternative is to continue regurgitating C# crap
that I'm just sick and tired of.

So, enough of ranting.

Can anybody direct me into a step-by-step explanation of the install
process? I've look here
(http://www.djangoproject.com/documentation/fastcgi/) but I just don't
know what to do. I tried the last entry (create .htaccess and
mysite.fcgi), but to no avail -- I don't really know how to test or
see whether Django is installed, running, or whatever.

Since I don't have shell access (they don't support ssh for 'security
reasons'), I understand I won't be able to use manage.py, so "syncdb"
will have to be via phpMyAdmin or similar, and so on.

Here's what I did:

 * Downloaded the latest DJango snapshot onto $webroot/django_src
 * Created a file for my project at $webroot/avtopage

I don't really know how to continue. Questions arising are:

 * How do I tell the installed Python to 'see' django_src? If that's
thru symlinking to $python/site-packages/, the tech support guys told
me they can do it.
 * What do I do to have my 'avtopage' directory (accesible via
http://domain/avtopage) to be Django-enabled?

... but I'm sure I'm missing something big here. (it shows it used the
development server to work on the app, doesn't it?)

 I just don't know where to look, sorry to sound so whiny, but I don't
have anybody else to turn to but you, the community.

Thanks for the time to read this, and if you can help me out, you
don't know how big of a Django evangeliser you'll find in me! (at
least in Slovenia, where I'm currently based) =)

Best regards and thanks a million,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-06 Thread Carlos Yoder

> in short:
>
> 1. yes, it works without it. if you dig deep enough at
> code.djangoproject.com, i think you can find some kind of fcgi.py which
> is afaik a stripped-down flup, or something like that.
> 2. the servage.net's answer is stupid :)

[snip snip snip]

> i hope this (chaotic) explanation helps. if not, replay :)
> gabor

Gábor yes it's very simple, to-the-point, and a WELCOME reply. Again,
köszönöm szépan to you!!!

Best regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Documentation for hosting providers?

2006-07-06 Thread Carlos Yoder

>> Would it be possible to put together a Wiki entry on how to provide
support for Django,
>> especially geared towards busy ISP admins? It should certainly help
me (selfish selfish
>> selfish), but I'm sure also other people too.
>
> Hey Carlos,
>
> I think this is a fantastic idea. If you, or somebody else, takes the
> lead on writing these docs, we can incorporate them into the official
> documentation when they're finished.

Hey Adrian,

Unfortunately I'm not the right person for the job, but when I finish
my current adagio with the guys at Servage.net, I'll certainly share.

Hmmm, how about the people currently offering support for Django? Are
they contributors to this list, django-dev or the codebase in general?
I mean gypsyhosting and all those guys... I'm sure they'd have more
experience into the possible pitfalls of Django support (if any), and
ceirtanly they'd be more likely to write a no-frills,
sysadmin-to-sysadmin kind of doc...

Anyone? :-)

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-06 Thread Carlos Yoder

* Important *

Does anyone know if Django will run on a config with Apache 1.x +
FastCGI, but without flup? At servage.net they just told me that they
don't support flup "because of high memory usage", so I don't know
what to do.

I'll be most obliged if anyone can clarify this quickly... thanks a lot!!!

-- 
Carlos Yoder
http://carlitosyoder.blogspot.com


> apache 1.3.something  + mod_fastcgi,
> the fastcgi processes are configured as FastCgiServer,
> so they are managed by the apache process.
> the fastcgi instances use flup.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Documentation for hosting providers?

2006-07-05 Thread Carlos Yoder

Hello people,

Maybe you missed the thread about "Django and Apache 1.x" on this list
-- I know I can't keep track of it!

We're talking about the docs can be a little misleading as to all the
possible server configurations needed to successfully run Django.
Currently I'm hitting a wall with the guys at Servage.net (they
roughly say that 'Django is a framework and because of that we can't
provide support for it). I belive they haven't checked Django
thoroughly, and I can't blame them.

Would it be possible to put together a Wiki entry on how to provide
support for Django, especially geared towards busy ISP admins? It
should certainly help me (selfish selfish selfish), but I'm sure also
other people too.

What do you think?

Warm regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-05 Thread Carlos Yoder

> I am not a doc wizard, but IMHO it is *always* worth addressing doc
> issues re set up that are ambiguous and make one wonder how to get
> started. I think most open source projects vastly undersestimate how
> important ease of entry is to their growth. This encompasses both how
> easy it is to get started and how easy it is to find or make hosting
> Django friendly. Witness PHP, much worse langauge ( I use it when it
> pay$), incredibly easy to get started in, best documentation I've seen
> anywhere, and no problem setting up. Result: staggeringly large user base.
>
> For Django to grow, I think the most important hole in the docs right
> now ( now that those tuturials are done, which are very good! ) is a
> cohesive set of guidelines on getting it working on various server
> platforms. Indeed we have them, but they are mixed in with a mess of
> (often misleading) comments and confusion.

Iain, unfortunately you're very right on this issue. Why
unfortunately? Because the admins at servage.net just replied this to
me:

"I have just been to Djangos website and it is a framework that needs
to be installed, which is not possible with our clustered structure.
Sorry for the inconvenience."

I believe they didn't *really* check what Django is, or if they did,
they just didn't read enough. Maybe a separate docs for hosting
providers would be a good idea, to see how simple it is to provide
Django support?

I'm personally trying them to understand that it's python code,
nothing that needs to be 'installed', but well, I'm not sure how it
works on their side. Too bad, I need Django hosting for a quick,
simple application, and I need it fast :-(

Ohwell, we've seen worse things happening! Regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-04 Thread Carlos Yoder

> > Can anybody confirm having a Django app running under Apache 1.x +
> > FastCGI? Is this actually a silly question, since let's say Dreamhost
> > gives only Apache 1.x support? :-)
>
> i have a website served by apache 1.x + fastcgi. no problems.
>
> gabor

Thank you very much, or should I say köszönöm szépan? :-)

Regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-04 Thread Carlos Yoder

> > I wonder if more people were/are confused by that sentence (found
> > here: http://www.djangoproject.com/documentation/install/)...?
>
> Well... Mod_python is the easiest method of running django, FastCGI
> setup is more advanced and usually requires basic knowledge about
> forking vs. threading, writing init scripts etc. These are things that
> makes it harder for beginners to understand Django itself so in my
> opinion it's good that docs encourage Apache 2 + mod_python setup.

Yes, I agree with that. But by reading that line, I was confused and
thought I understood that Django *only* supported Apache 2.x. On the
'Apache+FastCGI' wiki page, it does not mention something like 'this
works on Apache 1.x and 2.x" --agreed, AFAIK listing modifications to
httpd.conf implies Apache 1.x, but you get my point :-)

To the rest of the documentation wizards, is this worth addressing?

Best regards,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: Django & Apache 1.x

2006-07-04 Thread Carlos Yoder

>> Hello people!
>> Since I only found *one* place stating that Django "requires Apache
>> 2.x and mod_python 3.x", I felt I should check :-)
>> Just to be absolutely sure... Django does NOT work under Apache 1.x, correct?

> Not correct. This 2.0 thing is mentioned because Django works under
> mod_python 3.x and it's this mod_python version that isn't available for
> Apache 1.x.
>
> Under Apache 1.x you most certainly want to use FastCGI.

Many thanks, Ivan!

I wonder if more people were/are confused by that sentence (found
here: http://www.djangoproject.com/documentation/install/)...?

Can anybody confirm having a Django app running under Apache 1.x +
FastCGI? Is this actually a silly question, since let's say Dreamhost
gives only Apache 1.x support? :-)

Many thanks,

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Django & Apache 1.x

2006-07-04 Thread Carlos Yoder

Hello people!

Since I only found *one* place stating that Django "requires Apache
2.x and mod_python 3.x", I felt I should check :-)

Just to be absolutely sure... Django does NOT work under Apache 1.x, correct?

I'm tring to setup a Django env at Servage.net, and they provide
Apache 1.x, mod_python (at request), and FCGI. Dunno if they do
lighthttpd, though.

Can anyone please confirm or deny this? Thank you thank you thank you!

-- 
Carlos Yoder
http://carlitosyoder.blogspot.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
-~--~~~~--~~--~--~---



Re: How to write a module level method rather than a instance method

2006-05-22 Thread Carlos Yoder

Guys, let's try to cut down on cynicism, please? We all have our day
jobs, responsibilities, families and so on and so forth, and this is a
motivation-driven, heartfelt project.

If Malcom would reply with a sneer and 'did you try google?', Django
would not be what it is today -- a great community of people glued
together by a great project (and not the other way around).

So treat people as you like to be treated, I'd say...

Sorry for the OT, but I thought it was necessary before things get out
of hand. Feel free to ignore me if you don't care.

On 5/22/06, julián <[EMAIL PROTECTED]> wrote:
>
> Did you tried Google?
>
> http://www.google.com/search?hl=en==model+method+starts+with+%22_module_%22=Search
>
> http://www.djangoproject.com/documentation/models/custom_methods/
>
>
> >
>


-- 
Carlos Yoder
[EMAIL PROTECTED]
X-Google-Language: ENGLISH,ASCII
Received: by 10.54.68.11 with SMTP id q11mr188785wra;
Mon, 22 May 2006 02:47:12 -0700 (PDT)
Return-Path: <[EMAIL PROTECTED]>
Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187])
by mx.googlegroups.com with ESMTP id v23si921077cwb.2006.05.22.02.47.11;
Mon, 22 May 2006 02:47:12 -0700 (PDT)
Received-SPF: pass (googlegroups.com: domain of [EMAIL PROTECTED] designates 
64.233.182.187 as permitted sender)
DomainKey-Status: good (test mode)
Received: by nf-out-0910.google.com with SMTP id x37so815872nfc
for <django-users@googlegroups.com>; Mon, 22 May 2006 02:47:11 -0700 
(PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
s¾ta; d=gmail.com;

h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;

b=kA3lvkUMrvodDnoPQKhIqcFLKx880lFok7cYVc17GdPKuaQH/3JjY5LPi2fdxwQeh/INc/yr2CFdI3whdVGqg/Q6CE/Bn7WYqgr5+/THsqcqL1U7n3M6YUC9UOYgcN48rbmPnhEuaLwFewzQCTfMyeSXFl7UgfLn5UfuuhFER4gReceived:
 by 10.48.48.16 with SMTP id v16mr3604556nfv;
Mon, 22 May 2006 02:47:10 -0700 (PDT)
Received: by 10.49.15.14 with HTTP; Mon, 22 May 2006 02:47:10 -0700 (PDT)
Message-ID: <[EMAIL PROTECTED]>
Date: Mon, 22 May 2006 11:47:10 +0200
From: "Carlos Yoder" <[EMAIL PROTECTED]>
To: django-users@googlegroups.com
Subject: Re: How to write a module level method rather than a instance method
In-Reply-To: <[EMAIL PROTECTED]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
References: <[EMAIL PROTECTED]>
 <[EMAIL PROTECTED]>
 <[EMAIL PROTECTED]>
 <[EMAIL PROTECTED]>
 <[EMAIL PROTECTED]>

Guys, let's try to cut down on cynicism, please? We all have our day
jobs, responsibilities, families and so on and so forth, and this is a
motivation-driven, heartfelt project.

If Malcom would reply with a sneer and 'did you try google?', Django
would not be what it is today -- a great community of people glued
together by a great project (and not the other way around).

So treat people as you like to be treated, I'd say...

Sorry for the OT, but I thought it was necessary before things get out
of hand. Feel free to ignore me if you don't care.

On 5/22/06, julián <[EMAIL PROTECTED]> wrote:
>
> Did you tried Google?
>
> http://www.google.com/search?hl=en==model+method+starts+with+%22_module_%22=Search
>
> http://www.djangoproject.com/documentation/models/custom_methods/
>
>
> >
>


-- 
Carlos Yoder
[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: No Subclassing in models yet? How would you guys do the following:

2006-05-10 Thread Carlos Yoder

> Okay point taken - I'll stop trying to be 'elegant' and just live with
> the problem and deal with managing this with a 'VehicleType' model and
> several redundant fields.
>
> It is slightly anoying though!

Annoying? I work on Windows, you insensitive clod!

Cheers,
--
Carlos Yoder
[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: Django + fastCGI + bluehost

2006-04-10 Thread Carlos Yoder

James wrote:

>> I have django running on my bluehost account with fcgi.  The best
notes on how to get
>> things running I have found are here:
>>
>> http://wiki.dreamhost.com/index.php/Django
>>
>> Bluehost is setup pretty much the same as dreamhost.  I recommend
>> Bluehost for the price and support.

Thanks for the tip! I'll be moving to Bluehost very soon, then.


Gabor wrote:

> hi, could i ask you some questions regarding bluehost:
>
> - python version
> - do they offer postgresql (form their webpage it seems so. just wanted
> to make sure)
> - do i have to buy at least an one-year subscription? can't i just pay
> for the first month at the beginning? (it seems that you  either buy a
> 12month subscription for 7.95$/month, or a 24month one for 6.95$/month)
>
> thanks,
> gabor

I guess you'll have to ask Bluehost about that!


--
Carlos Yoder
[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
-~--~~~~--~~--~--~---



Django + fastCGI + bluehost

2006-04-07 Thread Carlos Yoder

Hey there, FP and all that :-)

Does anyone of you have experience with running Django on Bluehost?

They don't support mod_python, but according to their support people,
they do FastCGI. I include their reply, to see if it helps:


We do not have mod_python installed, but we do have Fast CGI on all of
our servers.  The following are a list of mods installed on our
servers which may differ slightly between versions:

Apache/1.3.34 (Unix) mod_fastcgi/2.4.2 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635
mod_ssl/2.8.25 OpenSSL/0.9.7a PHP-CGI/0.1b
-

Is there anything else I should ask, or this setup could run Django
successfully? Thanks a lot!

--
Carlos Yoder
[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
-~--~~~~--~~--~--~---