Shouldn't blank=True imply null=True?

2009-01-05 Thread Mike

Hi.  Hopefully this has a quick answer; I tried searching the list but
didn't come up with an answer.

Context:
I'm extending django.contrib.auth.models.User with some extra fields,
for instance IntegerField() and ForeignKey().

For non-string fields, whenever you use blank=True you also currently
need null=True.  (null=True causes django to insert a null instead of
an empty string)

If the type is not a string, and blank=True is set, shouldn't
null=True be implied?

Thanks,
Mike

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



Re: InlineModelAdmin min_num ?

2008-08-21 Thread mike

I'm thinking more of something in the ModelAdmin classes to replace
min_num_in_admin that I'm using as an argument in models.ForeignKey()

On Aug 19, 12:36 am, Peter of the Norse <[EMAIL PROTECTED]>
wrote:
> Perhaps you’re thinking of `extra`?
>
> On Aug 13, 2008, at 9:24 PM, mike wrote:
>
> > InlineModelAdmin has max_num , shouldn't it have a min_num or am I
> > missing something?
>
> > Thanks,
> > -Mike
>
> --
> Peter of the Norse
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Django with mod_fcgid

2009-02-01 Thread MIke

Hi,

I just started looking at Django, and since I'm using mod_fcgid anyhow
for other things, I thought I'd look into using it with Django as
well. One benefit of mod_fcgid over mod_fastcgi is that it does all
process management for you, and in my impression it's quite well-
behaved.

Turns out it's quite easy to do using a modified version of Robin
Dunn's old fastcgi python module. One benefit of that module is that
it falls back transparently to cgi when running in a cgi environment,
so all that is needed to switch Django between cgi and fastcgi is to
change one line in apache config


Options ExecCGI
AddHandler fcgid-script .cgi
#  AddHandler cgi-script .cgi


Is there any interest in this, and if so, what would be a good place
to post my code? Thanks, Michael

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



HttpResponse post

2009-02-16 Thread Mike

Hi all,

I m not familiar with django and I have found several problems trying
to sent a httpresponse with post parameters. I would like to return an
httpresponse (or httpredirect) to a new url with the request
parameters via post.

Could anybody help me?
Thank you in advance,
Miguel

I have defined a new view:

def prueba(request, seccion):
 if request.POST:
new_data = request.POST.copy()

[get all the parameters]
[send a mail if correct]


response = HttpResponse ("newUrl")
#¿POST?
return HttpResponseRedirect(response)

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



How to access fields of custom intermediary table

2009-07-16 Thread mike

Hi,

I have the following models:

class Memory(models.Model):
partnum = models.CharField(max_length=30)
size = models.IntegerField()

def __unicode__(self):
return self.partnum

class Motherboard(models.Model):
name = models.CharField(max_length=20)
sockets = models.IntegerField()
modules = models.ManyToManyField(Memory, through='MemModules')

def __unicode__(self):
return self.name

class MemModules(models.Model):
   memory = models.ForeignKey(Memory)
   motherboard = models.ForeignKey(Motherboard)
   count = models.IntegerField()

I can use the following statements to access the memory items for a
particular motherboard:

>>> from mike.test.models import *
>>> m = Motherboard.objects.get(name="C7X58")
>>> print m.name
C7X58
>>> print m.modules

>>> mods = m.modules.all()
>>> print mods
[, ]
>>> for i in mods:
...print i.partnum
...
ACT1GHU64B8F1333S
ACT2GHU64B8F1333S

My question is:  How do I access the extra fields stored in my custom
intermediate table?  In this case that would be the count field.  I
have search the Django documentation but so far I haven't found any
examples.

Thanks for any help!

Mike

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



How to access fields of custom intermediary table

2009-07-16 Thread mike

Hi,

I have the following models:

class Memory(models.Model):
partnum = models.CharField(max_length=30)
size = models.IntegerField()

def __unicode__(self):
return self.partnum

class Motherboard(models.Model):
name = models.CharField(max_length=20)
sockets = models.IntegerField()
modules = models.ManyToManyField(Memory, through='MemModules')

def __unicode__(self):
return self.name

class MemModules(models.Model):
   memory = models.ForeignKey(Memory)
   motherboard = models.ForeignKey(Motherboard)
   count = models.IntegerField()


I can use the following commands to access all the memory modules
related to a specific motherboard:

>>> from mike.test.models import *
>>> m = Motherboard.objects.get(name="C7X58")
>>> print m.name
C7X58
>>> mods = m.modules
>>> mods

>>> for i in mods.all():
...print i.size
...
1
2

My question is - How can I access the extra fields stored in the
intermediary table?  In this case the count field?  I've been
searching through the Django documentation but can't seem to find any
examples.

Thanks for any help!

Mike


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



Re: How to access fields of custom intermediary table

2009-07-16 Thread mike

On Jul 16, 12:06 pm, Tom Evans  wrote:

> > My question is:  How do I access the extra fields stored in my custom
> > intermediate table?  In this case that would be the count field.  I
> > have search the Django documentation but so far I haven't found any
> > examples.
>
> > Thanks for any help!
>
> > Mike
>
> m = Motherboard.objects.get(name="C7X58")
> mem_mods = m.memmodules_set.all()
> for mem_mod in mem_mods:
>   print "%d x %s" % (mem_mod.count, mem_mod.memory)
>
> Cheers
>
> Tom

Thanks Tom!  That worked perfectly.

Mike

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



Query builder or report builder

2009-07-29 Thread mike

I'm new to django, somewhere between a newbie and novice :-).

I'm looking for a query builder front end...middleware or app, and
thought I'd ask if anyone knows of such a django app or middleware.
I'm trying to avoid re-inventing the wheel, but I'm willing write one
if one doesn't exist.

I've found several standalone apps like SQLeonardo and Navicat, which
look nice, but I'd really like something more integrated within a
django environment.  Bottom line is that eventual end users need an
efficient way to perform queries much like MS Access allows.

I've started on a query builder app, but it is becoming a substantial
project by itself (over and above the current project's scope). If a
query builder app is of any interest to others, I would welcome any
input, guidance and/or help. So far, I've taken the approach as to
enumerate tables/fields from existing models within the current django
project, rather than enumerating tables/fields directly from the
database. So far so good, but building a user-friendly interface seems
to be the most challenging part, and I'm hoping jquery will fill this
void.

I'm very interested to hear what anyone else thinks of this concept.

Regards,

Mike Kimmick

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



Re: Query builder or report builder

2009-07-29 Thread mike

> I've written an app called django-filter which seems like it may be
> what you want:http://github.com/alex/django-filter/tree/master.
> Here's an example of it in use with a ticketing 
> appliation:http://imgur.com/BPpmf.png
>
> Alex


Alex,

Thanks for the input!

django-filter looks close.  However, it appears as django-filter is
based on pre-defined filters for pre-defined querysets, whereas I need
an interface that lets the user define the querysets and
filtersets...on the fly.  Is this correct?

I really need a full-blown query builder that essentially allows an
end user to query any or all tables (defined in models + auth_user)
with the capability of joins, where clauses, ordering, etc.  Maybe my
idea is a 'pipe dream', but none the less, it's a goal of mine to find/
build a decent web-based query builder tool.

Tools like mysql-admin connect to a db and read the schema which then
allows you to query the db.  I'd like to do the same but as a django
app, it would read the 'schema', so to speak, from the django
project's models.py.  This part, I have mostly working.  Providing a
useful, organized and efficient web interface seems to be the real
challenge.

Regards,

Mike





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



Re: how save data into more than one table?

2009-07-29 Thread mike

On Jul 29, 3:39 pm, Asinox  wrote:
> Hi guys, i cant find a example about how ill save data in two or more
> tables... somebody help me please
>
> Thanks

You essentially use two form instances and feed both to your
template.  You can have multiple django forms in a single html form,
so when they're submitted, you simply check that both django forms are
valid before saving.

Here's a snippet:

if request.method == 'POST' and request.POST.get('save', '') ==
'Save':

Form1 = mainForm(request.POST)
Form2 = subForm(request.POST)

if Form1.is_valid() and Form2.is_valid():
# do whatever else you need
#
# then save forms
Form1.save()
Form2.save()

# return success response...
else:
# return forms for corrections...






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



Re: how save data into more than one table?

2009-07-29 Thread mike

I'm not clear on what you mean by "key".  Foreignkey?  Or for
instance, an encryption key stored in two tables?  I'm left to guess
you mean a foreignkey.

In this case, the second 'table' you refer to could have a foreignkey
relating it back to the first table.  If this is what you mean,
then ...

Table 1: Child
  - id: AutoField
  - fn: CharField
  - ln: CharField

Table 2: Evaluation
  - id: AutoField
  - child: ForeignKey(Child)
  - results: CharField


Each would have a corresponding Form with all fields.

Then in the request.POST processing...

child_form = childForm(request.POST)
eval_form = evalForm(request.POST)

if child_form.is_valid() and eval_form.is_valid():
new_child = child_form.save()
eval_form = evalForm(request.POST, instance=new_child)
eval_form.save()


Keep in mind, this always creates a new record in Child table, since
the childForm was instantiated without an instance.  But that's
different topic anyway.

Also, if you need to access the pk of the new_child, you simply access
it via new_child.pk
i.e.
new_child = child_form.save()
new_pk = new_child.pk


There is another way, but it depends a bit on the design of your
models.
hint: get object (if it exists) from second table, and update the
corresponding field
http://docs.djangoproject.com/en/1.0//topics/db/queries/


Regards,

Mike

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



syncdb and runserver fails -- related to trans_real.py

2009-08-07 Thread mike

Hi all-

I am using Django 1.1 (the latest stable release, installed from the
tarball), and
upon issuing a "python manage.py syncdb" or "python manage.py
runserver" from my
project, I get the same error.  I'm running this from within a pinax
virtualenv, and I am on Mac OSX version 10.4.

I've pasted in the error output below this message.

I have already spent a lot of time looking into this, and so far the
only thing that
seemed relevant is a bug where the django/conf/locale directory is
empty (see http://code.google.com/p/django-hotclub/issues/detail?id=213).
Unfortunately, I hit a dead end there when I saw that my django/conf/
locale is not empty.

I'm hoping someone else has experienced this and found a fix!

Thanks in advance,

Mike

Traceback (most recent call last):
  File "manage.py", line 28, in 
execute_from_command_line()
  File "/Users/wisz/Django-1.1/build/lib/django/core/management/
__init__.py", line
353, in execute_from_command_line
utility.execute()
  File "/Users/wisz/Django-1.1/build/lib/django/core/management/
__init__.py", line
303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/wisz/Django-1.1/build/lib/django/core/management/
base.py", line 195,
in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Users/wisz/Django-1.1/build/lib/django/core/management/
base.py", line 213,
in execute
translation.activate('en-us')
  File "/Users/wisz/Django-1.1/build/lib/django/utils/translation/
__init__.py", line
73, in activate
return real_activate(language)
  File "/Users/wisz/Django-1.1/build/lib/django/utils/translation/
__init__.py", line
43, in delayed_loader
return g['real_%s' % caller](*args, **kwargs)
  File "/Users/wisz/Django-1.1/build/lib/django/utils/translation/
trans_real.py",
line 205, in activate
_active[currentThread()] = translation(language)
  File "/Users/wisz/Django-1.1/build/lib/django/utils/translation/
trans_real.py",
line 195, in translation
current_translation = _fetch(language,
fallback=default_translation)
  File "/Users/wisz/Django-1.1/build/lib/django/utils/translation/
trans_real.py",
line 160, in _fetch
res._info = res._info.copy()
AttributeError: 'NoneType' object has no attribute '_info'


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



Re: Appeding entire table to a backup table

2009-08-24 Thread Mike

Thanks Tim, in that case I will carry on this way.

2009/8/23 Tim Chase :
>
>> The raw SQL is something along the lines of "INSERT INTO backup SELECT
>> * FROM today; DELETE FROM today;".
>>
>> Is there a Django way of doing this? I would required something
>> similiar to this:
>> todays_records = Today.objects.all()
>> for record in todays_records:
>>     Backup.objects.create(record)
>
> While you could do something like this Python/Django code, your
> raw SQL is far more efficient -- your transaction logs should
> have the two commands.  Depending on the quantity of data, the
> Python/Django way of doing this may have lots of INSERTs in your
> transaction logs.
>
> Another possibility might be to have the .save() method save into
> both places ([today] and [backup]) so you can just DELETE FROM
> [today] and already have the content in [backup].
>
> As an aside, the DELETE FROM is more portable, but in some
> environments TRUNCATE TABLE tblFoo is a more efficient way to
> clear out the contents (but may have auto-increment resetting
> side-effects).
>
> So I'd just stick with your current solution and not try to use
> the Django ORM.
>
> -tim
>
>
>
> >
>

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



Re: Database connection closed after each request?

2009-08-29 Thread Mike

Hi,

I made some small custom psycopg2 backend that implements persistent
connection using global variable. With this I was able to improve the
amount of requests per second from 350 to 1600 (on very simple page
with few selects) Just save it in the file called base.py in any
directory (e.g. postgresql_psycopg2_persistent) and set in settings:

DATABASE_ENGINE to projectname.postgresql_psycopg2_persistent

Here is a source: http://dpaste.com/hold/86948/

# Custom DB backend postgresql_psycopg2 based
# implements persistent database connection using global variable

from django.db.backends.postgresql_psycopg2.base import DatabaseError,
DatabaseWrapper as BaseDatabaseWrapper, \
IntegrityError
from psycopg2 import OperationalError

connection = None

class DatabaseWrapper(BaseDatabaseWrapper):
def _cursor(self, *args, **kwargs):
global connection
if connection is not None and self.connection is None:
try: # Check if connection is alive
connection.cursor().execute('SELECT 1')
except OperationalError: # The connection is not working,
need reconnect
connection = None
else:
self.connection = connection
cursor = super(DatabaseWrapper, self)._cursor(*args, **kwargs)
if connection is None and self.connection is not None:
connection = self.connection
return cursor

def close(self):
if self.connection is not None:
self.connection.commit()
self.connection = None


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



Re: Database connection closed after each request?

2009-08-31 Thread Mike

Hi,

I also would like to note that this code is not threadsafe - you can't
use it with python threads because of unexpectable results, in case of
mod_wsgi please use prefork daemon mode with threads=1


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



Upload from client machine to server in Django 0.95

2009-04-05 Thread Mike

Hello,

I am using Django 0.95 and need to upload from from client machine to
server. I wonder if anyone can point me to sample implementation or
any pointer that may help me to implement it.

I know file upload is there in Django 1.0 but its not possible for me
to move the project to Django 1.0.

Any help will be appreciated.

Regards,
Mike

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



Urls.py: Match a leading Question Mark

2009-09-25 Thread mike

Hi. Im migrating from an old PHP piece of junk to Django (hooray) and
this client is very insistent on maintaining all of his old PHP-based
URLs, which will be 301 redirected so as to not lose SEO.  As there
are 1000s of these links, mod_rewrite might not be the best solution,
especially since we've got HttpResponsePermanentRedirect

Old Link:
www.somesite.com/app/?product=1234

New Link:
www.somesite.com/app/slugged-text

Urls.py Line:
(r'^app/\?product=(?P)$','site.app.views.xxx'),

Now the problem is, Django wont match an escaped starting question
mark (?) or am I missing something?  (it works fine if I were to
exclude the ?, as in "product=1234" but is a pre-processed url via
"re.sub" possible?)

Thanks for your help,
Mike

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



Re: Urls.py: Match a leading Question Mark

2009-09-25 Thread mike

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



Re: error with forms

2010-04-23 Thread Mike
I'm not completely sure, but it looks as though your variable 'body':
body = forms.CharField(widget = forms.Textarea())

should be:
body = forms.CharField(widget=forms.Textarea)

with next area not as a function.
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Form.widget


On Apr 16, 8:14 pm, JoJo  wrote:
> Hi all, i have an error here im not sure what it means can anyone help
> me
>
> here is my models.py file##
> class AddStuffForm(forms.Form):
>
>         title = forms.CharField(max_length=100)
>         body = forms.CharField(widget = forms.Textarea())
>
>         def save(self):
>             new_gossip =  Gossip.objects.create(title  =['title'],
>                                                 body =['body'])
>
> here is my views.py file##
> def add_gossip(request):
>     if request.method == 'POST':
>         form = AddStuffForm(data=request.POST)
>         if form.is_valid():
>             form.save()
>             return HttpResponseRedirect("/links/")
>     else:
>         form = AddStuffForm()
>     return render_to_response('add_gossip.html',
>                               { 'form': form})
>
> Traceback:
> File "c:\Python26\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   92.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File "c:\django\gossip2go\..\gossip2go\applications\views.py" in
> add_gossip
>   169.             form.save()
> File "c:\django\gossip2go\applications\models.py" in save
>   131.                                                 body =['body'])
> File "c:\Python26\lib\site-packages\django\db\models\manager.py" in
> create
>   126.         return self.get_query_set().create(**kwargs)
> File "c:\Python26\lib\site-packages\django\db\models\query.py" in
> create
>   314.         obj = self.model(**kwargs)
> File "c:\Python26\lib\site-packages\django\db\models\base.py" in
> __init__
>   323.                 raise TypeError, "'%s' is an invalid keyword
> argument for this function" % kwargs.keys()[0]
>
> Exception Type: TypeError at /add_gossip/
> Exception Value: 'body' is an invalid keyword argument for this
> function
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/django-users?hl=en.

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



Re: Error I continue to get

2010-06-19 Thread Mike
I also get this error.

I have python for windows version 2.6. I am using the standard windows
xp shell. I have installed the latest version of django from the
command line.

How can I fix this?

On Jun 11, 3:40 pm, Kenneth Gonsalves  wrote:
> On Friday 11 June 2010 12:05:50 Sam Lai wrote:
>
> > Thaterrormessage looks like Windows to me. try adding the word
> > python at the start of that command.
>
> yes, it did not look like a linuxerrormessage - although last time I looked
> windows would say 'bad command or file name'
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC

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



Error when trying to connect to django_session

2010-01-06 Thread Mike
I am a newb to a this so please keep that in mind when reading this.
I am running Ubuntu 9.10, postgreSQL 8.4, psycopg2, Django 1.1.1, and
Apache 2.2.  Everything works fine until I go to authenticate then I
get an error.  I am trying to get the authentication piece to work by
using the canned template and I get the following traceback:

[Wed Jan 06 11:33:12 2010] [notice] caught SIGTERM, shutting down
[Wed Jan 06 11:33:13 2010] [warn] mod_wsgi: Compiled for Python/2.6.2.
[Wed Jan 06 11:33:13 2010] [warn] mod_wsgi: Runtime using Python/
2.6.4.
[Wed Jan 06 11:33:13 2010] [warn] mod_wsgi: Python module path '/usr/
lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-
tk:/usr/lib/python2.6/lib-old:/usr/lib/py$
[Wed Jan 06 11:33:13 2010] [notice] Apache/2.2.12 (Ubuntu) PHP/
5.2.10-2ubuntu6.3 with Suhosin-Patch mod_wsgi/2.5 Python/2.6.4
mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming no$
[Wed Jan 06 11:33:16 2010] [error] mod_wsgi (pid=22889): Exception
occurred processing WSGI script '/srv/Django/FDRAB_Intranet/apache/
django.wsgi'.
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.6/django/core/handlers/wsgi.py", line
245, in __call__
  response = middleware_method(request, response)
File "/usr/lib/pymodules/python2.6/django/contrib/sessions/
middleware.py", line 36, in process_response
  request.session.save()
File "/usr/lib/pymodules/python2.6/django/contrib/sessions/backends/
db.py", line 58, in save
  obj.save(force_insert=must_create)
File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line
410, in save
  self.save_base(force_insert=force_insert, force_update=force_update)
File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line
470, in save_base
  manager.filter(pk=pk_val).extra(select={'a': 1}).values('a').order_by
())):
File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line
112, in __nonzero__
  iter(self).next()
