Display Certain Fields of the Model Formset As Text

2009-10-29 Thread Anthony Simonelli

Hello,

I am using a Model Formset because there are two foreign keys in my Model and 
it makes it easy to create forms with them preselected from data in my model:

class ForecastActualSum(models.Model):
sales_rep = models.ForeignKey(SalesrepGrpname)
customer = models.ForeignKey(Customer)
item = models.CharField(max_length=200)
actual = models.FloatField(null=True, blank=True)
forecast = models.FloatField(null=True, blank=True)
plan = models.FloatField(null=True, blank=True)

When using a model formset, all the fields are displayed and are editable, but 
I just want the 'forecast' field to be editable and the rest of the fields to 
be displayed.  Is there any way to display the fields as text rather than as 
input fields?  I've also tried sending the corresponding ForecastActualSum 
objects along with the formset to the template to be displayed along side 
formset, but I can't iterate both at the same time to make them line up like a 
table.  Anyone have any ideas?  Maybe model formset is not the way to go?

Anthony

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



setting up headache migrating to apache

2009-10-29 Thread Mike Dewhirst

I'm trying to replicate my (working ok) winxp testing environment on 
openSuSE 11.1 with Apache2 as a parallel testing environment. We're 
nowhere near production at the moment.

The problem I'm having on openSuSE when i try /usr/bin/python 
/srv/www/vhosts/ccm/climate/ccm/tests.py is ...

Traceback (most recent call last):
   File "/srv/www/vhosts/ccm/climate/ccm/tests.py", line 7, in 
 from django.contrib.auth.models import User
   File 
"/usr/lib64/python2.6/site-packages/django/contrib/auth/models.py", line 
6, in 
 from django.db import models
   File "/usr/lib64/python2.6/site-packages/django/db/__init__.py", line 
10, in 
 if not settings.DATABASE_ENGINE:
   File "/usr/lib64/python2.6/site-packages/django/utils/functional.py", 
line 268, in __getattr__
 self._setup()
   File "/usr/lib64/python2.6/site-packages/django/conf/__init__.py", 