File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line
106, in _result_iter
  self._fill_cache()
File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line
692, in _fill_cache
  self._result_cache.append(self._iter.next())
File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line
756, in iterator
  for row in self.query.results_iter():
File "/usr/lib/pymodules/python2.6/django/db/models/sql/query.py",
line 287, in results_iter
  for rows in self.execute_sql(MULTI):
File "/usr/lib/pymodules/python2.6/django/db/models/sql/query.py",
line 2369, in execute_sql
  cursor.execute(sql, params)
File "/usr/lib/pymodules/python2.6/django/db/backends/util.py", line
19, in execute
  return self.cursor.execute(sql, params)
ProgrammingError: relation "django_session" does not exist
LINE 1: SELECT (1) AS "a" FROM "django_session" WHERE
"django_sessio...

The most annoying part is that Django can write to the table in other
instances, but for some reason it fails when I try to authenticate.
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




inspectdb question

2010-02-02 Thread Mike
Hi,

I've tried to import my legacy MySQL database using

  python manage.py inspectdb --database=myolddb >>models.py

and found that all varchar(N) fields became models.CharField
(max_length=3*N,...)
i.e. three times longer. Is it a bug or an expected behavior?
BTW I use trunk rev. 12374 and DEFAULT CHARSET for the table is utf-8.


Regards,
Mike

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



case sensitive usernames

2007-07-11 Thread mike


Hi all,

While I was writing test cases for my upcoming website, I noticed I that
the contrib.auth module will happily make a user called Mike and user
called mike and treat them as two separate users.

Are there reasons for this? I patched my installation of django so that
usernames were not case sensitive. My reasoning was that someone could
register as Neil (lowercase L at the end) and build up a reputation on
the site. Then someone could register as NeiI (uppercase i at the end)
and impersonate the first user, as in many fonts the glyphs for
lowercase L and uppercase i are identical.

Also, giving users a slug using the standard django slugify becomes
problematic if you have Neil and neil. Which one does the slug "neil"
refer to?

Cheers,

MikeH

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



Ajax widget

2008-01-03 Thread mike

I am trying to implement the Dojo Select box into a template I am
creating.
I have used the formtags that is inluded in the nongselect tar
package. but It seems with the development version of django the
import
statements   {% load formtags %}  no longer work,   I need a way to
replace the

{% selectrow form.reporter "/myapp/reporter_lookup/?q=%{searchString}"
"first_name" %}

Line with raw html for a text input box that will call this ajax
function for me.   I have been googling for days with no luck.
I'm using the newforms library and  form_for_instance



http://code.djangoproject.com/wiki/AJAXWidgetComboBox
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Ajax widget

2008-01-04 Thread mike

thx for the reply malcolm,  I am trying to implement the Dojo select
box into one of my forms, I followed the instructions and i know the
javascript is working because I can get results by using the query
string in my browser,

http://localhost:8000/myapp/reporter_lookup/?q=  returns results,
The last part involves using a template tag (formtags.py) that comes
with the nong javascript package and loading it with a {% load
formtags %} statement then using a

 {% selectrow form.reporter "/myapp/reporter_lookup/?q=%
{searchString}"
"first_name" %}

statement to spit out the code for the input box. This template tag is
no longer valid and cannot be imported so the select row statement
will no longer work

On Jan 3, 8:36 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2008-01-03 at 15:25 -0800, mike wrote:
> > I am trying to implement the Dojo Select box into a template I am
> > creating.
> > I have used the formtags that is inluded in the nongselect tar
> > package. but It seems with the development version of django the
> > import
> > statements   {% load formtags %}  no longer work,   I need a way to
> > replace the
>
> You seem to be mixing up multiple problem reports here, but let's start
> with this one. The "load" tag still works in Django. So you should try
> to figure out why whatever third-party code you're using doesn't want to
> load with the development version.
>
> Regards,
> Malcolm
>
> --
> No one is listening until you make a mistake.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Ajax widget

2008-01-04 Thread mike

Malcolm thanks for the reply, The javascript code above was working i
was just unable to implement it into my template input box. I will try
as you suggest.


On Jan 4, 10:59 am, Empty <[EMAIL PROTECTED]> wrote:
> So I'm really confused.  You asked this same question on 
> 12/14:http://groups.google.com/group/django-users/browse_frm/thread/3415d1b...
>
> The original author of the Wiki page that you're referring to
> responded.  The code is a year and a half old and it seems to not be
> working.  But now you're asking the same question again.
>
> My recommendation is to take the ideas that are in that code and
> rewrite them to make them work, if you're stuck on that dojo
> implementation.  If you're not up to that task then I suggest you look
> at several on Django Snippets:
>
> Jquery:http://www.djangosnippets.org/snippets/269/
> YUI:http://www.djangosnippets.org/snippets/392/
>
> If neither of those suit you, contact me directly and I can send you
> some other code for a YUI implementation.
>
> Good luck.
>
> Michael Trier
> blog.michaeltrier.com
>
> On Jan 4, 2008 9:52 AM, mike <[EMAIL PROTECTED]> wrote:
>
>
>
> > thx for the reply malcolm,  I am trying to implement the Dojo select
> > box into one of my forms, I followed the instructions and i know the
> > javascript is working because I can get results by using the query
> > string in my browser,
>
> >http://localhost:8000/myapp/reporter_lookup/?q= returns results,
> > The last part involves using a template tag (formtags.py) that comes
> > with the nong javascript package and loading it with a {% load
> > formtags %} statement then using a
>
> >  {% selectrow form.reporter "/myapp/reporter_lookup/?q=%
> > {searchString}"
> > "first_name" %}
>
> > statement to spit out the code for the input box. This template tag is
> > no longer valid and cannot be imported so the select row statement
> > will no longer work
>
> > On Jan 3, 8:36 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
> > wrote:
>
> > > On Thu, 2008-01-03 at 15:25 -0800, mike wrote:
> > > > I am trying to implement the Dojo Select box into a template I am
> > > > creating.
> > > > I have used the formtags that is inluded in the nongselect tar
> > > > package. but It seems with the development version of django the
> > > > import
> > > > statements   {% load formtags %}  no longer work,   I need a way to
> > > > replace the
>
> > > You seem to be mixing up multiple problem reports here, but let's start
> > > with this one. The "load" tag still works in Django. So you should try
> > > to figure out why whatever third-party code you're using doesn't want to
> > > load with the development version.
>
> > > Regards,
> > > Malcolm
>
> > > --
> > > No one is listening until you make a 
> > > mistake.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Jquery and form plugin

2008-01-22 Thread mike

I am trying to use Jquery's form plugin with django to submit a form
with ajax.  When i submit the form the data is posted and the server
responds but the results are not showing up on my form.  I can see
from the console output of Firebug   that the data is being returned,
but its just not showing  any help would be appreciated.



 Javascript:
  
// wait for the DOM to be loaded
$(document).ready(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
return false;
});
});


My form:

   VPI: 
   VCI: 



Firebug console results returns correct html:
 



Success rate is 100 percent (5/5), round-trip min/avg/
max = 8/11/12 ms
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Operate with privileges

2008-02-05 Thread mike

Perhaps this is a stupid question, but i was thinking of creating a
django app that did a few Server administration tasks, add users, edit
config files etc.  Can anyone point me in the right direction as to
how I would be able to execute django views with root permissions?
Thx in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: gettext_noop usage?

2008-02-15 Thread Mike

On Sep 18 2007, 11:09 pm, Amit Ramon <[EMAIL PROTECTED]> wrote:
>
> I read the documentation of gettext_noop and its template counterpart {%
> trans "value" noop %} and I must admit I still don't understand their use
> cases and usage.
>
> This is what djangobook says:
>
> x---
> "Marking strings as no-op
> Use the function django.utils.translation.gettext_noop() to mark a string as a
> translation string without translating it. The string is later translated
> from a variable.
>
> Use this if you have constant strings that should be stored in the source
> language because they are exchanged over systems or users -- such as strings
> in a database -- but should be translated at the last possible point in time,
> such as when the string is presented to the user."
> x---
>
> I might be dumb, but could someone shed some light on this, and show an
> example of no-op'ed strings and late translation of it for the novice user?
> What is the use case here? How a string is translated from a variable? When?

Me is stupid, too. What is that mysterious variable? Somebody, please
help!

Mike

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



Re: Mod_Python and Eggs

2008-04-04 Thread mike

I had this issue and was able to correct it by adding the following to
my settings.py

import os
os.environ['PYTHON_EGG_CACHE'] = '/tmp'

Hope this helps somebody

On Apr 3, 7:32 am, "Jon Lathem" <[EMAIL PROTECTED]> wrote:
> Graham,
>
> Thanks for your quick response.  It was a SELinux problem.  And i realize
> that chmoding to 777 is a bad idea, at the time I was just trying to get it
> to work.
>
> Jon
>
> On Wed, Apr 2, 2008 at 5:47 PM, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > On Apr 3, 12:54 am, JLathem <[EMAIL PROTECTED]> wrote:
> > > The first time I boot my server and view my django app I get the
> > > following message
>
> > ===
> > > ExtractionError: Can't extract file(s) to egg cache
>
> > > The following error occurred while trying to extract file(s) to the
> > > Python egg
> > > cache:
>
> > >   [Errno 13] Permission denied: '/egg_cache/bgy/MySQL_python-1.2.2-
> > > py2.4-linux-i686.egg-tmp'
>
> > > The Python egg cache directory is currently set to:
>
> > >   /egg_cache/bgy
>
> > > Perhaps your account does not have write access to this directory?
> > > You can
> > > change the cache directory by setting the PYTHON_EGG_CACHE environment
> > > variable to point to an accessible directory.
>
> > ===
>
> > > After doing a "service httpd restart" everything works fine.  I have
> > > read the documentation here (http://www.djangoproject.com/
> > > documentation/modpython/) about setting the egg cache path and I've
> > > done that (you can see in the error message that I am not using the
> > > standard egg path).  I have also tried it without setting the egg path
> > > and I get the same error.  I made apache the owner and group of the
> > > egg cache folder and also chmod 777 on the folder with still no luck.
> > > Can someone help me out and tell me what I am missing?
>
> > Do you have SELinux enabled?
>
> > BTW, setting a directory to 777 permissions is really bad.
>
> > Send a 'ls -las' listing output of '/egg_cache/'.
>
> > Graham
>
> --
> Thanks
>
> Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Email This Page

2008-06-20 Thread mike

Hello,  I am working on a django app that displays call logs for our
customers.  I am using a print.css along with a print button that only
prints the rendered information. I would like to add an "email this
page" submit button. That will send an email containing all the
rendered information. What would be the best way to go about this.
Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Email This Page

2008-06-20 Thread mike

the pages content come from a mysql database. sending a link wouldnt
work, cause its a rendered template. Im using a print css, so when you
click on "file" "print preview" it only shows the tables with data in
them.  This is what i would like to email. I could write a seperate
view with an email.txt like shown here 
http://www.rossp.org/blog/2006/jul/11/sending-e-mails-templates/
but, that seems a waste to re-query all the information.

On Jun 20, 10:21 am, "Bruno Tikami" <[EMAIL PROTECTED]> wrote:
> Mike,
>
> I agree with Michael about the HTML content, you should follow his line . IF
> you still do want to email html content, it's not that hard I just have 1
> question for you: is your page's content on the database or on your file
> system?
>
> []s!
>
> Tkmhttp://djangopeople.net/brunotikami/
>
> On Fri, Jun 20, 2008 at 12:10 PM, Michael Trythall <[EMAIL PROTECTED]>
> wrote:
>
> > Mike,
>
> > Why not just send a link to that particular page? It would be a lot less
> > work, and from a usability standpoint it wouldn't be as jarring. Most users
> > don't expect unsolicited HTML e-mails, and some folks can't read them.
>
> > The link would be easier, and universally more accessible.
>
> > Just a thought. I'm watching this thread because the answers could be
> > interesting :)
>
> > Michael Trythall
> > Developer and Information Architect
>
> > On 6/20/08, mike <[EMAIL PROTECTED]> wrote:
>
> >> Hello,  I am working on a django app that displays call logs for our
> >> customers.  I am using a print.css along with a print button that only
> >> prints the rendered information. I would like to add an "email this
> >> page" submit button. That will send an email containing all the
> >> rendered information. What would be the best way to go about this.
> >> Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Email This Page

2008-06-20 Thread mike

I ended up, just using the same template and adding a form to it, and
passing the variables back and forth

On Jun 20, 11:30 am, "Michael Trythall" <[EMAIL PROTECTED]> wrote:
> Can Django's cache system help here? I haven't worked with it enough to
> know, but it feels to me like you might be able to cache the query and
> reference it in the print-view. I don't see a way to pull this off without a
> separate view and template, though.
>
> On 6/20/08, mike <[EMAIL PROTECTED]> wrote:
>
>
>
> > the pages content come from a mysql database. sending a link wouldnt
> > work, cause its a rendered template. Im using a print css, so when you
> > click on "file" "print preview" it only shows the tables with data in
> > them.  This is what i would like to email. I could write a seperate
> > view with an email.txt like shown here
> >http://www.rossp.org/blog/2006/jul/11/sending-e-mails-templates/
> > but, that seems a waste to re-query all the information.
>
> > On Jun 20, 10:21 am, "Bruno Tikami" <[EMAIL PROTECTED]> wrote:
> > > Mike,
>
> > > I agree with Michael about the HTML content, you should follow his line .
> > IF
> > > you still do want to email html content, it's not that hard I just have 1
> > > question for you: is your page's content on the database or on your file
> > > system?
>
> > > []s!
>
> > > Tkmhttp://djangopeople.net/brunotikami/
>
> > > On Fri, Jun 20, 2008 at 12:10 PM, Michael Trythall <[EMAIL PROTECTED]>
>
> > > wrote:
>
> > > > Mike,
>
> > > > Why not just send a link to that particular page? It would be a lot
> > less
> > > > work, and from a usability standpoint it wouldn't be as jarring. Most
> > users
> > > > don't expect unsolicited HTML e-mails, and some folks can't read them.
>
> > > > The link would be easier, and universally more accessible.
>
> > > > Just a thought. I'm watching this thread because the answers could be
> > > > interesting :)
>
> > > > Michael Trythall
> > > > Developer and Information Architect
>
> > > > On 6/20/08, mike <[EMAIL PROTECTED]> wrote:
>
> > > >> Hello,  I am working on a django app that displays call logs for our
> > > >> customers.  I am using a print.css along with a print button that only
> > > >> prints the rendered information. I would like to add an "email this
> > > >> page" submit button. That will send an email containing all the
> > > >> rendered information. What would be the best way to go about this.
> > > >> Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Captcha example

2007-02-20 Thread Mike

Hello,