line 38, in _setup
 raise ImportError("Settings cannot be imported, because environment 
variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable 
DJANGO_SETTINGS_MODULE is undefined.

... BUT ...

in /etc/pythonstart

   
   import sys
   sys.path.append('/srv/www/vhosts/ccm')
   

... AND ...

in /etc/profile.local
   export DJANGO_SETTINGS_MODULE=climate.settings

Then after restarting the computer, os.environ includes ...
'DJANGO_SETTINGS_MODULE': 'climate.settings',
... among all the other environment variables.

Physically, the settings file is ...

   /srv/www/vhosts/ccm/climate/settings.py

... and I can launch /usr/bin/python (2.6.0 as provided by openSuSE 
11.1) and prove /srv/www/vhosts/ccm/ is on the pythonpath by doing ...

~>/usr/bin/python
Python 2.6 (r26:66714, Feb  3 2009, 20:49:49)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import climate.settings
ldaps://192.168.0.188:636
 >>>

... where the above output is embedded in a print statement in 
settings.py and proves there are no syntax errors in settings.py

I have also tried all the above as root and get the same results so I 
don't think it is a permissions thing.

Can any kind person see where I'm going wrong?



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



Darpa challenge

2009-10-29 Thread Adam Nelson

All,

In case people hadn't heard, DARPA just announced what I think is the
coolest competition ever:

http://networkchallenge.darpa.mil/

On December 5, DARPA will raise 10 red weather balloons somewhere in
the US.  The first person to get the location of all 10 balloons and
submit them will be given $40k.

I'm proposing that if "I" win, half the money ($20k) will be given to
the Django Software Foundation.  The other half ($20k) will go to the
Python Software Foundation.

I've set up a StackOverflow site for coordination for anybody who
would like to join:

http://darpa.stackexchange.com/

I think the first thing that needs to happen is to get a critical mass
of users on the site and to use the Q capabilities of the site to
figure out what tools we should use next.

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



View code to auto-update FileField with pdf

2009-10-29 Thread bweiss

I've set up my app to generate a pdf file based on user selections
(following these instructions here:
http://www.20seven.org/journal/2008/11/pdf-generation-with-pisa-in-django.html).

The code returns

" return http.HttpResponse(result.getvalue(), \
 mimetype='application/pdf')'

prompting the browser open or save the pdf file.

Is there a way to set up the view code so that instead of being opened/
saved, the generated file is automatically uploaded into a specified
field in the database?







--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: GROUP results in views.py

2009-10-29 Thread The Danny Bos


If helpful, here's the table structure.

class ItemOwned(models.Model):
user = models.ForeignKey(User)
item = models.ForeignKey(Item)

class Item(models.Model):
set = models.ForeignKey(Set)
number = models.IntegerField()

class Set(models.Model):
title = models.CharField(max_length=50, unique=True)



On Oct 30, 11:52 am, The Danny Bos  wrote:
> Hey there, I've got the below query, generating the below JSON. But I
> want to group them by "setId", can I do this in my query or in
> views.py to create a JSON file like the one at the bottom? Regroup in
> a template would be great, but doesn't work in views ...
>
> views.py:
> items = ItemOwned.objects.filter(user=id)      ### Obviously simple at
> the moment.
>
> generates JSON:
> {"setId": 1, "id": 75},
> {"setId": 1, "id": 76},
> {"setId": 1, "id": 77},
> {"setId": 2, "id": 78},
> {"setId": 2, "id": 79},
>
> what I need:
> {"setId": 1, items: [{ "id": 75},{ "id": 76},{ "id": 77}] },
> {"setId": 2, items: [{ "id": 78},{ "id": 79}] },
>
> Know what I mean?
> Seems like a grouping issue to me.
>
> I could do a few sub-queries but the results are quite large so it'd
> be best to do it well.
> Any code examples would be great as I'm a beginner trying his best ...
>
> 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
-~--~~~~--~~--~--~---



Creating something similar to WPMU with django?

2009-10-29 Thread jmat

I have a client that needs to create a way to generate a sub-domain
website on the fly, much like you can do with wordpress mu:
http://mu.wordpress.org/

I would really like to avoid another wordpress/php project so I'm
inquiring here if anyone has any pointers as to how this might be
accomplished in django...

I have studied the sites framework, and while some of the basic thing
are quite nice, in this scenario the sharing of content is not
important but a scaleable solution is.  Not sure if their should be
one django instance severing all sites, etc... etc...

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



Re: django can't access site-packages when inside fastcgi on dreamhost

2009-10-29 Thread Jacob Fenwick
Wow, I added the lxml library to sys.path in dispatch.fcgi and it worked!

Which piece of software do you think needed the path that wasn't able to
access it?

Thanks for giving me the idea Preston.

Jacob

On Thu, Oct 29, 2009 at 9:14 PM, Jacob Fenwick wrote:

> On Thu, Oct 29, 2009 at 1:47 PM, Preston Holmes  wrote:
>
>>
>>
>>
>> On Oct 27, 9:07 pm, Jacob Fenwick  wrote:
>> > Wow, big surprise that someone else is having shared hosting issues with
>> > dreamhost eh?
>> >
>> > I'm importing a library I installed in site-packages in a module in a
>> django
>> > app. When I call this django project, it returns with the error:
>> >
>> > ImportError: No module named lxml
>>
>> When you say you installed in site-packages in a module in a django
>> app - where exactly is lxml installed?  Are you using a virtualenv?
>> What steps have you done to check and ensure that the lxml module is
>> available in your Python path?
>>
>>
> Let me explain the setup a little more clearly:
>
> I installed lxml in site-packages.
> The site-packages is inside a directory structure created by virtualenv.
> I imported the lxml library in my views.py in a django app.
>
>
> To ensure lxml module is available in my PYTHONPATH I added the following:
>
> In .bash_profile: export
> PYTHONPATH=/home/jacobfenwick/local/lib/python2.4/site-packages
> In dispatch.fcgi: sys.path +=
> ['/home/jacobfenwick/local/lib/python2.4/site-packages']
>
> Let me know if I'm doing it wrong!
>
> Jacob
>

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



Re: django can't access site-packages when inside fastcgi on dreamhost

2009-10-29 Thread Jacob Fenwick
On Thu, Oct 29, 2009 at 1:47 PM, Preston Holmes  wrote:

>
>
>
> On Oct 27, 9:07 pm, Jacob Fenwick  wrote:
> > Wow, big surprise that someone else is having shared hosting issues with
> > dreamhost eh?
> >
> > I'm importing a library I installed in site-packages in a module in a
> django
> > app. When I call this django project, it returns with the error:
> >
> > ImportError: No module named lxml
>
> When you say you installed in site-packages in a module in a django
> app - where exactly is lxml installed?  Are you using a virtualenv?
> What steps have you done to check and ensure that the lxml module is
> available in your Python path?
>
>
Let me explain the setup a little more clearly:

I installed lxml in site-packages.
The site-packages is inside a directory structure created by virtualenv.
I imported the lxml library in my views.py in a django app.


To ensure lxml module is available in my PYTHONPATH I added the following:

In .bash_profile: export
PYTHONPATH=/home/jacobfenwick/local/lib/python2.4/site-packages
In dispatch.fcgi: sys.path +=
['/home/jacobfenwick/local/lib/python2.4/site-packages']

Let me know if I'm doing it wrong!

Jacob

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



GROUP results in views.py

2009-10-29 Thread The Danny Bos

Hey there, I've got the below query, generating the below JSON. But I
want to group them by "setId", can I do this in my query or in
views.py to create a JSON file like the one at the bottom? Regroup in
a template would be great, but doesn't work in views ...

views.py:
items = ItemOwned.objects.filter(user=id)  ### Obviously simple at
the moment.

generates JSON:
{"setId": 1, "id": 75},
{"setId": 1, "id": 76},
{"setId": 1, "id": 77},
{"setId": 2, "id": 78},
{"setId": 2, "id": 79},

what I need:
{"setId": 1, items: [{ "id": 75},{ "id": 76},{ "id": 77}] },
{"setId": 2, items: [{ "id": 78},{ "id": 79}] },

Know what I mean?
Seems like a grouping issue to me.

I could do a few sub-queries but the results are quite large so it'd
be best to do it well.
Any code examples would be great as I'm a beginner trying his best ...

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: Inlines and foreign key

2009-10-29 Thread Matt Schinckel

On Oct 30, 3:53 am, Alessandro Ronchi 
wrote:
> I've made a Profile model (Socio) for my users and now I need to be able to
> edit the users detail in profile model in admin.
>
> THe problem is that I can add an Inline only from User to Profile, because
> User doesn't have a foreign key to profile.

I had a similar problem. I have a Person class, which is effectively a
Profile (but may exist without an attached User). It is trivial to
have the Person fields appear in the User admin page, but not the
other way around.

My solution was to have a custom PersonAdminForm, which allows for
setting of the username and password (and validates these, creating a
new user if one was not previously attached).  This form is then
attached to the PersonAdmin class.

Hope the snippets below help.

person/admin.py

class PersonAdmin(VersionAdmin):
model = Person
form = PersonAdminForm

person/forms.py

class PersonAdminForm(forms.ModelForm):
user_active = forms.BooleanField(required=False, label='Can log
in',
help_text="Allow this person to log in to the web interface.")
username = forms.CharField(required=False)
password1 = forms.CharField(required=False,
label='Password',
widget=forms.PasswordInput)
password2 = forms.CharField(required=False,
label='Password (repeat)',
widget=forms.PasswordInput)

groups = forms.ModelMultipleChoiceField(required=False,
queryset=auth.models.Group.objects)

def __init__(self, *args, **kwargs):
forms.ModelForm.__init__(self, *args, **kwargs)
person = kwargs.get('instance', None)
if person:
user = person.user
if user:
self.fields['groups'].queryset = person.company.groups
self.fields['groups'].initial = map(lambda x:x.pk,
user.groups.all())
self.fields['user_active'].initial = user.is_active
self.fields['username'].initial = user.username
self.fields['password2'].help_text = 'Enter the same
password into both boxes to change it.'
self.fields['user_active'].help_text = 'Allow %s to
log in to the web interface.' % user.name
self.fields['active'].help_text = 'Allow %s to be
rostered on for shifts.' % user.name

else:
self.fields['groups'].widget = forms.HiddenInput()
self.fields['groups'].help_text = 'People must be able
to log in to assign them to groups.'
self.fields['company'].widget = forms.HiddenInput()
self.fields['company'].help_text = 'People cannot be moved
between companies.'
else:
self.fields['groups'].widget = forms.HiddenInput()
self.fields['groups'].help_text = "Choose groups after
creating the person."
# TODO: use Ajax to load the group list after the company
has been chosen.

class Meta:
model = Person

def clean_username(self):
"""
See if there is already a user with this username.  If this
username
is already associated with the user that is attached to this
person,
then that is okay.
"""
username = self.cleaned_data['username']
if username == "" and (self.cleaned_data['user_active'] or
self.instance.user):
raise forms.ValidationError(_("A username must be supplied
to enable login."))
users = auth.models.User.objects.filter(username=username)
if self.instance.user:
users = users.exclude(pk=self.instance.user.pk)
if users.count() != 0:
raise forms.ValidationError(_("A user with that username
already exists."))

return username

def clean_password2(self):
password1 = self.cleaned_data.get("password1", "")
password2 = self.cleaned_data["password2"]
if password1 != password2:
raise forms.ValidationError(_("The two password fields
didn't match."))
return password2

def clean_groups(self):
co_groups = self.cleaned_data['company'].groups.all()
return [group for group in self.cleaned_data['groups'] \
if group in co_groups]

def save(self, commit=True):
"""
If there isn't a user linked to this person, and there is a
username,
then we need to create a user.  Otherwise, we need to alter
the
values in the existing user object.

"""
forms.ModelForm.save(self, commit=False)

if self.cleaned_data['username'] != "":
if self.instance.user:
user = self.instance.user
# Set groups: easiest method-clear then re-add.
user.groups.clear()
user.groups.add(*self.cleaned_data['groups'])
else:
user = auth.models.User()


user.username = self.cleaned_data['username']
if self.cleaned_data['password2'] 

Django Model inheritance and foreignkeys

2009-10-29 Thread Andew Gee

Hi,

I have the following models

class Person(models.Model):
  name = models.CharField(max_length=100)

class Employee(Person):
  job = model.Charfield(max_length=200)

class PhoneNumber(models.Model):
  person = models.ForeignKey(Person)

How do I access the PhoneNumbers associated with an employee if I have
the employee id?

Currently I am using

phones = PhoneNumbers.objects.filter(person__id=employee.id)

and it works only because I know that the employee.id and person.id
are the same value, but I am sure this is the incorrect way to do
it.

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



Re: Versionable Models?

2009-10-29 Thread David

i would not call this a real versioning as this will not keep track of
which object has been edited.
if you have 10 different ponies and edited pony 3 to 3', you can not
tell that 3' was 3 before. neither can you tell which are the current
ponies, you will only get the last pony with current_pony.
or did i miss anything?

david

On 28 Okt., 17:01, hcarvalhoalves  wrote:
> On Oct 27, 4:54 pm, Todd Blanchard  wrote:
>
>
>
> > Total django noob here.  Rails/PHP/WebObjects refugee here.
>
> > I'm starting a project where some models need to be fully versioned.
>
> > IOW, record update is forbidden - every save to a changed model should  
> > result in a new record with a new version number or timestamp along  
> > with identity pulled from the current authenticated user's session.  
> > Queries/relationships should be specified as "fetch newest" or "fetch  
> > history".  IOW sometimes I want to traverse a relationship and just  
> > get the "current" record.  Sometimes I want to get the history of that  
> > relationship.
>
> > Anybody done this?  Got any tips?
>
> > Thanks,
> > -Todd Blanchard
>
> You can do all that without much magic.
>
> class MyVersionedModel(models.Model):
>     user = models.ForeignKey('User', editable=False)
>     timestamp = models.DateTimeField(auto_now_add=True,
> editable=False)
>
>     class Meta:
>         ordering = ['-timestamp']
>         get_latest_by = 'timestamp'
>         abstract = True
>
>     def save(self, *args, **kwargs):
>         self.pk = None # Forces insert
>         return super(MyVersionedObject, self).save(*args, **kwargs)
>
> Now you just need to inherit this mixin on all models you want
> versioned.
>
> class MyVersionedPony(MyVersionedObject):
>     ... # Whatever other fields
>
> In your views you can:
>
> def my_pony_view(request):
>     ...
>     my_pony.user = request.user
>     my_pony.save() # Always inserts instead of updating
>
>     current_pony = MyVersionedPony.objects.latest()  # Last pony
>     all_ponies = MyVersionedPony.objects.all() # Ordered descending
>
> If you need to encapsulate logic for more complex queries, you can
> create a model manager. [1]
>
> http://docs.djangoproject.com/en/dev/topics/db/managers/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Best way to customize create form in admin

2009-10-29 Thread fxvazquez

Hello,

I'm starting with the development of a django application for
inventory of buildings. Some models have more than a hundred of
atributes including relations with other models so in the admin
interface I have to use a lot of inlines. Here comes the problem:
acording to the admin/change_form.html template it loads first all the
model fields and then all the inlines.

I'd like to customize the order the fields are shown. What's the best
way to do that?.

I made some tests overriding admin/change_form.html for the model but
I can't find the way to fetch elements individually to insert them in
the desired position.

Any idea?

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



Re: Trouble accessing session data from a template

2009-10-29 Thread Daniel Roseman

On Oct 29, 5:32 pm, Marco  wrote:
> Hi all,
>
> I going a little bit crazy that's why I'm posting here ...
>
> I have a view :
>
> def index(request):
>    request.session['hello'] = 'world !!!'
>    print "hello!!!"
>    return render_to_response('index.html')
>
> in this page index.html I have
> value : {{ request.session.hello }}
>
> But nothing is displayed!!!
>
> 1) I am sure the index view is called (I can see the print debug
> output)
> 2) In settings.py,
> 'django.contrib.sessions.middleware.SessionMiddleware' is enabled
>
> So I really don't see where the pb is...
>
> Any idea?
>
> Regards,
> Marc.

Firstly, just to check that you are simply using this as an example,
and you don't think that this is the way to pass values to a template.
Of course, the normal way to pass values to a template is via the
context dictionary, which you can pass as the second parameter to
render_to_response.

That out of the way, the reason why you aren't getting anything in the
template is because it doesn't have a reference to the request object
by default. See here for how to get Context Processors to pass it
automatically:
http://docs.djangoproject.com/en/dev/ref/templates/api/#id1
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Year/month archive help

2009-10-29 Thread icrismariu

Hmm what i've done so far is:

in my view:


def arhiva(requesst):

arch = Post.objects.dates('data', 'month', order='DESC')

archives = {}

for i in arch:
tp = i.timetuple()
year = tp[0]
month = tp[1]
if year not in archives:
archives[year] = []
archives[year].append(month)
else:
if month not in archives[year]:
archives[year].append(month)

return render_to_response('blog/arhiva.html', {'archives':archives})


and in my template:

{% for years, months in archives.items %}
        {{ years }}

        {% for month in months %}

       {{ month }}

        {% endfor %}


    {% endfor %}


this returns something like:

   2008   10
   2009   10   9
   2007   10

first of all, i can't sort them of all...by year descending or
enything...and how can i replace year months with names(translated
because i'm from romania) and also so the months who does not have an
entry? something like this http://www.flickr.com/photos/ionutgabriel/3990015411/
? I really can't figure it out...

Maybe someone can help me...thank you!


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



Inlines and foreign key

2009-10-29 Thread Alessandro Ronchi
I've made a Profile model (Socio) for my users and now I need to be able to
edit the users detail in profile model in admin.

THe problem is that I can add an Inline only from User to Profile, because
User doesn't have a foreign key to profile.

It's very odd: I cannot add the inline in the model that holds the foreign
key, but I can do that on the referred model.

Is there any way to put my simple one to one related model (with foreign
key) in my Socio profile model admin page?

With Socio inside User I cannot search inside user profile fields in
admin_list, this is the problem.

 this is my model http://dpaste.com/113759/
and this is my admin:
http://dpaste.com/113758/


thanks in advance, best regards.

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

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



Re: django can't access site-packages when inside fastcgi on dreamhost

2009-10-29 Thread Preston Holmes



On Oct 27, 9:07 pm, Jacob Fenwick  wrote:
> Wow, big surprise that someone else is having shared hosting issues with
> dreamhost eh?
>
> I'm importing a library I installed in site-packages in a module in a django
> app. When I call this django project, it returns with the error:
>
> ImportError: No module named lxml

When you say you installed in site-packages in a module in a django
app - where exactly is lxml installed?  Are you using a virtualenv?
What steps have you done to check and ensure that the lxml module is
available in your Python path?

-Preston

>
> The django project is hosted on the fcgi.py version of fastcgi on dreamhost.
>
> Now, I know that django is not usually having a problem accessing the
> library, because if I go into the django shell and type import lxml, I can
> import the module.
>
> Also, if I type ./dispatch.py, I get a correct 200 OK response.
>
> But for some reason, when I call the site from a web browser, it causes
> django to not be able to access the library.
>
> The site-packages are stored inside of a virtualenv generated directory
> structure.
>
> The permissions on the dispatch.fcgi file, the fcgi.py file, the directories
> leading up to and include site-packages, and django are (mostly) 755.
>
> Has anyone encountered this? Or does anyone have some insight into how to
> solve this problem?
>
> Thanks for any help provided,
>
> Jacob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {% url in templates

2009-10-29 Thread Umapathy S
On Thu, Oct 29, 2009 at 1:40 PM, Alex Robbins  wrote:

>
> Maybe it is just me, but I feel like writing out the view functions
> like that is a beating. I just name[1] all the urls. Then the url tag
> is easy. I just do things like {% url home-page %} or {% url blog-
> index %}. If you set up a generic view in the views and name it, it
> will work like normal.
>
> [1]http://docs.djangoproject.com/en/dev/topics/http/urls/#id2
>
> bingo... believe me I searched through the docs, but never got to url
dispatcher.  proves i am a django newbie !!!

Thanks a ton.

-Umapathy

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Internal error on dreamhost when debug=False

2009-10-29 Thread Preston Holmes

Well you've gotten farther than I have.

I can get passenger_wsgi working with hello world, and cherrypy

I can get those working with any combination of virtualenv etc

But with django I get the not too helpful Premature end of script
headers even with apache LogLevel set to debug.

-Preston


On Oct 29, 7:10 am, Alessandro Ronchi 
wrote:
> I don't know why this site:http://www.portaleaziende-bih.com/
>
> works with debug=True, but If I put debug =False it gives a 500 internal
> error.
>
> I'm using mod_passenger on dreamhost. Logs just says
> [Thu Oct 29 07:02:38 2009] [error] [client x] Premature end of script
> headers: internal_error.html
>
> What can I check to find the problem?
>
> --
> Alessandro Ronchi
>
> SOASI
> Sviluppo Software e Sistemi Open 
> Sourcehttp://www.soasi.comhttp://www.linkedin.com/in/ronchialessandro
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Interrelated form fields

2009-10-29 Thread Daniel Roseman

On Oct 29, 4:42 pm, bruno desthuilliers
 wrote:

> (FWIW and IIRC, the appropriate english term is 'Customer' - please
> someone correct me if I'm wrong)

OK... the French word 'client' maps to both 'client' and 'customer'. A
lawyer, doctor, accountant etc would have clients; a shop has
customers. Sometimes you can have both: a newspaper, for example,
would have clients who buy advertising, but customers who buy the
paper.

Since the OP's app has appointments, client probably is the right
word.

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



Trouble accessing session data from a template

2009-10-29 Thread Marco

Hi all,

I going a little bit crazy that's why I'm posting here ...

I have a view :

def index(request):
   request.session['hello'] = 'world !!!'
   print "hello!!!"
   return render_to_response('index.html')

in this page index.html I have
value : {{ request.session.hello }}

But nothing is displayed!!!

1) I am sure the index view is called (I can see the print debug
output)
2) In settings.py,
'django.contrib.sessions.middleware.SessionMiddleware' is enabled

So I really don't see where the pb is...

Any idea?

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



Re: Specifying Django Project/Application Templates

2009-10-29 Thread Mike Ramirez
On Thursday 29 October 2009 09:21:26 Johan wrote:
> The information you provided is very helpful and I have been wondering
> about overriding templates.However, my question pertain not to
> templates as in the templating system used in django but rather to the
> 'template' directories used by django-admin.py when the startproject
> and startapp commands are executed. At the moment these commands
> merely copies some files within the django installation directory. In
> the case of a new project's settings.py it is copied and then modified
> by adding a new secret key and the project url string. 

You can add to it by writing your own management command. With something like 
this:

from django.core.management.base import LabelCommand, CommandError
from django.core.management import call_command

class = Command(LabelCommand):
  def handle_label(self, project_name, **options):
# create initial project, use startapp for app.
call_command('startproject', project_name)
output = []
#do stuff to template dir settings for project

   return u'\n'.join(output)



Inside the command startproject[1] you can see how SECRET_KEY value is 
intially set. call_command[2] is the suggested way of accessing the other 
commands within your apps.  Then use this command to start your projects or 
apps.

Hope This Helps

Mike

[1] 
http://code.djangoproject.com/browser/django/trunk/django/core/management/commands/startproject.py
[2] 
http://code.djangoproject.com/browser/django/trunk/django/core/management/__init__.py#L135





-- 



signature.asc
Description: This is a digitally signed message part.


generic views vs writing my own

2009-10-29 Thread Ross

For which cases would a user wish to write their own views rather than
using generic views? I'm new to Django and would like to build a page
that prompts the user to enter information into a form to sign up for
a league. Upon submitting the form, they can see the updated league
roster. I'm currently using generic views. I've read the forms
documentation and the ModelForms documentation but I don't see
anywhere where it tells how to use these in conjunction with generic
views. Is this because I should be using them with custom views?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: {% url in templates

2009-10-29 Thread bruno desthuilliers


On 29 oct, 14:40, Alex Robbins  wrote:
> Maybe it is just me, but I feel like writing out the view functions
> like that is a beating.

It's not just you !-)

yeps, named urls are the RightThing(tm) to do.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Interrelated form fields

2009-10-29 Thread bruno desthuilliers

On 29 oct, 14:46, Julián C. Pérez  wrote:
> Hi all
> I have a question to make
> I'm tryng to build a form using the following models:
>
> ---
> in models.py
>
> class Client(models.Model):
>    user = models.ForeignKey(User, verbose_name=u'associated user')
>    telephone = models.CharField(u'Telephone number', max_length=33,
> blank=False, null=False)
>
> class Appointment(models.Model):
>    client= models.ForeignKey(Client, verbose_name=u'associated
> client')
>    date = models.DateField('Booked to', blank=False, null=False)
>
> ---
>
> As you see, the Appointment model depends on the Client one
> So, I want a form showing at first the client's select box according
> to the DB records of model Client
> As soon as one client is selected, I want the form to show only the
> appointments booked to him
>
> How can I make that happen?

You'll either have to use Ajax or refresh the page once the Client
(FWIW and IIRC, the appropriate english term is 'Customer' - please
someone correct me if I'm wrong) is selected. You may want to have a
look at the form_utils contrib app - it has some helpers for
"wizard" (=>multistep) forms.

> 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: Filtering on model methods

2009-10-29 Thread Javier Guerra

On Thu, Oct 29, 2009 at 10:18 AM, pbzRPA  wrote:
> It's a pity django does not provide this kind of
> functionality.

hum it would be a pretty impressive feat for an ORM to take some
arbitrary python code and recompile it to (portable!) SQL to make the
DB do the work.

-- 
Javier

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



Re: static list and start server process

2009-10-29 Thread Javier Guerra

On Thu, Oct 29, 2009 at 7:48 AM, Manuel Ignacio  wrote:
> Hello, i have a menu list stored at my database, i want to obtain it
> only at start server process, and later when add a menu
> entry this list should be updated, i have the following
> considerations:
>
> 1. I don't want a database query for every request, because menu entry
> list would be very low frecuency updated

check 
http://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching

specifically the {% cache %}  {% endcache %} tag


-- 
Javier

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



Re: Specifying Django Project/Application Templates

2009-10-29 Thread Johan

The information you provided is very helpful and I have been wondering
about overriding templates.However, my question pertain not to
templates as in the templating system used in django but rather to the
'template' directories used by django-admin.py when the startproject
and startapp commands are executed. At the moment these commands
merely copies some files within the django installation directory. In
the case of a new project's settings.py it is copied and then modified
by adding a new secret key and the project url string.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Filtering on model methods

2009-10-29 Thread pbzRPA

Thank you for your help. I guess I will have to create temp table etc
and do it that way. It's a pity django does not provide this kind of
functionality.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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 force an INNER JOIN (without raw SQL)?

2009-10-29 Thread Joey Mink
Hi,

I'm a newbie integrating Django with a very large, legacy database.  I have
the following models (showing what I believe to be relevant):

class StakeholderType(models.Model):
stakeholdertypeid = models.IntegerField(primary_key=True,
db_column='stakeholderTypeID')
typename = models.CharField(max_length=135, db_column='typeName',
blank=True)


class Stakeholder(models.Model):
stakeholderid = models.IntegerField(primary_key=True,
db_column='stakeholderID')


class Property(models.Model):
propertyid = models.IntegerField(primary_key=True,
db_column='propertyID')
rentablebuildingarea =
models.IntegerField(db_column='rentableBuildingArea')
propertymanagerid = models.ForeignKey(Stakeholder,
db_column='propertyManagerID', related_name="propertymanagerid_set")
ownerid = models.ForeignKey(Stakeholder, db_column='ownerID',
related_name="ownerid_set")


I build the following QuerySet:

self.results =
Stakeholder.objects.filter(Q(stakeholdertypeid__typename__exact='owner'))
self.results =
self.results.annotate(number_of_sqft=Sum('ownerid_set__rentablebuildingarea'))
self.results =
self.results.annotate(number_of_buildings=Count('ownerid_set'))
self.results = self.results.order_by('-number_of_sqft')
self.results = self.results[:form.cleaned_data['max_results']]

And I get the following SQL run against MySQL:
SELECT
 `stakeholder`.`stakeholderID`,
 ...,
 SUM(`property`.`rentableBuildingArea`) AS `number_of_sqft`,
 COUNT(`property`.`propertyID`) AS `number_of_buildings`
FROM `stakeholder`
 INNER JOIN `stakeholder_type` ON (`stakeholder`.`stakeholderTypeID` =
`stakeholder_type`.`stakeholderTypeID`)
 LEFT OUTER JOIN `property` ON (`stakeholder`.`stakeholderID` =
`property`.`ownerID`)
WHERE `stakeholder_type`.`typeName` = 'owner'  GROUP BY
`stakeholder`.`stakeholderID`
ORDER BY number_of_sqft DESC
LIMIT 33

The query performs twice as fast if I simply change the LEFT OUTER JOIN
generated by Django to an INNER JOIN.  Does anyone have a recommendation for
how I might achieve an INNER JOIN of Stakeholder and Property?  I've read
about Django doing this when it believes that the join could result in some
null rows.  I've tried adding some "__isnull=False" specifications to my
QuerySet generation, but to no avail.

Any thoughts are appreciated.  Thanks!
Joey

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



Django tagging migration to GAE

2009-10-29 Thread DoubleD

I have a Django app that use a django-tagging. I need to port this
application to GAE. So, the main problem is to migrate tagging part.
It has a complicated model, that should be rewritten to work with
Google store. I think tagging is very popular django app and someone
has the same problem before. Has someone a rewritten model? Or
something to replace with?

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

2009-10-29 Thread David De La Harpe Golden

Russell Keith-Magee wrote:


> I'm not convinced that a single setting is the right approach for
> this. It almost seems like this is something that we should be using
> environment variables or a dot file (e.g., a .djangorc with system
> wide Django settings) - although this introduces a dependency on the
> environment. I'm open to other suggestions.
> 

I was going to suggest that people who don't like color at all for one
reason or another could do 'export TERM=xterm-mono', but turns out that
doesn't seem to work for the django ./manage.py case*  (separate issue
to configuring precise colors used in different situations, which might
be done through a DJANGO_COLORS env var akin to gnu ls's LS_COLORS,
or by some other means).

* It looks like  django.utils.termcolors  fires out ansi escapes and
hopes rather than using a terminal control abstraction layer
http://docs.python.org/library/curses.html
- note that you can use part of the python curses module just to access
the lowlevel terminfo functions (man terminfo), it's not just for
fullscreen mode curses applications - see also e.g.
http://nadiana.com/python-curses-terminal-controller

I'm on the clock and can't write a real patch, sorry, and I know
terminals can seem a bit arcane, but e.g. try the following under
TERM=xterm-256color vs. TERM=xterm-mono

#!/usr/bin/python
import curses  # might want to fallback if unavailable
curses.setupterm()
setaf = curses.tigetstr('setaf')
if setaf:
   magenta = curses.tparm(setaf, curses.COLOR_MAGENTA)
   print magenta + "MAGENTA ALERT"
else:
   print "MONO ALERT"











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



Internal error on dreamhost when debug=False

2009-10-29 Thread Alessandro Ronchi
I don't know why this site:
http://www.portaleaziende-bih.com/

works with debug=True, but If I put debug =False it gives a 500 internal
error.

I'm using mod_passenger on dreamhost. Logs just says
[Thu Oct 29 07:02:38 2009] [error] [client x] Premature end of script
headers: internal_error.html

What can I check to find the problem?

-- 
Alessandro Ronchi

SOASI
Sviluppo Software e Sistemi Open Source
http://www.soasi.com
http://www.linkedin.com/in/ronchialessandro

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Specifying Django Project/Application Templates

2009-10-29 Thread Bill Freeman

If I understand your problem correctly, you can already override such
templates.  If there is a template in your project's template directory
with the same name and sub-path as that used by django base code
or a system wide installed application, it will be used instead.

Perhaps an example.  Suppose that you're using the foo application,
and it loads a template 'foo/bar.html', which is in the application's
'templates/foo' directory.  This is found via the app template loader.
If you create a directory 'foo' as a subdirectory of your project's
'templates' directory, and put a file in it named 'bar.html', that will
be used instead of the one provided by the app.

The necessary (and common) pre-conditions for this to work are,
all in settings.py:

The full path to your templates directory is listed (probably first)
in the TEMPLATE_DIRS tuple.  (I use os.path.join(PROJECT_ROOT,
"templates") which requires that I have earlier said something like
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)) .)

'django.template.loaders.filesystem.load_template_source' must
be listed in the TEMPLATE_LOADERS tuple, and come before
'django.template.loaders.app_directories.load_template_source'.
(These are usually the only two, and they are in that order by
default.)

Now, if you want to change what template the app's view tries to load,
so that you can still access the original to extend it, without copying
and renaming it, that's a more interesting problem.

Bill

On Thu, Oct 29, 2009 at 8:44 AM, Johan  wrote:
>
> Hi. Is there a way to specify custom project (or what I call sites)
> and application templates. At present the python-admin.py startproject/
> startapp uses the default templates that ships with django. I end up
> either having to create these myself or heavily modify them for my dev
> structure. It seems to me that it would be quite simple to change the
> code in django.core.management.base and
> django.core.management.commands.startproject/startapp to allow the
> user to specify custom project and application templates. The idea
> would be that i can run the following type of command: djang-admin.py
> startproject template.config. Does anybody see the need for this type
> of functionality or not?
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread Alex Robbins

The warning on line 2 is because you are using python2.6, default in
Ubuntu9.04. You don't need to worry about it. It is just telling the
authors of mysqldb that ImmutableSet is going away in newer versions
of python. Not something you need to care about.

On Oct 29, 3:37 am, sridharpandu  wrote:
> Skylar
>
> Thanks. It works. Here is the trace. Should warning on line 2 be
> ignored?
>
> srid...@sridhar:~$ python manage.py syncdb
> /var/lib/python-support/python2.6/MySQLdb/__init__.py:34:
> DeprecationWarning: the sets module is deprecated
>   from sets import ImmutableSet
> Creating table auth_permission
> Creating table auth_group
> Creating table auth_user
> Creating table auth_message
> Creating table django_content_type
> Creating table django_session
> Creating table django_site
>
> You just installed Django's auth system, which means you don't have
> any superusers defined.
> Would you like to create one now? (yes/no): y
> Please enter either "yes" or "no": yes
> Username (Leave blank to use 'sridhar'):
> E-mail address: sridharpa...@gmail.com
> Password:
> Password (again):
> Superuser created successfully.
> Installing index for auth.Permission model
> Installing index for auth.Message model
> srid...@sridhar:~$
>
> Best regards
>
> Sridhar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Interrelated form fields

2009-10-29 Thread Julián C . Pérez

Hi all
I have a question to make
I'm tryng to build a form using the following models:

---
in models.py

class Client(models.Model):
   user = models.ForeignKey(User, verbose_name=u'associated user')
   telephone = models.CharField(u'Telephone number', max_length=33,
blank=False, null=False)

class Appointment(models.Model):
   client= models.ForeignKey(Client, verbose_name=u'associated
client')
   date = models.DateField('Booked to', blank=False, null=False)

---

As you see, the Appointment model depends on the Client one
So, I want a form showing at first the client's select box according
to the DB records of model Client
As soon as one client is selected, I want the form to show only the
appointments booked to him

How can I make that happen?
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: {% url in templates

2009-10-29 Thread Alex Robbins

Maybe it is just me, but I feel like writing out the view functions
like that is a beating. I just name[1] all the urls. Then the url tag
is easy. I just do things like {% url home-page %} or {% url blog-
index %}. If you set up a generic view in the views and name it, it
will work like normal.

[1]http://docs.djangoproject.com/en/dev/topics/http/urls/#id2

On Oct 28, 3:29 pm, Umapathy S  wrote:
> On Wed, Oct 28, 2009 at 8:03 PM, Gabriel .  wrote:
>
> > On Wed, Oct 28, 2009 at 4:16 PM, Umapathy S  wrote:
> > > view_xyz is the view function.  No arguments.
>
> > > exps is the application.  pams is project.
>
> > > pams/urls.py
>
> > > urlpatterns = patterns('',
> > >     # Example:
> > >     # (r'^pams/', include('pams.foo.urls')),
> > >     (r'pams/', include('pams.exps.urls')),
>
> > > pams/exps.urls.py
>
> > > from django.conf.urls.defaults import *
> > > from django.views.generic import list_detail
> > > from pams.exps.models import *
>
> > > urlpatterns = patterns('pams.exps.views',
> > >     (r'exps/xyz/$', 'view_xyz'),
>
> > Try with {% url exps.views.view_xyz 
>
> > or "pams.exps.views.view_xyz"
>
> > {%
>
> Thanks.
>
>  {% url exps.views.view_xyz %} worked.
>
> Is it possible to do this for generic views?
>
> Thanks
>
> Umapathy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



best approach for using email as username

2009-10-29 Thread Adrián Ribao

Hello,

I need to use the email field as the username. I neet these:

* Email must be unique
* I should authenticate against the email
* The admin should work I I should be able to create users with
username = email address.

I have a custom authentication method but I need more. I need to tell
Django to make the email unique, and I need to login and create users
from the admin with the @ character.

What is the best approach for this?

I've been searching in google but no one of the solutions can
accomplish the three points I need.

Thank you!

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



static list and start server process

2009-10-29 Thread Manuel Ignacio

Hello, i have a menu list stored at my database, i want to obtain it
only at start server process, and later when add a menu
entry this list should be updated, i have the following
considerations:

1. I don't want a database query for every request, because menu entry
list would be very low frecuency updated

I think that i could run a method at start server processes, create a
static list and when a menu entry entry operation happened
at database, update the static list

I don't know how to implement this in an efficient manner

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



Re: Login users

2009-10-29 Thread Johan

This link (http://docs.djangoproject.com/en/dev/topics/auth/) has
helped me a lot. After working through this you will probably have
some more questions :)

On Oct 29, 2:33 pm, Denis Bahati  wrote:
> Hi All,
>
> Am creating application using django/python, i want to create a login form
> where by normal users can login through the web and access the system, i
> have a background with PHP but new to python/django. How can I implement
> this login? Currently am using the Django Admin page for login the system.
> Thanks in advance.
> Regards
> Denis.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Specifying Django Project/Application Templates

2009-10-29 Thread Johan

Hi. Is there a way to specify custom project (or what I call sites)
and application templates. At present the python-admin.py startproject/
startapp uses the default templates that ships with django. I end up
either having to create these myself or heavily modify them for my dev
structure. It seems to me that it would be quite simple to change the
code in django.core.management.base and
django.core.management.commands.startproject/startapp to allow the
user to specify custom project and application templates. The idea
would be that i can run the following type of command: djang-admin.py
startproject template.config. Does anybody see the need for this type
of functionality or not?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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
-~--~~~~--~~--~--~---



Login users

2009-10-29 Thread Denis Bahati
Hi All,

Am creating application using django/python, i want to create a login form
where by normal users can login through the web and access the system, i
have a background with PHP but new to python/django. How can I implement
this login? Currently am using the Django Admin page for login the system.
Thanks in advance.
Regards
Denis.

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

2009-10-29 Thread Russell Keith-Magee

On Thu, Oct 29, 2009 at 7:41 PM, Karen Tracey  wrote:
> On Thu, Oct 29, 2009 at 7:32 AM, Russell Keith-Magee
>  wrote:
>>
>> On Wed, Oct 28, 2009 at 8:39 AM, HARRY POTTRER  wrote:
>> >
>> > I was looking around the trac for the django project and came across
>> > this ticket:
>> >
>> > http://code.djangoproject.com/ticket/6385
>> >
>> > It seemed like a pretty cool idea, and I hoped it would get to be
>> > added to the 1.2 release. Then I saw it was created over 2 years ago.
>> >
>> > I applied the patch to my cope of 1.1, and it works perfectly. I've
>> > been using it for 2 days and have had no problems.
>> >
>> > What can I do to get this added to 1.2? (or any release for that
>> > matter.) I have some free time, and a weird desire to make this part
>> > of Django. I'm not familiar on how the whole process works. What do I
>> > need to do?
>>
>> Well, you've done the first step - bringing the ticket to our
>> attention and offering to advocate on its behalf :-)
>>
>> I've put some notes on the ticket. If you can address those issues in
>> a satisfactory way, I'll see about getting this into trunk.
>>
>
> Note there's also requesting 7679 this.  Malcolm was -1 on it due to colors
> not working well for everyone, and the patch was updated to use a setting.
> Not sure yet another setting is the best idea.  At any rate one or the other
> of these should likely be closed as dupe by whoever takes on looking into
> this (not sure why one hasn't already been closed, someone already noted the
> overlap in 7679).

Thanks for the heads up on the dupe - I've closed #6385.

I hadn't considered the colorblindness issue. It's a valid point, but
I don't think we should throw out the baby with the bathwater. For
those without color vision issues, colored output can be very useful.

The choice of colors (avoiding red/blue on black, or yellow on white)
is also a reasonable concern, and one that we don't address at
present.

However, the two issues are orthogonal. We already use color, so the
decision to disable/customize colorization is independent of the
decision to add colorization to runserver. I've opened #12112 to track
the orthogonal problem of controlling colorization.

I'm not convinced that a single setting is the right approach for
this. It almost seems like this is something that we should be using
environment variables or a dot file (e.g., a .djangorc with system
wide Django settings) - although this introduces a dependency on the
environment. I'm open to other suggestions.

Yours,
Russ Magee %-)

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



multi-table inheritance: getting instances of parent class which are also instances of child class

2009-10-29 Thread James Harrison Fisher

Hi,

I'm having some trouble with what I would have thought would be a
simple query.  Working with the multi-table inheritance examples
Django gives:

class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)

class Restaurant(Place):
serves_hot_dogs = models.BooleanField()
serves_pizza = models.BooleanField()

how do I get all the Places that are also Restaurants?  Obviously I
can do Restaurant.objects.all(), but that returns a set of
Restaurants, whereas I want the set of Places that those Restaurants
are linked to.

I've tried (the equivalent in my app of) the following but it
generates an InternalError:

Place.objects.filter(restaurant__isnull=False)

The only surefire way of getting what I want would be to do something
like:

[r.place_ptr for r in Restaurant.objects.all()]

But this presumably incurs inefficiencies of using python rather than
SQL.

So first question: is the above possible in a more efficient manner?

---

I have a second question relating to this.  The reason WHY I want to
do the above is because of Django's problem with serializing objects
of class Restaurant, whereby it only serializes the local fields.  The
suggested solution in the documentation is:

all_objects = list(Restaurant.objects.all()) + list(Place.objects.all
())
data = serializers.serialize('xml', all_objects)

But this doesn't do at all what I would want; it in fact seems to do
exactly what it looks like it would do: serialize a list that starts
with the Restaurant objects (with their local fields), then a FULL
list of all the Place objects.

Question: am I misreading/miscopy-and-pasteing the above code; does it
in fact do something else?, or is it actually MEANT to make the
awkward list of "all Restaurants and all Places"?

If I can't find a solution using multi-table inheritance then I
imagine I'm going to have to use an abstract base class (which would
involve rethinking my architecture).


Thanks in advance and all the best


James Fisher
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: Colored HTTP status codes

2009-10-29 Thread Karen Tracey
On Thu, Oct 29, 2009 at 7:32 AM, Russell Keith-Magee  wrote:

>
> On Wed, Oct 28, 2009 at 8:39 AM, HARRY POTTRER  wrote:
> >
> > I was looking around the trac for the django project and came across
> > this ticket:
> >
> > http://code.djangoproject.com/ticket/6385
> >
> > It seemed like a pretty cool idea, and I hoped it would get to be
> > added to the 1.2 release. Then I saw it was created over 2 years ago.
> >
> > I applied the patch to my cope of 1.1, and it works perfectly. I've
> > been using it for 2 days and have had no problems.
> >
> > What can I do to get this added to 1.2? (or any release for that
> > matter.) I have some free time, and a weird desire to make this part
> > of Django. I'm not familiar on how the whole process works. What do I
> > need to do?
>
> Well, you've done the first step - bringing the ticket to our
> attention and offering to advocate on its behalf :-)
>
> I've put some notes on the ticket. If you can address those issues in
> a satisfactory way, I'll see about getting this into trunk.
>
>
Note there's also requesting 7679 this.  Malcolm was -1 on it due to colors
not working well for everyone, and the patch was updated to use a setting.
Not sure yet another setting is the best idea.  At any rate one or the other
of these should likely be closed as dupe by whoever takes on looking into
this (not sure why one hasn't already been closed, someone already noted the
overlap in 7679).

Karen

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

2009-10-29 Thread Russell Keith-Magee

On Wed, Oct 28, 2009 at 8:39 AM, HARRY POTTRER  wrote:
>
> I was looking around the trac for the django project and came across
> this ticket:
>
> http://code.djangoproject.com/ticket/6385
>
> It seemed like a pretty cool idea, and I hoped it would get to be
> added to the 1.2 release. Then I saw it was created over 2 years ago.
>
> I applied the patch to my cope of 1.1, and it works perfectly. I've
> been using it for 2 days and have had no problems.
>
> What can I do to get this added to 1.2? (or any release for that
> matter.) I have some free time, and a weird desire to make this part
> of Django. I'm not familiar on how the whole process works. What do I
> need to do?

Well, you've done the first step - bringing the ticket to our
attention and offering to advocate on its behalf :-)

I've put some notes on the ticket. If you can address those issues in
a satisfactory way, I'll see about getting this into trunk.

Yours,
Russ Magee %-)

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



Is it possible to disable multithread in Django

2009-10-29 Thread Olli Wang

Hi, I used jump to package a Django application into a WAR file (You
can find the instructions here: 
http://gitorious.org/jump/pages/DjangoWarUsingJump).
The created WAR file worked fine on TomCat, but when I extracted the
WAR file and uploaded the extracted directory to Google App Engine, it
shows me an 500 error. The error is occurred by threading used in
Django while GAE disables it.

The problem is, it it possible to disable multithread in Django? Don't
even let Django have a chance to import thread because that cases
error because it's not there on GAE. I was wondering Python Django
application could run on GAE, why Jython Django application could not.
Any idea? 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: Model design

2009-10-29 Thread Caisys

Dear Vinicius,
What is the difference between:

--
def __unicode__(self):
return unicode(self.place)+' - '+self.nome
--
and
--
def __unicode__(self):
return self.place+' - '+self.nome
--

because the both seem to work and display the same info.
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: how could i specify column by using ManyToManyField ?

2009-10-29 Thread Kenneth Gonsalves

On Thursday 29 Oct 2009 3:09:51 pm lijihuai wrote:
> class Novel(models.Model):
> name = CharField()
> 
> class Author(models.Model):
> name = CharField()
> novels = models.ManyToManyField(Novel, db_table='author_novels')
> 
> how could i map the columns novel_id and author_id from the table
>  author_novels ?
> 
 actually table author_novels is created by django and not visible to you. You 
have the _set.all() thingie to access either side of the relation. Please 
refer to:
http://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-
relationships
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

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



how could i specify column by using ManyToManyField ?

2009-10-29 Thread lijihuai
hello, everyone

now, in the scene:
there are some tables in my database, 
table novels:
id (primary key),
name 

table authors:
id (primary key),
name

table author_novels:
id (primary key),
novel_id ( references novels(id) )
author_id ( references authors(id) )

the tables and the columns can't be changed for some reason.

and, i built models like this:

class Novel(models.Model):
name = CharField()

class Author(models.Model):
name = CharField()
novels = models.ManyToManyField(Novel, db_table='author_novels')

how could i map the columns novel_id and author_id from the table author_novels 
?


lijihuai,lijih...@126.com
2009-10-29 

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

2009-10-29 Thread elminio

Up Up


On Oct 28, 11:42 am, elminio  wrote:
> Hi,
>
> I use generic view on updating objects. How to create button with
> cancel that will always redirect me to the previous page ?
>
> 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: Using django form

2009-10-29 Thread Denis Bahati
Hi Daniel,
Thanks  for the document. I real appreciate.
I have another question:
  How can I use my model and ModelForm to create a login screen?

On Thu, Oct 29, 2009 at 10:14 AM, Daniel Roseman wrote:

>
> On Oct 29, 6:38 am, Denis Bahati  wrote:
> > Hi all,
> > I've gone through and successfully made the poll application and I've
> > begun to play around and tried to change a few things. The first thing
> > I would like to do is have the user vote without login to django admin.
> ie
> > creating my own form where users can vote and update the database without
> > using the django admin. I'm thinking of using html files or using the
> django
> > form library but i dont no the exactly solution to go through this. Can
> any
> > one show me how to do the staff using django form or using the html
> forms? I
> > have followed the tutorial like in the Django Book Chapter 7: Forms but i
> > dont see where i can insert data into the table in the database.
> > Thanks in advance.
> > Regards
> > Denis.
>
> http://docs.djangoproject.com/en/dev/topics/forms/modelforms/
> --
> DR.
> >
>

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



Re: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread sridharpandu

Skylar

Thanks. It works. Here is the trace. Should warning on line 2 be
ignored?

srid...@sridhar:~$ python manage.py syncdb
/var/lib/python-support/python2.6/MySQLdb/__init__.py:34:
DeprecationWarning: the sets module is deprecated
  from sets import ImmutableSet
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no): y
Please enter either "yes" or "no": yes
Username (Leave blank to use 'sridhar'):
E-mail address: sridharpa...@gmail.com
Password:
Password (again):
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Message model
srid...@sridhar:~$

Best regards

Sridhar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread Skylar Saveland

If you are not in a virtualenv with -no-site-packages then you should
be able to just:

sudo aptitude install python-mysqldb



sridharpandu wrote:
> Thanks. That was quick. I use Ubuntu 9.04 (jaunty). I am unable to
> figure out the location of MySQLdb. A "WHEREIS MySQLdb" at the command
> prompt returned MySQLdb:
>
> Is there a way to figure out
>
> Best regards
>
> Sridhar
>
> On Oct 29, 12:07 pm, Kenneth Gonsalves  wrote:
> > On Thursday 29 Oct 2009 12:17:56 pm sridharpandu wrote:
> >
> > >  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > > module: No module named MySQLdb
> >
> > you need MysSQLdb to connect to the database, either it is not installed or 
> > it
> > is not on the path.
> > --
> > regards
> > Kenneth Gonsalves
> > Senior Project Officer
> > NRC-FOSShttp://nrcfosshelpline.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Sharing data between two Django sites

2009-10-29 Thread Benjamin Wohlwend

Hi,

On Oct 27, 11:44 am, Graham Dumpleton 
wrote:

>
> One could simply overlay URLs from one instance over another.
>
> For example, using mod_wsgi you should be able to do:
>
>   WSGIScriptAlias / /some/path/public/site.wsgi
>   WSGIScriptAlias /staff-members /some/path/intranet/site.wsgi/staff-
> members
>

That's not really what I want to achieve. To flesh out my example from
above: I have two sites. Site A is a public facing CMS (django-cms 2.0
[1] in my case), Site B is a data management application that manages
staff members, projects, etc. On the CMS, there are several pages that
show information from Site B (staff members, current projects, ...).
The information should be displayed in the context of Site A (design,
navigation, authentication data), so mounting a part of Site B into
Site A will not work.

Like I said in my first message: I have already a working solution,
that is loading the apps from Site B ("staff_management",
"project_management", ...) in INSTALLED_APPS of Site A. Then I can
query the data from Site B with the ORM. The two drawbacks that hold
me back putting this into production are:

  * data from both Site A and Site B have to be in the same Database,
which results in a mess (and makes my DBA an angry person)
  * code changes/refactorings in Site B may break Site A even though
data structures have not changed (e.g. moving around modules and
classes in Site B breaks imports in Site A)

I have something in mind like Java's RMI [2]. Site B has a method
"get_staff_members(business_unit=None)" that returns a list of
StaffMember objects. That method can be called from code inside Site
A, preferably over a socket (I'm all for webservices, but it seems
kind of overkill to use REST or SOAP for two processes on the same
machine).

Regards,
Benjamin


[1] http://www.django-cms.org/
[2] http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 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: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread sridharpandu

Thanks. That was quick. I use Ubuntu 9.04 (jaunty). I am unable to
figure out the location of MySQLdb. A "WHEREIS MySQLdb" at the command
prompt returned MySQLdb:

Is there a way to figure out

Best regards

Sridhar

On Oct 29, 12:07 pm, Kenneth Gonsalves  wrote:
> On Thursday 29 Oct 2009 12:17:56 pm sridharpandu wrote:
>
> >  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> > django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module: No module named MySQLdb
>
> you need MysSQLdb to connect to the database, either it is not installed or it
> is not on the path.
> --
> regards
> Kenneth Gonsalves
> Senior Project Officer
> NRC-FOSShttp://nrcfosshelpline.in/web/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Using django form

2009-10-29 Thread Daniel Roseman

On Oct 29, 6:38 am, Denis Bahati  wrote:
> Hi all,
> I've gone through and successfully made the poll application and I've
> begun to play around and tried to change a few things. The first thing
> I would like to do is have the user vote without login to django admin. ie
> creating my own form where users can vote and update the database without
> using the django admin. I'm thinking of using html files or using the django
> form library but i dont no the exactly solution to go through this. Can any
> one show me how to do the staff using django form or using the html forms? I
> have followed the tutorial like in the Django Book Chapter 7: Forms but i
> dont see where i can insert data into the table in the database.
> Thanks in advance.
> Regards
> Denis.

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



Re: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread Kenneth Gonsalves

On Thursday 29 Oct 2009 12:17:56 pm sridharpandu wrote:
>  raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No module named MySQLdb
> 

you need MysSQLdb to connect to the database, either it is not installed or it 
is not on the path.
-- 
regards
Kenneth Gonsalves
Senior Project Officer
NRC-FOSS
http://nrcfosshelpline.in/web/

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



Re: syncdb for INSTALLED_APPS throws errors

2009-10-29 Thread Rishabh Manocha
On Thu, Oct 29, 2009 at 2:47 PM, sridharpandu wrote:

>
> Hi,
>
> I ran the syncdb command to create the tables for INSTALLED_APPS. I
> get the errors as shown in the output below. Can someone tell me
> what's wrong. I am using a laptop that runs Django as well as the
> MySQL database .
>
> srid...@sridhar:~/finch/chennaicard$ python manage.py syncdb
> Traceback (most recent call last):
>  File "manage.py", line 11, in 
>execute_manager(settings)
>  File "/var/lib/python-support/python2.6/django/core/management/
> __init__.py", line 340, in execute_manager
>utility.execute()
>  File "/var/lib/python-support/python2.6/django/core/management/
> __init__.py", line 295, in execute
>self.fetch_command(subcommand).run_from_argv(self.argv)
>  File "/var/lib/python-support/python2.6/django/core/management/
> base.py", line 192, in run_from_argv
>self.execute(*args, **options.__dict__)
>  File "/var/lib/python-support/python2.6/django/core/management/
> base.py", line 218, in execute
>self.validate()
>  File "/var/lib/python-support/python2.6/django/core/management/
> base.py", line 246, in validate
>num_errors = get_validation_errors(s, app)
>  File "/var/lib/python-support/python2.6/django/core/management/
> validation.py", line 22, in get_validation_errors
>from django.db import models, connection
>  File "/var/lib/python-support/python2.6/django/db/__init__.py", line
> 16, in 
>backend = __import__('%s%s.base' % (_import_path,
> settings.DATABASE_ENGINE), {}, {}, [''])
>  File "/var/lib/python-support/python2.6/django/db/backends/mysql/
> base.py", line 13, in 
>raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module: No module named MySQLdb
>
>
> Best regards
>
> Sridhar Pandurangiah
>
> >
>
The problem is listed out at the end of the Traceback - "Error loading
MySQLdb module: No module named MySQLdb". You need to install the python
MySQL driver. You can get it at http://mysql-python.sourceforge.net/

-- 

Best,

R

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

2009-10-29 Thread sridharpandu

Hi,

I ran the syncdb command to create the tables for INSTALLED_APPS. I
get the errors as shown in the output below. Can someone tell me
what's wrong. I am using a laptop that runs Django as well as the
MySQL database .

srid...@sridhar:~/finch/chennaicard$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/var/lib/python-support/python2.6/django/core/management/
__init__.py", line 340, in execute_manager
utility.execute()
  File "/var/lib/python-support/python2.6/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/python-support/python2.6/django/core/management/
base.py", line 192, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/var/lib/python-support/python2.6/django/core/management/
base.py", line 218, in execute
self.validate()
  File "/var/lib/python-support/python2.6/django/core/management/
base.py", line 246, in validate
num_errors = get_validation_errors(s, app)
  File "/var/lib/python-support/python2.6/django/core/management/
validation.py", line 22, in get_validation_errors
from django.db import models, connection
  File "/var/lib/python-support/python2.6/django/db/__init__.py", line
16, in 
backend = __import__('%s%s.base' % (_import_path,
settings.DATABASE_ENGINE), {}, {}, [''])
  File "/var/lib/python-support/python2.6/django/db/backends/mysql/
base.py", line 13, in 
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module: No module named MySQLdb


Best regards

Sridhar Pandurangiah

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



Using django form

2009-10-29 Thread Denis Bahati
Hi all,
I've gone through and successfully made the poll application and I've
begun to play around and tried to change a few things. The first thing
I would like to do is have the user vote without login to django admin. ie
creating my own form where users can vote and update the database without
using the django admin. I'm thinking of using html files or using the django
form library but i dont no the exactly solution to go through this. Can any
one show me how to do the staff using django form or using the html forms? I
have followed the tutorial like in the Django Book Chapter 7: Forms but i
dont see where i can insert data into the table in the database.
Thanks in advance.
Regards
Denis.

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