Can anyone puke up a simple example of using captcha with Django
forms? [I've already RTFM&N.]

I installed the app code from http://code.google.com/p/django-captcha/
and noticed the test but don't see how it works with templates and
extraspecially newforms (needs to be a tag library?).

If there's a better or simpler option for implementing captcha I'd be
especially interested in that.

Thank you!


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



Re: Captcha example

2007-02-21 Thread Mike

Hi Joe,

Thanks for taking the time to respond--that makes sense to me.

I had to go all the way to Poland but finally found a working code
example (Dziękuję!). Here's the link in case it's helpful for someone
else:

http://www.rkblog.rk.edu.pl/w/p/django-and-captcha-images/



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

2007-02-27 Thread Mike

The range function has an optional 'step' argument.

Howzabout:

SelectDateWidget(years=range(2006,1900,-1))

> But is there an easy way I can make the years display in reverse -
> i.e. descending rather than ascending?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Using HTML/CSS as templates

2007-02-27 Thread Mike

It's probably a path-related issue.

You might start here as a reference:

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

Bit o' learning curve serving CSS when starting out, in my experience,
because of the way Django encourages/prods/provokes us to serve static
media separately.


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

2007-02-27 Thread Mike

It looks like multiple dictionaries are being passed to the view.

Should 'extra_context' be included in the first one (just like the
'template' argument)?


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



Jobs Vs Opportunity - The Movie

2007-03-12 Thread mike

Jobs Vs Opportunity - The Movie

www.thewealththeory.com/beyond-freedom.com

This is excellent!
If you haven't already watched, it check it out now.


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



Jobs Vs Opportunity - The Movie

2007-03-12 Thread mike

Jobs Vs Opportunity - The Movie

www.thewealththeory.com/beyond-freedom

This is excellent!
If you haven't already watched, it check it out now.


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



Jobs Vs Opportunity - The Movie

2007-03-13 Thread mike

Jobs Vs Opportunity - The Movie

www.thewealththeory.com/beyond-freedom

This is excellent!
If you haven't already watched it, check it out now.


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



Professional Sales People Wanted!

2007-03-13 Thread mike

Professional Sales People Wanted!

On a scale of 1-10 How ready are you to earn over 100k income per
year?
Only 9's and 10's need apply.
Do not apply if you are not a 9 or 10, you are only wasting your time
and mine

www.thenextbigboom.com/beyond-freedom


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



Personal Development Program

2007-03-13 Thread mike

Personal Development Program

www.libertyleague.com/beyond-freedom

At Beyond-Freedom we are dedicated to coaching others to success.
However, we can only help and support people who truly want change in
their life. Beyond-Freedom in association with Liberty League
International provide personal development programs designed to
increase your spiritual, mental, physical and emotional power.


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



Jobs Vs Opportunity - The Movie

2007-03-14 Thread mike

Jobs Vs Opportunity - The Movie

www.thewealththeory.com/beyond-freedom

This is excellent!
If you haven't already watched it, check it out now.


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



Programmer Career

2007-04-11 Thread Mike

Find Your Programming Job Vacancy and resources here -->
http://www.jobbankdata.com/job-programming.htm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 0.96 login issue with cookies

2007-10-17 Thread Mike

Hi Robert,

I had the same problem. Since I switched from FCGI to mod_python the
problem disappeared. I still don't know what was the _real_ reason for
that. However, I noticed it was possible to get rid of the problem
temporarily by clearing the browser cache (or cookies). I bet it was
caused by the error processing mechanism in Django/FCGI somehow
screwing up the cache control HTTP headers.

Regards,
Mike Ivanov

On Oct 17, 2:50 pm, "Robert Šmol" <[EMAIL PROTECTED]> wrote:
> Hello,
> I have HomePage with login bar with a form for user to log in. I use
> django.contrib.auth.login to log user in. When I enter it from the
> /accounts/login/ page it works ok. However trying to login from homepage is
> not working. I have to do it twice (always). On django# there were more
> users with same experience. They recommended to write own login view. So I
> did and it works ok.
>
> After digging into django.contrib.auth.view.login I found out the code fails
> at checking errors
>
> errors = manipulator.get_validation_errors(request.POST)
>
> with:
>
> {'username': ["Your Web browser doesn't appear to have cookies enabled.
> Cookies are required for logging in."]}
>
> and hence redirecting to /accounts/login/ (and setting up a test_cookie).
>
> I guess I'm supposed to setup a test cookie first right? But how? I didn't
> find any documentation for this :(
>
> my urls.conf:
> from django.contrib.auth.views import login, logout
>
> (r'^$', direct_to_template, {'template':'index.html'}),
> (r'^accounts/login/$',  login),
>
> Thank you
>
> Robert


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: 0.96 login issue with cookies

2007-10-27 Thread Mike

No, the cache was off all the time.

On Oct 19, 8:44 am, web-junkie <[EMAIL PROTECTED]> wrote:
> Did you activate the cache in Django? I once discovered an issue with
> that..


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



dynamic translation depending on request parameter

2007-11-23 Thread mike

I need to load different translations in one site. Exact language for
translations is the same, but there are differences between messages.
Structure of locale looks like that:

./locale
|-- en
|   `-- LC_MESSAGES
|   |-- django.mo
|   |-- django.po
|   `-- django.po~
|-- en_gb_rentals
|   `-- LC_MESSAGES
|   |-- django.mo
|   |-- django.po
|   `-- django.po~
|-- en_gb_trucks
|   `-- LC_MESSAGES
|   |-- django.mo
|   |-- django.po
|   `-- django.po~
|-- pl
|   `-- LC_MESSAGES
|   |-- django.mo
|   |-- django.po
|   `-- django.po~
|-- pl_pl_rentals
|   `-- LC_MESSAGES
|   |-- django.mo
|   |-- django.po
|   `-- django.po~
`-- pl_pl_trucks
`-- LC_MESSAGES
|-- django.mo
|-- django.po
`-- django.po~

This is the middleware I use:

def process_request(self, request):
language = 'en_gb' # it will be changed dynamically
language_ex = language + '_' + request.site.name # it is
generated in another middleware and depends on url
translation.activate(language_ex)
request.LANGUAGE_CODE = translation.get_language()

def process_response(self, request, response):
patch_vary_headers(response, ('Accept-Language',))
response['Content-Language'] = translation.get_language()
translation.deactivate()
return response

Translations are loaded properly, but only at first time after
restarting server. request.site.name and request.LANGUAGE_CODE ale
changing but translation is not changing (except after first request
per exact url).

Is the way to load different translation when server is running?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Get Paid $$$$ for Taking Online Surveys

2007-11-26 Thread Mike

Get Paid  for Taking Online Surveys

Join today and receive $4 to $250 for taking online surveys that
influence the development of new products and services.

Check my web site and start immediately earning extra money from your
own computer at anywhere by taking online surveys

http://www3.sympatico.ca/abdo4/


Send me your e-mail address as well to be invited to special focus
groups and other paid surveys sites.

Don't worry there are NO FEES at all to be paid.

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



django admin page

2007-11-27 Thread mike

Hello this is my first post, I work the helpdesk for a small company
and I am trying to design a form to keep track our customers, contact
info and the reason for their calls, I would like my customer form to
list links to notes for each time they called with dates, here is my
currentl models.py any help would be appreciated.


from django.db import models
from django.contrib.auth.models import User
from django.conf import settings

SERVICE_CODES = (
(1, 'DSL'),
(2, 'T1'),
(3, 'HOSTING'),
(4, 'NONE'),
(5, 'Dial-up'),
(6, 'Integrator'),
)


class Issue(models.Model):
issue = models.TextField(blank=True)
date = models.DateField()
customer = models.CharField(blank=True, maxlength=100)

def __unicode__(self):
return self.issue

class Meta:
ordering = ('issue',)
class Admin:
pass

#apps = [app for app in settings.INSTALLED_APPS if not
app.startswith('django.')]
#PROJECTS = list(enumerate(apps))

##project = models.CharField(blank=True, maxlength=100,
choices=PROJECTS)

class Customer(models.Model):
name = models.CharField(maxlength=100)
service = models.IntegerField(blank=True, default=4,
choices=SERVICE_CODES)
email = models.CharField(blank=True, maxlength=100)
phone_number = models.CharField(blank=True, maxlength=100)
phone_number2 = models.CharField(blank=True, maxlength=100)
IP_address = models.CharField(blank=True, maxlength=100)
submitted_date = models.DateField(auto_now_add=True)
modified_date = models.DateField(auto_now=True)
issue = models.ForeignKey(Issue, related_name="Issue")
description = models.TextField(blank=True)

class Admin:
list_display = ('name', 'service', 'phone_number',
'submitted_date', 'modified_date')
list_filter = ('service', 'submitted_date')
search_fields = ('name',
'description','email','phone_number','IP_address')

class Meta:
ordering = ('service', 'submitted_date', 'name')

def __str__(self):
return self.name

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



django admin

2007-11-27 Thread mike

My last post was a little confusing, I have two classes a Customer
class and an Issue class, I would like the customer class to display
issues where the "name" of the customer field matches the "customer"
field of the issues class,  thus listing each customer's issues at a
glance, any help would be appreciated.  thx in advance



class Customer(models.Model):
name = models.CharField(maxlength=100)
service = models.IntegerField(blank=True, default=4,
choices=SERVICE_CODES)
comp = models.IntegerField(blank=True, default=4,
choices=CUSTOMER_TYPES)
email = models.CharField(blank=True, maxlength=100)
phone_number = models.CharField(blank=True, maxlength=100)
phone_number2 = models.CharField(blank=True, maxlength=100)
IP_address = models.CharField(blank=True, maxlength=100)
submitted_date = models.DateField(auto_now_add=True)
modified_date = models.DateField(auto_now=True)
description = models.TextField(blank=True)
list_issues = ???
class Admin:
list_display = ('name', 'service', 'phone_number',
'submitted_date', 'modified_date')
list_filter = ('service', 'submitted_date')
search_fields = ('name',
'description','email','phone_number','IP_address')



class Meta:
ordering = ('service', 'submitted_date', 'name')

def __str__(self):
return self.name

class Issue(models.Model):
issue = models.TextField(blank=True)
date = models.DateField()
customer = models.ForeignKey(Customer, related_name="Customer")

def __unicode__(self):
return self.issue

class Meta:
ordering = ('issue',)
class Admin:
pass


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



Re: django admin

2007-11-27 Thread mike

Roman, That is EXACTLY what I needed, thx alot.

On Nov 27, 12:45 pm, "Roman Zechner" <[EMAIL PROTECTED]> wrote:
> 2007/11/27, mike <[EMAIL PROTECTED]>:
>
>
>
>
>
> > My last post was a little confusing, I have two classes a Customer
> > class and an Issue class, I would like the customer class to display
> > issues where the "name" of the customer field matches the "customer"
> > field of the issues class,  thus listing each customer's issues at a
> > glance, any help would be appreciated.  thx in advance
>
> > class Customer(models.Model):
> > name = models.CharField(maxlength=100)
> > service = models.IntegerField(blank=True, default=4,
> > choices=SERVICE_CODES)
> > comp = models.IntegerField(blank=True, default=4,
> > choices=CUSTOMER_TYPES)
> > email = models.CharField(blank=True, maxlength=100)
> > phone_number = models.CharField(blank=True, maxlength=100)
> > phone_number2 = models.CharField(blank=True, maxlength=100)
> > IP_address = models.CharField(blank=True, maxlength=100)
> > submitted_date = models.DateField(auto_now_add=True)
> > modified_date = models.DateField(auto_now=True)
> > description = models.TextField(blank=True)
> > list_issues = ???
> > class Admin:
> > list_display = ('name', 'service', 'phone_number',
> > 'submitted_date', 'modified_date')
> > list_filter = ('service', 'submitted_date')
> > search_fields = ('name',
> > 'description','email','phone_number','IP_address')
>
> > class Meta:
> > ordering = ('service', 'submitted_date', 'name')
>
> > def __str__(self):
> > return self.name
>
> > class Issue(models.Model):
> > issue = models.TextField(blank=True)
> > date = models.DateField()
> > customer = models.ForeignKey(Customer, related_name="Customer")
>
> > def __unicode__(self):
> > return self.issue
>
> > class Meta:
> > ordering = ('issue',)
> > class Admin:
> > pass
>
> hi mike,
>
> in class Issue try to change the attribute customer according to the
> following line:
>   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> related_name="Customer")
>
> there's also the num_in option which determines the number of displayed
> INLINE customers
>
>   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> num_in_admin=2, related_name="Customer")
>
> maybe this is what you want.
>
> -cheers, roman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django admin

2007-11-27 Thread mike

one problem, the Issues appear at the bottom of the customer form
along with other blank issues, , but If I add an Issue there, and save
it.  It erases the issue from the issue class,

On Nov 27, 1:33 pm, mike <[EMAIL PROTECTED]> wrote:
> Roman, That is EXACTLY what I needed, thx alot.
>
> On Nov 27, 12:45 pm, "Roman Zechner" <[EMAIL PROTECTED]> wrote:
>
> > 2007/11/27, mike <[EMAIL PROTECTED]>:
>
> > > My last post was a little confusing, I have two classes a Customer
> > > class and an Issue class, I would like the customer class to display
> > > issues where the "name" of the customer field matches the "customer"
> > > field of the issues class,  thus listing each customer's issues at a
> > > glance, any help would be appreciated.  thx in advance
>
> > > class Customer(models.Model):
> > > name = models.CharField(maxlength=100)
> > > service = models.IntegerField(blank=True, default=4,
> > > choices=SERVICE_CODES)
> > > comp = models.IntegerField(blank=True, default=4,
> > > choices=CUSTOMER_TYPES)
> > > email = models.CharField(blank=True, maxlength=100)
> > > phone_number = models.CharField(blank=True, maxlength=100)
> > > phone_number2 = models.CharField(blank=True, maxlength=100)
> > > IP_address = models.CharField(blank=True, maxlength=100)
> > > submitted_date = models.DateField(auto_now_add=True)
> > > modified_date = models.DateField(auto_now=True)
> > > description = models.TextField(blank=True)
> > > list_issues = ???
> > > class Admin:
> > > list_display = ('name', 'service', 'phone_number',
> > > 'submitted_date', 'modified_date')
> > > list_filter = ('service', 'submitted_date')
> > > search_fields = ('name',
> > > 'description','email','phone_number','IP_address')
>
> > > class Meta:
> > > ordering = ('service', 'submitted_date', 'name')
>
> > > def __str__(self):
> > > return self.name
>
> > > class Issue(models.Model):
> > > issue = models.TextField(blank=True)
> > > date = models.DateField()
> > > customer = models.ForeignKey(Customer, related_name="Customer")
>
> > > def __unicode__(self):
> > > return self.issue
>
> > > class Meta:
> > > ordering = ('issue',)
> > > class Admin:
> > > pass
>
> > hi mike,
>
> > in class Issue try to change the attribute customer according to the
> > following line:
> >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > related_name="Customer")
>
> > there's also the num_in option which determines the number of displayed
> > INLINE customers
>
> >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > num_in_admin=2, related_name="Customer")
>
> > maybe this is what you want.
>
> > -cheers, roman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django admin

2007-11-27 Thread mike

ok I can add issues if i add an admin class to my Issues class and add
them from the Admin screen, but they will not save if i add them from
the bottom of my customer form, I cant find anything in the
documentation that addresses this

On Nov 27, 1:46 pm, mike <[EMAIL PROTECTED]> wrote:
> one problem, the Issues appear at the bottom of the customer form
> along with other blank issues, , but If I add an Issue there, and save
> it.  It erases the issue from the issue class,
>
> On Nov 27, 1:33 pm, mike <[EMAIL PROTECTED]> wrote:
>
> > Roman, That is EXACTLY what I needed, thx alot.
>
> > On Nov 27, 12:45 pm, "Roman Zechner" <[EMAIL PROTECTED]> wrote:
>
> > > 2007/11/27, mike <[EMAIL PROTECTED]>:
>
> > > > My last post was a little confusing, I have two classes a Customer
> > > > class and an Issue class, I would like the customer class to display
> > > > issues where the "name" of the customer field matches the "customer"
> > > > field of the issues class,  thus listing each customer's issues at a
> > > > glance, any help would be appreciated.  thx in advance
>
> > > > class Customer(models.Model):
> > > > name = models.CharField(maxlength=100)
> > > > service = models.IntegerField(blank=True, default=4,
> > > > choices=SERVICE_CODES)
> > > > comp = models.IntegerField(blank=True, default=4,
> > > > choices=CUSTOMER_TYPES)
> > > > email = models.CharField(blank=True, maxlength=100)
> > > > phone_number = models.CharField(blank=True, maxlength=100)
> > > > phone_number2 = models.CharField(blank=True, maxlength=100)
> > > > IP_address = models.CharField(blank=True, maxlength=100)
> > > > submitted_date = models.DateField(auto_now_add=True)
> > > > modified_date = models.DateField(auto_now=True)
> > > > description = models.TextField(blank=True)
> > > > list_issues = ???
> > > > class Admin:
> > > > list_display = ('name', 'service', 'phone_number',
> > > > 'submitted_date', 'modified_date')
> > > > list_filter = ('service', 'submitted_date')
> > > > search_fields = ('name',
> > > > 'description','email','phone_number','IP_address')
>
> > > > class Meta:
> > > > ordering = ('service', 'submitted_date', 'name')
>
> > > > def __str__(self):
> > > > return self.name
>
> > > > class Issue(models.Model):
> > > > issue = models.TextField(blank=True)
> > > > date = models.DateField()
> > > > customer = models.ForeignKey(Customer, related_name="Customer")
>
> > > > def __unicode__(self):
> > > > return self.issue
>
> > > > class Meta:
> > > > ordering = ('issue',)
> > > > class Admin:
> > > > pass
>
> > > hi mike,
>
> > > in class Issue try to change the attribute customer according to the
> > > following line:
> > >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > > related_name="Customer")
>
> > > there's also the num_in option which determines the number of displayed
> > > INLINE customers
>
> > >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > > num_in_admin=2, related_name="Customer")
>
> > > maybe this is what you want.
>
> > > -cheers, roman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django admin

2007-11-27 Thread mike

Ok, I recreated the database, and all is well, thx for the help .

On Nov 27, 2:16 pm, mike <[EMAIL PROTECTED]> wrote:
> ok I can add issues if i add an admin class to my Issues class and add
> them from the Admin screen, but they will not save if i add them from
> the bottom of my customer form, I cant find anything in the
> documentation that addresses this
>
> On Nov 27, 1:46 pm, mike <[EMAIL PROTECTED]> wrote:
>
> > one problem, the Issues appear at the bottom of the customer form
> > along with other blank issues, , but If I add an Issue there, and save
> > it.  It erases the issue from the issue class,
>
> > On Nov 27, 1:33 pm, mike <[EMAIL PROTECTED]> wrote:
>
> > > Roman, That is EXACTLY what I needed, thx alot.
>
> > > On Nov 27, 12:45 pm, "Roman Zechner" <[EMAIL PROTECTED]> wrote:
>
> > > > 2007/11/27, mike <[EMAIL PROTECTED]>:
>
> > > > > My last post was a little confusing, I have two classes a Customer
> > > > > class and an Issue class, I would like the customer class to display
> > > > > issues where the "name" of the customer field matches the "customer"
> > > > > field of the issues class,  thus listing each customer's issues at a
> > > > > glance, any help would be appreciated.  thx in advance
>
> > > > > class Customer(models.Model):
> > > > > name = models.CharField(maxlength=100)
> > > > > service = models.IntegerField(blank=True, default=4,
> > > > > choices=SERVICE_CODES)
> > > > > comp = models.IntegerField(blank=True, default=4,
> > > > > choices=CUSTOMER_TYPES)
> > > > > email = models.CharField(blank=True, maxlength=100)
> > > > > phone_number = models.CharField(blank=True, maxlength=100)
> > > > > phone_number2 = models.CharField(blank=True, maxlength=100)
> > > > > IP_address = models.CharField(blank=True, maxlength=100)
> > > > > submitted_date = models.DateField(auto_now_add=True)
> > > > > modified_date = models.DateField(auto_now=True)
> > > > > description = models.TextField(blank=True)
> > > > > list_issues = ???
> > > > > class Admin:
> > > > > list_display = ('name', 'service', 'phone_number',
> > > > > 'submitted_date', 'modified_date')
> > > > > list_filter = ('service', 'submitted_date')
> > > > > search_fields = ('name',
> > > > > 'description','email','phone_number','IP_address')
>
> > > > > class Meta:
> > > > > ordering = ('service', 'submitted_date', 'name')
>
> > > > > def __str__(self):
> > > > > return self.name
>
> > > > > class Issue(models.Model):
> > > > > issue = models.TextField(blank=True)
> > > > > date = models.DateField()
> > > > > customer = models.ForeignKey(Customer, related_name="Customer")
>
> > > > > def __unicode__(self):
> > > > > return self.issue
>
> > > > > class Meta:
> > > > > ordering = ('issue',)
> > > > > class Admin:
> > > > > pass
>
> > > > hi mike,
>
> > > > in class Issue try to change the attribute customer according to the
> > > > following line:
> > > >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > > > related_name="Customer")
>
> > > > there's also the num_in option which determines the number of displayed
> > > > INLINE customers
>
> > > >   customer = models.ForeignKey(Customer, edit_inline=models.TABULAR,
> > > > num_in_admin=2, related_name="Customer")
>
> > > > maybe this is what you want.
>
> > > > -cheers, roman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Admin interface button

2007-11-28 Thread mike

I am trying to design a form using the django admin with text fields
to make notes in and a drop down box with email addresses to choose.
I would like to add an action button, that sends an email with the
information in the forms to one of the addresses in the drop down
box.  I was wondering the best way to add an action button to the
django admin interface.  I could do this with python cgi and
fieldstorage, but I would like to integrate this into the admin page.
Does anyone have any suggestions.  my model is below.

from django.db import models

from django.db import models
from django.contrib.auth.models import User
from django.conf import settings




class Call(models.Model):
name = models.CharField(maxlength=100)
service = models.IntegerField(blank=True, default=1,
choices=SERVICE_CODES)



name = models.CharField(maxlength=100)
service = models.IntegerField(blank=True, default=1,
choices=SERVICE_CODES)
company = models.IntegerField(blank=True, default=1,
choices=CUSTOMER_TYPES)
called_for = models.IntegerField(blank=True, default=0,
choices=CALLED_FOR)
date =  models.DateField()
email = models.CharField(blank=True, maxlength=100)
phone_number = models.CharField(blank=True, maxlength=100)
phone_number2 = models.CharField(blank=True, maxlength=100)
description = models.TextField(blank=True)
email_to = models.IntegerField(blank=True, default=1,
choices=EMAILS)
class Admin:
list_display = ('name', 'date','service', 'phone_number')
list_filter = ('service', 'company')
search_fields = ('name', 'description','email','phone_number')

class Meta:

ordering = ('name', 'service', 'date')

def __str__(self):
return self.name

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



Re: Django Snippets-contact form

2007-12-05 Thread mike

Gul You hit the nail right on the head...thanks a bunch.

On Dec 5, 10:52 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> I doubt the problem is with base.html itself, but there might still be
> a mismatch of block names.
>
> contact.html is expecting the following blocks to be defined in base.html:
>
> * fulltitle
> * header
> * extrahead
> * content-wrap
>
> While thankyou.html is expecting the following blocks instead:
>
> * billboard
> * title
> * header
> * content
>
> My guess is that your base.html probably has "title" and "content" but
> not the rest of them. Try changing the contact.html so "fulltitle"
> becomes "title" and "content-wrap" becomes "content".
>
> -Gul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Snippets-contact form

2007-12-05 Thread mike



On Dec 5, 10:36 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
> mike napisał(a):
>
> > I have been trying to implement the contact form from the Django
> > Snippets page found here.
>
> >http://www.djangosnippets.org/snippets/261/ I'm able to make it all
> > work together, but the contacts.html page, is blank unless i remove
> > the{% extends "base.html" %}  part.  After removing it I can see
> > the input boxes, but the page is really ugly.   Anyone know why
> > importing this template erases everything below it? any help would be
> > appreciated.
>
> Possibly it does not have appropriate blocks or is just empty?


no, the  {% extends "base.html" %}   line is also in the thankyou.html
page and it works there, the text shows fine.
>
> --
> Jarek Zgoda
> Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> "We read Knuth so you don't have to." (Tim Peters)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Snippets-contact form

2007-12-05 Thread mike

if i include something like this at the top it will load the admin
media, but nothing will be below it

{% extends "admin/base_site.html" %}
{% block content %}
{% load adminmedia %}
{% endblock %}


On Dec 5, 10:42 am, mike <[EMAIL PROTECTED]> wrote:
> On Dec 5, 10:36 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
> > mike napisał(a):
>
> > > I have been trying to implement the contact form from the Django
> > > Snippets page found here.
>
> > >http://www.djangosnippets.org/snippets/261/I'm able to make it all
> > > work together, but the contacts.html page, is blank unless i remove
> > > the{% extends "base.html" %}  part.  After removing it I can see
> > > the input boxes, but the page is really ugly.   Anyone know why
> > > importing this template erases everything below it? any help would be
> > > appreciated.
>
> > Possibly it does not have appropriate blocks or is just empty?
>
> no, the  {% extends "base.html" %}   line is also in the thankyou.html
> page and it works there, the text shows fine.
>
>
>
> > --
> > Jarek Zgoda
> > Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101
>
> > "We read Knuth so you don't have to." (Tim Peters)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django Snippets-contact form

2007-12-05 Thread mike

Here is the contacts.html page


{% extends "base.html" %}

{% block fulltitle %}Contact me!{% block title %}{% endblock %}{%
endblock %}

{% block header %}
 header of course
{% endblock %}

{% block extrahead %}
{% endblock %}

{% block content-wrap %}








Name:

Email:



Message:




http://path/to/
submitbutton.png"
onclick="YY_checkform('theform','name','#q','0','Field \'name\' is
empty.','Email','#S','2','Field \'Email\' appears not to be
valid.','message','2','1','Field \'message\' is empty.');return
document.MM_returnValue" />









{% endblock %}


### thankyou.html #

On Dec 5, 10:32 am, mike <[EMAIL PROTECTED]> wrote:
> I have been trying to implement the contact form from the Django
> Snippets page found here.
>
> http://www.djangosnippets.org/snippets/261/ I'm able to make it all
> work together, but the contacts.html page, is blank unless i remove
> the{% extends "base.html" %}  part.  After removing it I can see
> the input boxes, but the page is really ugly.   Anyone know why
> importing this template erases everything below it? any help would be
> appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Django Snippets-contact form

2007-12-05 Thread mike

I have been trying to implement the contact form from the Django
Snippets page found here.

http://www.djangosnippets.org/snippets/261/  I'm able to make it all
work together, but the contacts.html page, is blank unless i remove
the{% extends "base.html" %}  part.  After removing it I can see
the input boxes, but the page is really ugly.   Anyone know why
importing this template erases everything below it? any help would be
appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



django widget combo box

2007-12-14 Thread mike

http://code.djangoproject.com/wiki/AJAXWidgetComboBox

Has anyone had any luck with this, I get to the template section and
cant get past the {% load formtags %} part.  I found a formtags.py
from "Koders search" by googling and placed in the django templatetags
folder, but keep getting this error

'formtags' is not a valid tag library: Could not load template library
from django.templatetags.formtags, No module named formtags
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



url.py

2007-12-18 Thread mike

I am trying to get the url.py to display my template based on the
'id'  of my model, but I cannot get this to work, any help would be
appreciated. I have tried the url below and also my view is below, I
would like to be able to visit /admin/display//id-number and see the
ticket corresponding to that id.   All i am getting is 'App not found'


(r'^admin/display/$', show_ticket),
 (r'^admin/display/(\d{2})/$', show_ticket),
 (r'^admin/display/(?P\d+)/$', show_ticket),
 (r'^admin/display/(\d+)/$', show_ticket),
 (r'^admin/display/(\d+)/$', show_ticket),
 )

I have tried
def show_ticket(request):
return HttpResponse("You're looking at poll")


and,
#def show_ticket(request, id):
#   ticket = Ticket.objects.get(pk=id)
#   return render_to_response('ticket_all.html', {'ticket':
ticket})


and,
#from django.shortcuts import render_to_response, get_object_or_404
## ...
#def show_ticket(request, id):
#p = get_object_or_404(Ticket, pk=id)
#return render_to_response('ticket_all.html', {'ticket': p})

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



Re: url.py

2007-12-18 Thread mike

Marty...you de man!!

On Dec 18, 1:20 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote:
> It looks like you've configured the built-in admin at "/admin/", and
> you're defining your custom URLs *later* in the list of URL patterns.
> This means that the admin's URL configuration will see
> "/admin/display/12/" and assume it's supposed to route to its view for
> an app named "display" and a model named "12". This clearly doesn't
> exist, which is why you're getting that error.
>
> You have three options:
> * Change the URL you'd like "show_ticket" to use, so that it doesn't
> start with "/admin/"
> * Change the prefix you're using for the admin
> * Move your "show_ticket" pattern *above* the admin configuration, so
> that yours will be found before the admin's
>
> -Gul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



django.views.generic.list_detail and foreign keys

2007-12-19 Thread mike

Hello, I have built an entry form using
django.views.generic.list_detail much like the one shown here,
http://blog.michaeltrier.com/2007/11/23/getting-started-with-newforms

The only problem is my model has a foreign key that uses edit_inline.
Can anyone point me in the right direction how to get this to also
display on my form?

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



django.views.generic.list_detail and foreign keys

2007-12-19 Thread mike

Hello, I have built an entry form using
django.views.generic.list_detail much like the one shown here,
http://blog.michaeltrier.com/2007/11/23/getting-started-with-newforms

The only problem is my model has a foreign key that uses edit_inline.
Can anyone point me in the right direction how to get this to also
display on my form?

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



Re: django.views.generic.list_detail and foreign keys

2007-12-19 Thread mike


My two models are below,

class Customer(models.Model):
name = models.CharField(maxlength=100)
service = models.CharField(max_length=20,blank=True, default=4,
choices=SERVICE_CODES)
company = models.CharField(core=True,max_length=20,blank=True,
default=4, choices=CUSTOMER_TYPES)
email = models.CharField(blank=True, maxlength=100)
phone_number = models.CharField(blank=True, maxlength=100)
phone_number2 = models.CharField(blank=True, maxlength=100)
IP_address = models.CharField(blank=True, maxlength=100)
submitted_date = models.DateField(auto_now_add=True)
modified_date = models.DateField(auto_now=True)
description = models.TextField(blank=True)
class Admin:
list_display = ('name', 'service', 'phone_number',
'IP_address', 'company', 'email', 'modified_date')
list_filter = ('service', 'company')
search_fields = ('name',
'description','email','phone_number','IP_address')
class Meta:
ordering = ('service', 'submitted_date', 'name')

def __str__(self):
return self.name


class Issue(models.Model):
issue = models.TextField(blank=True,core=True)
date = models.DateField()
customer = models.ForeignKey(Customer,
edit_inline=models.TABULAR,related_name="Customer")
def __unicode__(self):
return self.issue

class Meta:
ordering = ('issue',)


On Dec 19, 5:31 pm, mike <[EMAIL PROTECTED]> wrote:
> Hello, I have built an entry form using
> django.views.generic.list_detail much like the one shown 
> here,http://blog.michaeltrier.com/2007/11/23/getting-started-with-newforms
>
> The only problem is my model has a foreign key that uses edit_inline.
> Can anyone point me in the right direction how to get this to also
> display on my form?
>
> thx in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



django newforms and base_fields

2007-12-20 Thread mike

Hello, I am looking for a way to auto-populate a newforms field, I
would like to have the input hidden, and be auto-populated with the
name field of the Customer class the Issue class is a foreign key to
the Customer class can anyone point me in the right direction, any
help would be appreciated, should I use base_fields or is there a
better way?


def add_edit_customer(request, id=None):
   if id is None:
CustomerEntryForm = forms.form_for_model(Customer)
   else:
IssueEntryForm = forms.form_for_model(Issue)
entry = get_object_or_404(Customer, pk=id)
issues = Issue.objects.filter(name=entry.name)
CustomerEntryForm = forms.form_for_instance(entry)
cust1 = Customer.objects.get(pk=id)
issues = Issue.objects.filter(customer=cust1)
IssueEntryForm.base_fields['customer'].widget =
widgets.HiddenInput()
IssueEntryForm.base_fields['customer'] = cust1.name

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



forms.form_for_model

2007-12-20 Thread mike

anyone know how to auto assign a variable to my form field?


IssueEntryForm.base_fields['customer'].widget = widgets.HiddenInput()
IssueEntryForm.base_fields['customer'].widget = HELP

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



Re: forms.form_for_model

2007-12-21 Thread mike

Sorry if I was unclean, I just discovered this and I am still learning
newforms, I am using forms.form_for_model and trying to get two form
to display in my template, only 1 is a foreign key that I used
edit_inline with my model, I am trying to get the 'customer' field of
my issue to be hidden and automatically be given the 'name' field of
my customer model, when I did what you suggested I get the error
below, my view is below, thx for the suggestion

type object 'IssueForm' has no attribute 'initial'




@staff_member_required
def add_edit_customer(request, id=None):
   if id is None:
CustomerEntryForm = forms.form_for_model(Customer)
   else:
entry = get_object_or_404(Customer, pk=id)
IssueEntryForm = forms.form_for_model(Issue,
fields=('issue''customer'))
issues = Issue.objects.filter(name=entry.name)
CustomerEntryForm = forms.form_for_instance(entry)
cust1 = Customer.objects.get(pk=id)
issues = Issue.objects.filter(customer=cust1)
IssueEntryForm.base_fields['customer'].widget =
widgets.HiddenInput()
IssueEntryForm.initial['customer'] = "Blah, Inc."

   if request.method == 'POST':
form = CustomerEntryForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/customers')
   if request.method == 'POST':
form1 = IssueEntryForm(request.POST)
if form1.is_valid():
 form1 = form1.save(commit=False)
 form1.customer = entry.name
 form1.save()
return HttpResponseRedirect('/customers/')
   else:
form = CustomerEntryForm()
form1 = IssueEntryForm()
   return render_to_response('add_edit_customer.html', {'form':
form,'issues':issues,'form1':form1})



On Dec 20, 5:59 pm, rskm1 <[EMAIL PROTECTED]> wrote:
> On Dec 20, 2:58 pm, mike <[EMAIL PROTECTED]> wrote:
>
> > anyone know how to auto assign a variable to my form field?
>
> > IssueEntryForm.base_fields['customer'].widget = widgets.HiddenInput()
> > IssueEntryForm.base_fields['customer'].widget = HELP
>
> I'm not sure I understand the question; what exactly do you mean by
> "auto assign a variable"?
>
> If you're looking for a way to set the value of a field in an un-bound
> form, just do the usual:
>   IssueEntryForm.initial['customer'] = "Blah, Inc."
>
> Since there was no visibly editable field, the *bound* form you create
> after the HttpRequest.POST submission comes back will have an
> unmolested "Blah, Inc." value in
> IssueEntryForm.cleaned_data['customer']
>
> (If that's not what you were after, you may want to elaborate.  Your
> example code looks like you want to dynamically determine what the
> widget for the field will be, but that doesn't match the question you
> asked...)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django newforms and base_fields

2007-12-21 Thread mike

It tells me

Column 'customer_id' cannot be null")   because of the foreign key,
customer_id is the id of the customer, that the Issues field is linked
to. How do i auto fill in this field?

On Dec 20, 10:17 pm, Empty <[EMAIL PROTECTED]> wrote:
> This is not a very secure thing to do.  But if you must, then just use
> initial to set the value.
>
> Michael Trier
> blog.michaeltrier.com
>
> On Dec 20, 2007 2:32 PM, mike <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello, I am looking for a way to auto-populate a newforms field, I
> > would like to have the input hidden, and be auto-populated with the
> > name field of the Customer class the Issue class is a foreign key to
> > the Customer class can anyone point me in the right direction, any
> > help would be appreciated, should I use base_fields or is there a
> > better way?
>
> > def add_edit_customer(request, id=None):
> >if id is None:
> > CustomerEntryForm = forms.form_for_model(Customer)
> >else:
> > IssueEntryForm = forms.form_for_model(Issue)
> > entry = get_object_or_404(Customer, pk=id)
> > issues = Issue.objects.filter(name=entry.name)
> > CustomerEntryForm = forms.form_for_instance(entry)
> > cust1 = Customer.objects.get(pk=id)
> > issues = Issue.objects.filter(customer=cust1)
> > IssueEntryForm.base_fields['customer'].widget =
> > widgets.HiddenInput()
> > IssueEntryForm.base_fields['customer'] = cust1.name
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: forms.form_for_model

2007-12-21 Thread mike

Thank you for your reply, I did as you suggested but when I save the
form I get the error

(1048, "Column 'customer_id' cannot be null")   customer_id, being the
'id' field of the customer model,


if request.method == 'POST':
form1 = IssueEntryForm(request.POST)
if form1.is_valid():
form1.initial['customer'] = cust1
form1.save()
return HttpResponseRedirect('.')
   else:
form = CustomerEntryForm()
form1 = IssueEntryForm()
form1.initial['customer'] = cust1
   return render_to_response('add_edit_customer.html', {'form':
form,'issues':issues,'form1':form1})




On Dec 21, 7:14 pm, rskm1 <[EMAIL PROTECTED]> wrote:
> Ahh!  That helps.  Sorry, I haven't ever used form_for_model() and
> didn't recognize that IssueEntryForm in the original post was NOT a
> form instance.  Corrections embedded below.
>
> On Dec 21, 8:48 am, mike <[EMAIL PROTECTED]> wrote:
>
>
>
> > Sorry if I was unclean, I just discovered this and I am still learning
> > newforms, I am using forms.form_for_model and trying to get two form
> > to display in my template, only 1 is a foreign key that I used
> > edit_inline with my model, I am trying to get the 'customer' field of
> > my issue to be hidden and automatically be given the 'name' field of
> > my customer model, when I did what you suggested I get the error
> > below, my view is below, thx for the suggestion
>
> > type object 'IssueForm' has no attribute 'initial'
>
> > @staff_member_required
> > def add_edit_customer(request, id=None):
> >if id is None:
> > CustomerEntryForm = forms.form_for_model(Customer)
> >else:
> > entry = get_object_or_404(Customer, pk=id)
> > IssueEntryForm = forms.form_for_model(Issue,
> > fields=('issue''customer'))
> > issues = Issue.objects.filter(name=entry.name)
> > CustomerEntryForm = forms.form_for_instance(entry)
> > cust1 = Customer.objects.get(pk=id)
> > issues = Issue.objects.filter(customer=cust1)
> > IssueEntryForm.base_fields['customer'].widget =
> > widgets.HiddenInput()
> > IssueEntryForm.initial['customer'] = "Blah, Inc."
>
> Sorry, my initial example was completely wrong; initial[] is part of
> the form *instance*, not *class* (I'm a Python novice, so forgive me
> if I botched the teminology there).
> Remove that line and see correction below.
>
>
>
>
>
> >if request.method == 'POST':
> > form = CustomerEntryForm(request.POST)
> > if form.is_valid():
> > form.save()
> > return HttpResponseRedirect('/customers')
> >if request.method == 'POST':
> > form1 = IssueEntryForm(request.POST)
> > if form1.is_valid():
> >  form1 = form1.save(commit=False)
> >  form1.customer = entry.name
> >  form1.save()
> > return HttpResponseRedirect('/customers/')
> >else:
> > form = CustomerEntryForm()
> > form1 = IssueEntryForm()
>
> Add here:
>   form1.initial['customer'] = "Blah, Inc."
>
> Assuming your Issue model has a field named 'customer' (and it's a
> text field), that will cause "Blah, Inc." to appear pre-filled-in when
> the unbound form is rendered.
>
> Taking a wild guess about your models, though, if the Issue model's
> 'customer' field is actually a ForeignKey to a Customer object, change
> that line to:
>   form1.initial['customer'] = cust1
>
> (I'm getting a bit out of my depth here, but I think that should
> work.)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: forms.form_for_model

2007-12-21 Thread mike

The issues model is a foreign key to my customer model.

On Dec 21, 10:40 pm, mike <[EMAIL PROTECTED]> wrote:
> Thank you for your reply, I did as you suggested but when I save the
> form I get the error
>
> (1048, "Column 'customer_id' cannot be null")   customer_id, being the
> 'id' field of the customer model,
>
> if request.method == 'POST':
> form1 = IssueEntryForm(request.POST)
> if form1.is_valid():
> form1.initial['customer'] = cust1
> form1.save()
> return HttpResponseRedirect('.')
>else:
> form = CustomerEntryForm()
> form1 = IssueEntryForm()
> form1.initial['customer'] = cust1
>return render_to_response('add_edit_customer.html', {'form':
> form,'issues':issues,'form1':form1})
>
> On Dec 21, 7:14 pm, rskm1 <[EMAIL PROTECTED]> wrote:
>
> > Ahh!  That helps.  Sorry, I haven't ever used form_for_model() and
> > didn't recognize that IssueEntryForm in the original post was NOT a
> > form instance.  Corrections embedded below.
>
> > On Dec 21, 8:48 am, mike <[EMAIL PROTECTED]> wrote:
>
> > > Sorry if I was unclean, I just discovered this and I am still learning
> > > newforms, I am using forms.form_for_model and trying to get two form
> > > to display in my template, only 1 is a foreign key that I used
> > > edit_inline with my model, I am trying to get the 'customer' field of
> > > my issue to be hidden and automatically be given the 'name' field of
> > > my customer model, when I did what you suggested I get the error
> > > below, my view is below, thx for the suggestion
>
> > > type object 'IssueForm' has no attribute 'initial'
>
> > > @staff_member_required
> > > def add_edit_customer(request, id=None):
> > >if id is None:
> > > CustomerEntryForm = forms.form_for_model(Customer)
> > >else:
> > > entry = get_object_or_404(Customer, pk=id)
> > > IssueEntryForm = forms.form_for_model(Issue,
> > > fields=('issue''customer'))
> > > issues = Issue.objects.filter(name=entry.name)
> > > CustomerEntryForm = forms.form_for_instance(entry)
> > > cust1 = Customer.objects.get(pk=id)
> > > issues = Issue.objects.filter(customer=cust1)
> > > IssueEntryForm.base_fields['customer'].widget =
> > > widgets.HiddenInput()
> > > IssueEntryForm.initial['customer'] = "Blah, Inc."
>
> > Sorry, my initial example was completely wrong; initial[] is part of
> > the form *instance*, not *class* (I'm a Python novice, so forgive me
> > if I botched the teminology there).
> > Remove that line and see correction below.
>
> > >if request.method == 'POST':
> > > form = CustomerEntryForm(request.POST)
> > > if form.is_valid():
> > > form.save()
> > > return HttpResponseRedirect('/customers')
> > >if request.method == 'POST':
> > > form1 = IssueEntryForm(request.POST)
> > > if form1.is_valid():
> > >  form1 = form1.save(commit=False)
> > >  form1.customer = entry.name
> > >  form1.save()
> > > return HttpResponseRedirect('/customers/')
> > >else:
> > > form = CustomerEntryForm()
> > > form1 = IssueEntryForm()
>
> > Add here:
> >   form1.initial['customer'] = "Blah, Inc."
>
> > Assuming your Issue model has a field named 'customer' (and it's a
> > text field), that will cause "Blah, Inc." to appear pre-filled-in when
> > the unbound form is rendered.
>
> > Taking a wild guess about your models, though, if the Issue model's
> > 'customer' field is actually a ForeignKey to a Customer object, change
> > that line to:
> >   form1.initial['customer'] = cust1
>
> > (I'm getting a bit out of my depth here, but I think that should
> > work.)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: forms.form_for_model

2007-12-21 Thread mike

The issues model is a foreign key to my customer model.

On Dec 21, 10:40 pm, mike <[EMAIL PROTECTED]> wrote:
> Thank you for your reply, I did as you suggested but when I save the
> form I get the error
>
> (1048, "Column 'customer_id' cannot be null")   customer_id, being the
> 'id' field of the customer model,
>
> if request.method == 'POST':
> form1 = IssueEntryForm(request.POST)
> if form1.is_valid():
> form1.initial['customer'] = cust1
> form1.save()
> return HttpResponseRedirect('.')
>else:
> form = CustomerEntryForm()
> form1 = IssueEntryForm()
> form1.initial['customer'] = cust1
>return render_to_response('add_edit_customer.html', {'form':
> form,'issues':issues,'form1':form1})
>
> On Dec 21, 7:14 pm, rskm1 <[EMAIL PROTECTED]> wrote:
>
> > Ahh!  That helps.  Sorry, I haven't ever used form_for_model() and
> > didn't recognize that IssueEntryForm in the original post was NOT a
> > form instance.  Corrections embedded below.
>
> > On Dec 21, 8:48 am, mike <[EMAIL PROTECTED]> wrote:
>
> > > Sorry if I was unclean, I just discovered this and I am still learning
> > > newforms, I am using forms.form_for_model and trying to get two form
> > > to display in my template, only 1 is a foreign key that I used
> > > edit_inline with my model, I am trying to get the 'customer' field of
> > > my issue to be hidden and automatically be given the 'name' field of
> > > my customer model, when I did what you suggested I get the error
> > > below, my view is below, thx for the suggestion
>
> > > type object 'IssueForm' has no attribute 'initial'
>
> > > @staff_member_required
> > > def add_edit_customer(request, id=None):
> > >if id is None:
> > > CustomerEntryForm = forms.form_for_model(Customer)
> > >else:
> > > entry = get_object_or_404(Customer, pk=id)
> > > IssueEntryForm = forms.form_for_model(Issue,
> > > fields=('issue''customer'))
> > > issues = Issue.objects.filter(name=entry.name)
> > > CustomerEntryForm = forms.form_for_instance(entry)
> > > cust1 = Customer.objects.get(pk=id)
> > > issues = Issue.objects.filter(customer=cust1)
> > > IssueEntryForm.base_fields['customer'].widget =
> > > widgets.HiddenInput()
> > > IssueEntryForm.initial['customer'] = "Blah, Inc."
>
> > Sorry, my initial example was completely wrong; initial[] is part of
> > the form *instance*, not *class* (I'm a Python novice, so forgive me
> > if I botched the teminology there).
> > Remove that line and see correction below.
>
> > >if request.method == 'POST':
> > > form = CustomerEntryForm(request.POST)
> > > if form.is_valid():
> > > form.save()
> > > return HttpResponseRedirect('/customers')
> > >if request.method == 'POST':
> > > form1 = IssueEntryForm(request.POST)
> > > if form1.is_valid():
> > >  form1 = form1.save(commit=False)
> > >  form1.customer = entry.name
> > >  form1.save()
> > > return HttpResponseRedirect('/customers/')
> > >else:
> > > form = CustomerEntryForm()
> > > form1 = IssueEntryForm()
>
> > Add here:
> >   form1.initial['customer'] = "Blah, Inc."
>
> > Assuming your Issue model has a field named 'customer' (and it's a
> > text field), that will cause "Blah, Inc." to appear pre-filled-in when
> > the unbound form is rendered.
>
> > Taking a wild guess about your models, though, if the Issue model's
> > 'customer' field is actually a ForeignKey to a Customer object, change
> > that line to:
> >   form1.initial['customer'] = cust1
>
> > (I'm getting a bit out of my depth here, but I think that should
> > work.)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: forms.form_for_model

2007-12-26 Thread mike

Thanks for the reply I tried using the method you described and
searched the __init__.py, but just couldnt make any sense of it,

def my_callback(field, **kwargs):
if f.name == 'customer':
   return f.formfield(formfclass=forms.HiddenInput)

gives me

global name 'f' is not defined

def my_callback(field, **kwargs):
cust1 = Customer.objects.get(pk=id)
if field.name == 'customer':
return cust1
else:
return field.formfield(**kwargs)

gives me


id() takes exactly one argument (0 given)




On Dec 21, 10:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-12-21 at 06:48 -0800, mike wrote:
> > Sorry if I was unclean, I just discovered this and I am still learning
> > newforms, I am using forms.form_for_model and trying to get two form
> > to display in my template, only 1 is a foreign key that I used
> > edit_inline with my model, I am trying to get the 'customer' field of
> > my issue to be hidden and automatically be given the 'name' field of
> > my customer model, when I did what you suggested I get the error
> > below, my view is below, thx for the suggestion
>
> Use the formfield_callback attribute, which is a function that is called
> for every field. It needs to return a newforms.field.* class.
>
> The default definition of formfield_callback is
>
> lambda f: f.formfield()
>
> so your version should return f.formfield() (f is the single parameter
> passed to the callback and is a django.db.models.fields.* instance) for
> any fields you're not customising. If you are customising a field, you
> do something like this:
>
> if f.name == 'customer':
>return f.formfield(formfclass=forms.HiddenInput)
>
> Have a read of the code in django/db/models/fields/__init__.py to see
> how formfield() methods work and play around a bit. As usual for Python,
> five minutes of experimenting is more educational than pages of written
> text.
>
> Regards,
> Malcolm
>
> --
> The sooner you fall behind, the more time you'll have to catch 
> up.http://www.pointy-stick.com/blog/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: forms.form_for_model

2007-12-27 Thread mike

Yes, I found your post a while back, that is where I am learning most
of this, great post.  I tried this and got

'ModPythonRequest' object has no attribute 'customer'

I think i am close though, here is my code:

 else:
IssueEntryForm = forms.form_for_model(Issue,
fields=('issue''customer'))
entry = get_object_or_404(Customer, pk=id)
issues = Issue.objects.filter(name=entry.name)
CustomerEntryForm = forms.form_for_instance(entry)
cust1 = Customer.objects.get(pk=id)
issues = Issue.objects.filter(customer=cust1).order_by('-
date')
   IssueEntryForm.base_fields['customer'].widget =
widgets.HiddenInput()
   IssueEntryForm.base_fields['customer'].required = False

   if request.method == 'POST':
form = CustomerEntryForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('.')
   if request.method == 'POST':
form1 = IssueEntryForm(request.POST)
if form1.is_valid():
entry = form1.save(commit=False)
entry.customer = request.customer
entry.save()
return HttpResponseRedirect('.')
   else:
form = CustomerEntryForm()
form1 = IssueEntryForm()
   return render_to_response('add_edit_customer.html', {'form':
form,'issues':issues,'form1':form1})


On Dec 26, 6:52 pm, Empty <[EMAIL PROTECTED]> wrote:
> > Thanks for the reply I tried using the method you described and
> > searched the __init__.py, but just couldnt make any sense of it,
>
> > def my_callback(field, **kwargs):
> > if f.name == 'customer':
> >return f.formfield(formfclass=forms.HiddenInput)
>
> Since you're receiving the field as 'field' that's what you need to use:
>
> See my post here:http://blog.michaeltrier.com/2007/11/23/customizing-newforms
>
> It shows exactly what you are trying to do in the section on formfield
> callbacks.
>
> Michael Trier
> blog.michaeltrier.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: forms.form_for_model

2007-12-27 Thread mike

I finally got it working without using formfield callbacks, I used the
"Modifying it Inline" portion of your post, thx for all of the help.
Here is a snipped in case it helps anyone else,


@staff_member_required
def add_edit_customer(request, id=None):
   if id is None:
CustomerEntryForm = forms.form_for_model(Customer)
form = CustomerEntryForm()
return render_to_response('add_edit_customer.html', {'form':
form})
   else:
IssueEntryForm = forms.form_for_model(Issue)
entry = get_object_or_404(Customer, pk=id)
issues = Issue.objects.filter(name=entry.name)
CustomerEntryForm = forms.form_for_instance(entry)
cust1 = Customer.objects.get(pk=id)
issues = Issue.objects.filter(customer=cust1).order_by('-
date')
   IssueEntryForm.base_fields['customer'].widget =
widgets.HiddenInput()
   IssueEntryForm.base_fields['customer'].required = False
   if request.method == 'POST':
form = CustomerEntryForm(request.POST)
form1 = IssueEntryForm(request.POST)
cust1 = Customer.objects.get(pk=id)
if form.is_valid():
form.save()
return HttpResponseRedirect('.')
if form1.is_valid():
entry = form1.save(commit=False)
entry.customer = cust1
entry.save()
 return HttpResponseRedirect('.')
   else:
form = CustomerEntryForm()
form1 = IssueEntryForm()
   return render_to_response('add_edit_customer.html', {'form':
form,'issues':issues,'form1':form1})




On Dec 27, 9:24 am, mike <[EMAIL PROTECTED]> wrote:
> Yes, I found your post a while back, that is where I am learning most
> of this, great post.  I tried this and got
>
> 'ModPythonRequest' object has no attribute 'customer'
>
> I think i am close though, here is my code:
>
>  else:
> IssueEntryForm = forms.form_for_model(Issue,
> fields=('issue''customer'))
> entry = get_object_or_404(Customer, pk=id)
> issues = Issue.objects.filter(name=entry.name)
> CustomerEntryForm = forms.form_for_instance(entry)
> cust1 = Customer.objects.get(pk=id)
> issues = Issue.objects.filter(customer=cust1).order_by('-
> date')
>IssueEntryForm.base_fields['customer'].widget =
> widgets.HiddenInput()
>IssueEntryForm.base_fields['customer'].required = False
>
>if request.method == 'POST':
> form = CustomerEntryForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect('.')
>if request.method == 'POST':
> form1 = IssueEntryForm(request.POST)
> if form1.is_valid():
> entry = form1.save(commit=False)
> entry.customer = request.customer
> entry.save()
> return HttpResponseRedirect('.')
>else:
> form = CustomerEntryForm()
> form1 = IssueEntryForm()
>return render_to_response('add_edit_customer.html', {'form':
> form,'issues':issues,'form1':form1})
>
> On Dec 26, 6:52 pm, Empty <[EMAIL PROTECTED]> wrote:
>
> > > Thanks for the reply I tried using the method you described and
> > > searched the __init__.py, but just couldnt make any sense of it,
>
> > > def my_callback(field, **kwargs):
> > > if f.name == 'customer':
> > >return f.formfield(formfclass=forms.HiddenInput)
>
> > Since you're receiving the field as 'field' that's what you need to use:
>
> > See my post 
> > here:http://blog.michaeltrier.com/2007/11/23/customizing-newforms
>
> > It shows exactly what you are trying to do in the section on formfield
> > callbacks.
>
> > Michael Trier
> > blog.michaeltrier.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: django widget combo box

2008-01-02 Thread mike

I have used the formtags that is inluded in the nongselect tar
package. It seems with the development version of django the import
statements   {% load formtags %}  no longer work,   I need a way to
replace the

{% selectrow form.reporter "/myapp/reporter_lookup/?q=%{searchString}"
"first_name" %}

Line with raw html for a text input box that will call this ajax
function for me.   I have been googling for days with no luck.
I'm using the newforms library and  form_for_instance


On Dec 15 2007, 9:01 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On Dec 15, 1:40 am, mike <[EMAIL PROTECTED]> wrote:
>
> >http://code.djangoproject.com/wiki/AJAXWidgetComboBox
>
> > Has anyone had any luck with this, I get to the template section and
> > cant get past the {% load formtags %} part.  I found a formtags.py
> > from "Koders search" by googling and placed in the django templatetags
> > folder, but keep getting this error
>
> > 'formtags' is not a valid tag library: Could not load template library
> > from django.templatetags.formtags, No module named formtags
>
> Hi, I'm the original author of that widget though I don't use it
> anymore myself so I'm not even sure it will work with recent versions
> of django. The formtags.py file is included with the
> nongselect-1.0.tar.gz file attached to that page. Who knows whether
> the one you are using is the same as the one I wrote.
>
> regards
>
> matthew
>
> --
> Matthew Flanaganhttp://wadofstuff.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?hl=en
-~--~~~~--~~--~--~---



Re: Django, Postgres and Server Crash

2006-10-16 Thread Mike

James,

Thanks for your response.

I just svn update my django directory. Doesn't the latest django
version reflect all the bug fixes? Do I have to check out
0.91-bugfixes?

Pressing 'c' on top clears everything a little bit. One thing I think I
forgot to mention is 90% of the time the server load is moderate. It is
3 times a week around early in the morning that my django and postgres
start dancing to death for me. Given that my server hardware handles
the peak time with no problem, I don't think I need to upgrade the
server.

The only out of norm activity I run is creating my data aggregate
tables 3 times a day that take load to 90% with postgres for about 5
minutes and then goes back to norm.

My guess is that somehow those aggregate builders are not cleaning up
afterwords that cause the server to start overloading and die after 5
to 6 hours. 

Thanks for your attention,
Sia


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

2006-10-16 Thread Mike


> What are the specs of the server? Specifically, how much RAM does it
> have and how fast are its disks? What processors are in the machine
> (for postgres, Xeons are bad, Opterons are very, very good)?

The server is rather new. 2GB of memory with a top grade Opteron (not
sure which). Once again, the server is running with low load for most
of the day, and as much as I want to, I have hard time believing its
the server that is to blame. 

Thanks,
Sia


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



HttpResponseRedirect and Request Header

2006-10-27 Thread Mike

HttpResponseRedirect fully preserves the page header sent to it and
forwards it to whatever URL it is being sent to. For instance, if a
user is going from Google to site A, where he is immidiatly
'HttpResponseRedirect'ed to site B, site B only has knowledge of Google
as apposed to site A.

How can I prevent HttpResponseRedirect from forwarding the header it
was supplied with?

Thank you,
Mike


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



Re: HttpResponseRedirect and Request Header

2006-10-27 Thread Mike

Hi Sam,

Allow me to clarify my question:

User clicks on a link(pointing to B) on site A
Site B is implementing a HttpResponseRedirect to site C
Site C recieves the request with the header sent from A to B. That is,
it has no idea B exists. I don't want C to know about A :)

Mike


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



Debugging with Winpdb

2006-11-07 Thread Mike

Hello,

I've been trying to debug a Django sample application with Winpdb, but
haven't been successful thus far. Can anyone who's able to do this
please share your secret? ;)

I'm using the GUI and have tried the "Attach" option but see no
processes available, and the "Launch" option which hangs and ultimately
gives a timeout error on the "debugee."

I ran FileMon (I'm on XP) to see if there were any permission issues
but couldn't find any.

Thanks!


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



Re: Order_by problems

2006-11-08 Thread Mike

Hi L,

Could it be that the 'W' in 'Word' in your order_by attribute is in
upper-case?

- Mike


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



Re: Debugging with Winpdb

2006-11-10 Thread Mike

Anybody debugging Django apps successfully with Winpdb?


--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google 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: Large scale Django deployment - advice needed

2007-01-27 Thread Mike

Jason,

Have you seen Chapter 21 of The Django Book, just released a few days 
ago?

Chapter 21: Deploying Django
http://www.djangobook.com/en/beta/chapter21/

It discusses load balancing and performance, and mentions the 
following:

"At this point, we've now broken things down as much as possible. This 
three-server setup should handle a very large amount of traffic - we 
served around ten million hits a day from an architecture of this sort 
- so if you grow further, you'll need to start adding redundancy."

Hopefully you'll get some more detailed responses to your post, but 
maybe this will get you started in the meantime.

> Can anyone suggest where I would begin in estimating the quantity of
> servers that I would need?


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



Newforms and generic views

2007-01-29 Thread Mike

Hi folks,

Can anyone share information regarding the current timeline and plans 
for newforms and integrating newforms with generic views? I did look 
over the website and searched the archives of the dev group but didn't 
see a recent estimate. I'd gladly help out, but I'm somewhat new to 
Django and it seems there are already quite a few chefs in the 
kitchen. ;)

What led me down this path--besides general interest and planning 
concerns--is an investigation into how best to present errors using 
generic views in a list format. It appears that newforms includes an 
"errors" property, while oldforms errors can be accessed using 
"error_dict." At the same time, I'd like to highlight fields with 
errors using a custom style, but don't see how to pass a style to form 
fields when used with generic views. [Does that make sense? Basically 
I'd like to show an error list and mark fields with a red border when 
there are errors, instead of listing error messages next to each 
individual form element.]


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

2007-01-29 Thread Mike



On Jan 29, 4:57 pm, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
> On 1/29/07 3:28 PM, Mike wrote:
>
> > Can anyone share information regarding the current timeline and plans
> > for newforms and integrating newforms with generic views?Generally we don't 
> > really put out "timelines" per-se.
>
> You see, we're all volunteers around here, and committing to a solid timeline
> seems the best way to ensure that we miss it.  Until we've got people who
> actually get paid full-time to work on Django[*], this is how it'll be.
>
> > I did look
> > over the website and searched the archives of the dev group but didn't
> > see a recent estimate. I'd gladly help out, but I'm somewhat new to
> > Django and it seems there are already quite a few chefs in the
> > kitchen. ;)Actually, though, there hasn't been anyone who's (so far) 
> > volunteered to work
> on bring newforms into generic views. So, if that's something you'd like to
> work on, we'd all love it if you jump on over to django-dev and offer your
> services.
>
> > What led me down this path--besides general interest and planning
> > concerns--is an investigation into how best to present errors using
> > generic views in a list format. It appears that newforms includes an
> > "errors" property, while oldforms errors can be accessed using
> > "error_dict." At the same time, I'd like to highlight fields with
> > errors using a custom style, but don't see how to pass a style to form
> > fields when used with generic views. [Does that make sense? Basically
> > I'd like to show an error list and mark fields with a red border when
> > there are errors, instead of listing error messages next to each
> > individual form element.]FYI, this is usually how I do it::
>
> 
> {{ form.field }}
> 
>
> Then I can use a CSS rule like::
>
> div.error input { ... }
>
> To stype fields with errors.
>
> Sensemakemuch?
>
> Jacob


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



Re: Newforms and generic views

2007-01-29 Thread Mike

Hey Jacob,

Thanks for your pointer regarding error highlighting--Igotsit.

> Actually, though, there hasn't been anyone who's (so far) volunteered to work
> on bring newforms into generic views. So, if that's something you'd like to
> work on, we'd all love it if you jump on over to django-dev and offer your
> services.

I might just do that (you'll all be sorry ;).

In the meantime, let's ring in the year 1984 with our good friend 
David Lee Roth:

http://youtube.com/watch?v=fJPAG4V98vQ


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

2007-01-31 Thread Mike

There's also a documentation section for this topic located here:

Sending e-mail
http://www.djangoproject.com/documentation/email/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Easy way to determine runtime environment?

2007-02-09 Thread Mike

Hello,

> Is there an easy way to adjust the media location based on the
> server environment?

Perhaps the following link will help. Check out the code from Mikko
Ohtamaa in the Comments section.

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


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: confused again: a "home page" can't be some special case

2006-06-06 Thread Mike

Rudolph and James Bennett, did you create your own custom templatetags?
If so, how did you go about doing it? I've been working on building and
adding menus to django templates that are populated with other content
as well, and I'd be interested in learning about your approach.


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



Menus parent/child foreign key dropdown too big

2006-07-12 Thread Mike

So here's the deal. I have Menus and MenuItems:

class Menu(models.Model):
name = models.CharField(maxlength=200)

class MenuItem(models.Model):
menu_id = models.ForeignKey(Menu, blank=False, null=False,
edit_inline=models.TABULAR, num_in_admin=3)
parent = models.ForeignKey('self', null=True, blank=True,
related_name='child')
name = models.CharField(maxlength=200, core=True)
url = models.CharField(maxlength=255, core=True)
target = models.CharField(maxlength=200, blank=True,
choices=TARGET_CHOICES)
tagID = models.CharField(maxlength=200, blank=True, null=True)
sequence = models.IntegerField(choices=SEQUENCE_CHOICES)

My problem is that there exist over 1,000 records for MenuItem and the
dropdown list in the Admin has become unwieldy. In the parent dropdown
I would just like to show the MenuItems associated with the menu I'm
currently editing. I can't use raw_id_admin because of the edit_inline
and limit_choices_to hasn't worked because the ID I need to compare it
to comes from the url which the model doesn't have access to. If anyone
can point me in the right direction I'd appreciate it.


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



How do I parse XML in a Django view?

2006-08-18 Thread Mike

We have been creating a content management system in Django which
(despite a few learning bumps) has gone swimmingly. Now, we have
reached an impasse. We have some applications running elsewhere on the
site whose xml data we need to access and display from a django view
function. We read through and experimented with a variety of tutorials
(since we're all still very new to python) and found several approaches
that seem to work when written in the shell. Adding them to django
however has proved to be very difficult. Regardless of what we try, it
seems impossible to get django to kick out the information we want or
even to have it generate an error message that would give us some kind
of feedback. The current iteration that we have experimented with looks
like this (a shameless ripoff from the Python Cookbook):

from xml.sax import make_parser
from xml.sax.handler import ContentHandler

def catalog(request):
class countHandler(ContentHandler):
def __init__(self):
self.tags = {}
def startElement(self, name, attr):
self.tags[name] = 1 + self.tags.get(name,0)

parser = make_parser()
handler = countHandler()
parser.setContentHandler(handler)
parser.parse("/usr/web/www/test.xml")
tags = handler.tags.keys()
tags.sort()

datum = ""
for tag in tags:
datum = "%s%s - %s" % (datum, tag, handler.tags[tag])
return render_to_response('templates/generic_output.html',
{'output':datum})

We have also tried using minidom with no success. Any pointers in the
right direction would be incredibly helpful.

Thanks,
Mike


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



Re: How do I parse XML in a Django view?

2006-08-18 Thread Mike

Please bear with me as I continue to learn and struggle. We installed
ElementTree and started tinkering around with it, but we are still
having problems when we try to have the view pass anything to the
templates. The code has been stripped down to:

from sputnik.utils.elementtree.elementtree import ElementTree
def catalog(request):
xml_doc = ElementTree.parse('/usr/web/www/test_catalog.xml')
raise IndexError, "Can we at least get to here?"

datum = 'lalala'
return render_to_response('path_to/generic_output.html',
{'output':datum})

Where generic_output.html will just display {{output}}. When we call up
this page, the IndexError is not raised and nothing is displayed on the
page (or in the source for the page), not even "lalala". When we play
around with this same code in the shell, it handles everything as
expected, we just can't seem to make it show up properly (or at all for
now) on the templates.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 do I parse XML in a Django view?

2006-08-18 Thread Mike

Yes to both. I'm assuming the url configuration is correct because if I
attempt to use regular file reading and writing everything works fine
and if I change the name of the file I'm parsing to something that
doesn't exist, the page throws an error. The file is readable and
writeable (for test purposes only) and I experimented with both the
general web server user and the user that django utilizes. The results
are still a blank page.


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



Is django authentication right for me?

2006-01-02 Thread Mike

Hi,

I am creating an application that will have multiple companies, with
each having multiple users that would have to login to my system more
like the way basecamp has it. I enjoyed what django authentication can
do for me, but then again I could implement them myself to have groups
and rights and so forth. What would you do? Utilize Django's or
create your own for my situation?

Thanks,
Mike



How to simplify my views?

2006-01-02 Thread Mike

Hi,

I am creating an application similar to basecamp. On every view I need
to do lots of book keeping such as checking to see if company exists,
user exists, user is logged in, etc. before I can do what the view is
actually there to do. That is a lot of redundancy as apposed to having
a controller that would take care of bookkeeping before my view is
loaded. What's the remedy?

One idea I had was to create a class that would take 'request'
object and takes care of redundant work and returns a dictionary
containing all the data I need which I would forward to my template.

Ideas are appreciate here,

Regards,
Mike



Re: Undo in Django

2006-01-04 Thread Mike

I'd say, in your 'change history' table, place a field and save the
state of all effected data before the actual change is frozen.

Good luck,
Armin



Django DB Design Question (help please!)

2006-01-09 Thread Mike

Hi,

I have a model with multiple companies (Basecamp Style), where each
have multiple users and multiple company news. Which of the two way is
more appropriate:

1: Company -one-to-many> User one-to-many> NewsPosting

2: Company -one-to-many> User
   |one-to-many> NewsPosting

Where Company, User and NewsPosting are tables.

With approach 1, I have to add a function to Company called
get_newsposting_list() that gets the list of postings for a company
through SQL. (Is there any easier way to do this? Can't django automate
this process?)

With approach 2, somehow in my NewsPosting table I have to add a field
called user_id, that lets me know which user was responsible for this
posting, and add a function to NewsPosting: get_user() and another
function to User: get_newsposting_list() which isn't as clean either.
There must be an easier way to do this with Django, or if not I think
it's a good feature to add!

I like approach #2 better.

Regards,
Mike



  1   2   3   4   5   6   7   8   9   10   >