Show HTML in Labels for Model Choice Fields

2010-12-30 Thread Adi
Hi I have a situation like this

class AppearanceThemesForm(forms.Form):
page_theme =
forms.ModelChoiceField(widget=forms.RadioSelect(attrs={'title':'Select
the appropriate theme for your pages.'}),
 
queryset=Theme.objects.filter(section="1"),
 
initial=Theme.objects.get(section="1",representation="").pk,
label="Page Theme")

And my Theme model is like this:

class Theme(models.Model):
name = models.CharField(max_length=32)
image = models.ImageField(upload_to="images/themes", null=True)

def __unicode__(self):
return "%s" % (self.name)


When I render AppearanceThemesForm in my template, i would like to be
able to show a link next to the label. If a user clicks the link, the
webpage displays the image associated with Theme.

I tried putting in a custom field that extends the ModelChoiceField,
and in the label_from_instance method, tried to output the HTML, but
that gets escaped.

What is the proper way to achieve what i am trying to do?

Alternatively, how do i get access the underlying model object behind
the modelchoice field in my 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-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.



Sorry -- Re: Django not seeing AuthenticationMiddleware for some reason ...

2010-12-30 Thread Stephen Waterbury

Sorry for the repeats!  I was already a member of the
group from another email address, but Google kept sending
me bounce messages even after I joined from this address
and resent -- then all 3 copies came at once ... oops.  :(

Steve

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



Django not seeing AuthenticationMiddleware for some reason ...

2010-12-30 Thread Stephen Waterbury

I am baffled, and it's probably something simple I'm missing ...
I just need to send a message for help and then I'll see it ...
(maybe ... ;)

My set up:
* apache2 on Ubuntu 10.04
* mod_wsgi 3.3, compiled with python 2.6.5 (the system python)
  (but Ubuntu's mod_wsgi package was apparently not the problem)
* django installed in a virtualenv with python 2.6.5 also
* 2 django apps, one running on ':80' virtual host and one on
  ':8000' virtual host, each with a separate wsgi script (of course)
* apache server config (apache.conf) has WSGIPythonHome directive:
  'WSGIPythonHome [path to virtualenv directory]'
* virtualenv directory has python interpreter in its bin dir and
  python packages installed in its lib dir, including all django
  libs
* I have verified that AuthenticationMiddleware can be imported
  successfully from the command line within the virtualenv using
  the virtualenv's python intepreter
* both django apps live within the virtualenv directory,
  each in its own "project" directory there
* both apps are configured in apache with WSGIDaemonProcess directive

The error I continue to get is:

"ImproperlyConfigured at /

"The Django remote user auth middleware requires the
authentication middleware to be installed.  Edit your
MIDDLEWARE_CLASSES setting to insert
'django.contrib.auth.middleware.AuthenticationMiddleware' before
the RemoteUserMiddleware class."

The relevant sections of the settings.py files for the apps are:
--
MIDDLEWARE_CLASSES = (
  'django.middleware.common.CommonMiddleware',
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.contrib.auth.middleware.AuthenticationMiddleware',
  'django.contrib.auth.middleware.RemoteUserMiddleware',
)

AUTHENTICATION_BACKENDS = (
  'django.contrib.auth.backends.RemoteUserBackend',
  )
---

Ultimately I'll be using Active Directory (Kerberos) auth, but for
purposes of testing the REMOTE_USER stuff I've configured Basic
Authentication, and it is working (I authenticate successfully
before seeing that error message).

One thing that puzzles me is that in spite of a WSGIPythonHome
directive that points to the virtualenv, the error message lists
the "Python Executable" as "/usr/bin/python".  The "Python Path"
shown in the error message seems correct: it includes the
virtualenv's site-packages directory, which is where django is
installed (there is no system-level django installed, Ubuntu's or
otherwise), and as I say I tested that the middleware classes
that the error message complains about can be imported using the
virtualenv's python interpreter on the command line.

Any suggestions welcome!  (I can send the whole error page if it
would help, but I'll need to launder it a little.)

TIA!
Steve

--
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: Caught NoReverseMatch while rendering:Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.

2010-12-30 Thread Bartolomé Sánchez
Message error tells that you are trying to reach "index" url, which doesn't
exists. Maybe you are calling "index" url instead of "login".

2010/12/30 aaron 

> Any idea what this means?
>
> The URL entry is as per the django tutorial as:
>
> (r'^login/$', 'django.contrib.auth.views.login', {'template_name':
> 'registration/login.html'}),
>
> And in my settings.py file I specify
> LOGIN_URL = 'login/'
>
> cheers,
> A
>
> --
> 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.
>
>

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



Caught NoReverseMatch while rendering:Reverse for 'index' with arguments '()' and keyword arguments '{}' not found.

2010-12-30 Thread aaron
Any idea what this means?

The URL entry is as per the django tutorial as:

(r'^login/$', 'django.contrib.auth.views.login', {'template_name':
'registration/login.html'}),

And in my settings.py file I specify
LOGIN_URL = 'login/'

cheers,
A

-- 
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: ModelForm validation in 1.2.3

2010-12-30 Thread Burhan
The question is how do I get the modelform to only check for form
validity, and not model validity (like it did before). I don't see
what your link has to do with that.

On Dec 30, 7:32 pm, Ferran  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> On 30/12/10 17:25, Burhan wrote:
>
> >  In 1.2.3, this logic always fails because "is_clean()" fails if an
> > existing customer enter's their email address. How can I do the same
> > using django 1.2.3?
>
> http://docs.python.org/tutorial/errors.html
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> iQIcBAEBCAAGBQJNHLQCAAoJEAWOKfEESaOw/KkQAJpykIq4NuWT2pFlzT/jg2Ck
> ZLPnKTABp7JmvDdNflreKhKDKmhMSmYTu9/ThF8RtGgtstq5oUtdhZmKoRnpnuWe
> GHFPPidSBD9NOs1MFgj1+8kkvcTFLE6kPRupfNN9nJKFm4gZ8dpV602WOJWlK1dJ
> 4ViK5fFU4AwOoGpqZrmMG6J8bzOKs6U6rNJP4YLSvMyRyEOj5qVwAo9x4V+NpgHg
> 5NiWADvWnwISc7QdB84ViYsmF3ocIIZnzAgLbRa7kej/8NQ/ikndc7gAvjpseJi7
> R3GiaW816m/PElkXlbiszKxjJQSYP9uDfzURJ9oJyU5LNa1cNkr1RrWAtlh/j5RI
> mCwyq7I7MbFodsJe7ZGpUzspZfyk9lxSYAfaVZcE9v9fVJc1y6JbW0KyMl3MJyZG
> K0x+PA+X03gEDnr9fso3cijBc1gz3sVGyj3C5rOgaCnlasRQzbjcjOaIx8GpUTgU
> 4OgP5k/Agz6eYr08JES1cvOeug7TYGY4x84MRwe++RgaOhf/1W7v4Hrvm22hBGcA
> ivBr0xt0rdzCQKeX2JriDMcqWE99KTEEqqWX4bA1l47UiaWg16wvyoxgexQT7Y0O
> larKwMr/5G9+2fQOoYzHL9EcDmzzWJHNjrIZmjrIMv+6fQ5b30aTIh+qI8yvg2vw
> roI7MOFS6TYefl0QhP8R
> =jP4n
> -END PGP SIGNATURE-

-- 
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: django using wrong python???

2010-12-30 Thread Graham Dumpleton
Are you having this problem with Django development server, or with a 
production type hosting setup such as mod_wsgi?

Need to know which.

Graham

On Friday, December 31, 2010 1:34:22 AM UTC+11, yelbuke wrote:
>
> Hi,
>
> I'm on centos and have two pythons 2.5 and 2.6.
>
> I tried in models.py:
>
> from fractions import Fraction
>
> and got the error: No module named fractions
>
> But when i use shell and type "from fractions import Fraction" it's OK, it 
> uses python2.6 installation.
>
> How can i modify django installation to use python2.6???
>
> I already defined alias in bash_profile for python2.6, but it seems it 
> doesnt work for django.
>
> 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-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.



ModelForm and checkbox from choices

2010-12-30 Thread robos85
In my model i have that part:
... 

STATUSES_CHOICES = (
(0, _(u'one')),
(1, _(u'two')),
(2, _(u'three'))
)
...
status = models.SmallIntegerField(default=0, choices=STATUSES_CHOICES, 
null=True, blank=True)




then in my form based on that model I wanto to make that field as checkbox 
list. I know that I can make it as:
class Meta:
widgets = {'categories' : forms.CheckboxSelectMultiple, }

but, I want to change that field's label. How can I do that to server that 
list with changed label?

-- 
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: Attempting to save instance with null ID?

2010-12-30 Thread W. Craig Trader
Jonathan ...

The problem is in the difference in SQLite and Oracle.  Unlike MySQL,
PostgresQL, and SQLIte, Oracle doesn't have auto-generated primary keys.  To
make up for that, Django on Oracle uses a trigger for each Django-managed
table that recognizes a NULL primary key on insert, and generates a key by
using a dedicated sequence for that table.  Usually if you're creating the
tables from scratch, the Django management tools (syncdb, sqlall, etc) will
create the sequence and trigger for you.  Without knowing more about how
your populated your schema, it's hard to say what went wrong, but if you run
'python manage.py sqlall invdb' it should print out the DDL to create the
trigger and sequence, and you can manually add them.

- Craig -

On Thu, Dec 30, 2010 at 11:09, Jonathan Hayward <
christos.jonathan.hayw...@gmail.com> wrote:

> I'm migrating from SQLite to Oracle, and I'm getting an error thrown on the
> line disn_requisition.save() claiming that it has a null ID. I have not
> attempted to manually set or fiddle with id fields on any model, although I
> do read them.
> Any insight on what I need to do to address this?
> IntegrityError at /upload/storage
>
> ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID")
>
>   Request Method: POST Request URL: http://cmlnxbld01:8000/upload/storage 
> Django
> Version: 1.2.3 Exception Type: IntegrityError Exception Value:
>
> ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID")
>
>  Exception Location: 
> /tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django/db/backends/oracle/base.py
> in execute, line 507 Python Executable:
> /tools/python/2.7/Linux_x86_64/bin/python Python Version: 2.7.0 Python
> Path: ['/home/jhayward/invdb',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django_filter-0.5.3-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/ez_setup-0.9-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/hgsvn-0.1.8-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/paramiko-1.7.6-py2.7.egg',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/pycrypto-2.3-py2.7-linux-x86_64.egg',
> '/tools/python/cx_Oracle/10g/2.6/Linux_x86_64/lib/python2.6/site-packages',
> '/home/jhayward', '/home/jhayward/invdb/HOME_DIRECTORY',
> '/home/jhayward/invdb/HOME_DIRECTORY/invdb',
> '/tools/python/2.7/Linux_x86_64/lib/python27.zip',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/plat-linux2',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-tk',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-old',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-dynload',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages',
> '/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
>  Server
> time: Thu, 30 Dec 2010 10:04:24 -0600
> --
> [image: Christos Jonathan Hayward] 
> Christos Jonathan Hayward, an Orthodox Christian author.
>
> Author Bio  • 
> Books
>  • *Email * • 
> Facebook
>  • LinkedIn  • 
> Twitter
>  • *Web * • What's 
> New?
> I invite you to visit my "theology, literature, and other creative works"
> site.
>
>  --
> 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.
>

-- 
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: User authentication in Django

2010-12-30 Thread aaron
According to the docs you just need to add
 {% csrf_token %}

to each form.

sorry for the noise.

On Dec 30, 5:15 pm, aaron  wrote:
> okay, so I added a url directing accounts/login requests to a view
> which in turn directs it to the login.html template suggested at
>
> http://docs.djangoproject.com/en/dev/topics/auth/
>
> Which is:
>
> {% extends "base.html" %}
> {% load url from future %}
>
> {% block content %}
>
> {% if form.errors %}
> Your username and password didn't match. Please try again.
> {% endif %}
>
> 
> {% csrf_token %}
> 
> 
>     {{ form.username.label_tag }}
>     {{ form.username }}
> 
> 
>     {{ form.password.label_tag }}
>     {{ form.password }}
> 
> 
>
> I've taken out the "base.html" stuff. When I now submit a user and
> login (even though I've not yet created a user) I expect to see {% if
> form.errors %}
> Your username and password didn't match. Please try again.
> {% endif %}
>
> However instead I get an error: CSRF verification failed. Request
> aborted.
>
> Any ideas?

-- 
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: ModelForm validation

2010-12-30 Thread Axel Bock
Ah :) . I should have thought of that ... pretty stupid of me :)

Thanks for the clarification, I'll try that, makes perfect sense!


/Axel.



2010/12/30 derek 

> Alex
>
> And I seem to have been equally unclear :}
>
> I agree that cleaned_data is only available after is_valid() - the
> point being that your form *will* be valid if you have set the value
> for that field in a hidden input.  I do not see that this can be a
> "security risk" - the default that you are setting beforehand is a
> dummy (meaningless) value which, in any case, you are going to be
> overriding.  How is this done?  Consider this example from the Django
> Book (http://www.djangobook.com/en/1.0/chapter07/):
>
> def contact(request):
>if request.method == 'POST':
>form = ContactForm(request.POST)
>if form.is_valid():
>topic = form.clean_data['topic']
>
> Now if you wanted to overide the topic, you could instead have:
>topic = 'my custom text'
>
>
> Hope this is clearer!
>
> Derek
>
> On Dec 29, 4:07 pm, Axel Bock  wrote:
> > hi derek,
> >
> > thanks for your hints - was I really that unclear? hm.
> >
> > anyway, could you please give an example about how to "override/check the
> > value for that field after the form POST"? I don't seem to be able to do
> > that, and believe me, I have read the docs.
> >
> > I think cleaned_data is only available after is_valid() was called, but
> > is_valid() throws an exception because the required field is missing -
> and I
> > can't set it.
> >
> > The hidden field thing is the last thing I wanted to try. bad style, you
> > know :) , cause security risk.
> >
> > thanks!
> > Axel.
> >
> > 2010/12/29 derek 
> >
> >
> >
> >
> >
> >
> >
> > > Axel
> >
> > > Not sure I have followed all your requirements, but perhaps you can
> > > try:
> > > * set a default value for the required field
> > > * mask the required field on the form being shown to the user (make it
> > > hidden)
> > > * override/check the value for that field after the form POST and data
> > > "clean" (see:
> > >http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#proce.
> ..
> > > )
> >
> > > HTH
> > > Derek
> >
> > > On Dec 28, 10:21 pm, Axel Bock  wrote:
> > > > Hi all,
> >
> > > > I have this little problem. In my little webapp I have a data model
> which
> > > > defines several required fields. Depending on WHO is logged on, some
> of
> > > > these fields should not be changed by the user and be pre-filled (or
> > > better:
> > > > post-filled) by the application.
> >
> > > > Currently I delete the fields out of the formset like this:
> > > > # prevent entering missions for all other bases
> > > > del missionform.fields['base']
> >
> > > > so the field gets not rendered in the view. Which works nicely.
> >
> > > > Unfortunately base is required, so the validation fails. Now how can
> I
> > > > insert the missing values into the POST data? I tried this:
> > > > if request.user.userflag.is_student:
> > > > logging.error("studen")
> > > > inst=FlownMission(
> > > > student=request.user,
> > > > base=request.user.studentinfo.current_base
> > > > )
> > > > flownmission = FlownMissionForm(request.POST, instance=inst)
> >
> > > > which does not work at all :( . The validation fails all the time ...
> . I
> > > > just need to inject 2 required values somewhere in the POST data, but
> I
> > > have
> > > > no clue how.
> >
> > > > Any help would be greatly appreciated, and I am a total django "newb"
> ...
> > > :)
> >
> > > > Thanks & greetings,
> > > > Axel.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-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.
>
> --
> 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.
>
>

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

Re: De-coupling settings.py from project

2010-12-30 Thread Christophe Pettus

On Dec 30, 2010, at 8:50 AM, eblume wrote:
> Is there a way to specify settings like STATIC_URL or FIXTURES_DIRS
> per-application rather than per-site? Even better - is there a
> mechanism to use a settings.py file in the application rather than in
> the site?

I think that your overall goal is quite admirable, but this may be an 
optimization too far.  One way to think of the way Django organizes its code is 
that a project is the platform on which applications are deployed.  The role of 
settings.py (and the top-level urls.py) is to configure the applications for a 
particular deployment, so things like STATIC_URL that are specific to a 
particular deployment of the app should not be in the app itself.

Thus, the top-level settings.py should include stuff that is:

1. General across all applications, or,
2. Used to configure a particular application for a particular deployment.

All that being said, it's no big deal to emulate the urls.py include facility 
in settings.py; just include your app-specific settings.  You can also have a 
'settings.py' (or whatever) file within the application that only that app 
imports.

--
-- Christophe Pettus
   x...@thebuild.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-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: User authentication in Django

2010-12-30 Thread aaron
Okay, that problem is fixed. I just added the /accounts/login to the
url file.

New problem:

 my login page is giving me: CSRF verification failed. Request aborted

This is the html from login.html

{% block content %}

  {% if form.errors %}
Sorry, that's not a valid username or password
  {% endif %}

  
{% csrf_token %}
User name:

Password:




  

{% endblock %}

Any ideas?

Cheers,
Aaron

On Dec 30, 4:33 pm, aaron  wrote:
> Hi guys,
>
> I'm attempting to follow the very simple setup for user authentication
> in Django as detailed in the documentation here:
>
> http://docs.djangoproject.com/en/dev/topics/auth/
>
> I've got a database synced, the apps installed as detailed, but when I
> attempt to access a password protected url it gives me the following
> 404 message:
>
> Using the URLconf defined in logintest.urls, Django tried these URL
> patterns, in this order:
> ^logintest/
> ^admin/doc/
> ^admin/
> ^secret/
> The current URL, accounts/login/, didn't match any of these.
>
> Secret is the app that simply renders a page that says 'secret'. It
> works fine when the @login decorator is commented out.
>
> Any ideas?

-- 
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: User authentication in Django

2010-12-30 Thread aaron
okay, so I added a url directing accounts/login requests to a view
which in turn directs it to the login.html template suggested at

http://docs.djangoproject.com/en/dev/topics/auth/

Which is:

{% extends "base.html" %}
{% load url from future %}

{% block content %}

{% if form.errors %}
Your username and password didn't match. Please try again.
{% endif %}


{% csrf_token %}


{{ form.username.label_tag }}
{{ form.username }}


{{ form.password.label_tag }}
{{ form.password }}



I've taken out the "base.html" stuff. When I now submit a user and
login (even though I've not yet created a user) I expect to see {% if
form.errors %}
Your username and password didn't match. Please try again.
{% endif %}

However instead I get an error: CSRF verification failed. Request
aborted.

Any ideas?

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



De-coupling settings.py from project

2010-12-30 Thread eblume
I'm new to Django and trying to create an office intranet web service.
Because I value pragmatic programming, I want to take the time to 'do
it right' and so I'm spending as much time as possible de-coupling the
'django application' from the 'django project' (or 'django site' -
these seem to be synonyms.)

To that end, I've managed to de-couple the urls.py file by using the
url importing system, and the templates by using a template loader.
However, a few settings seem to be impossible to de-couple from the
project to the application.

In particular, I'm having trouble specifying the static content URL
and the fixtures directories at a per-application level rather than in
the project settings.py file.

Is there a way to specify settings like STATIC_URL or FIXTURES_DIRS
per-application rather than per-site? Even better - is there a
mechanism to use a settings.py file in the application rather than in
the site?

Thanks,
eblume

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



User authentication in Django

2010-12-30 Thread aaron
Hi guys,

I'm attempting to follow the very simple setup for user authentication
in Django as detailed in the documentation here:

http://docs.djangoproject.com/en/dev/topics/auth/

I've got a database synced, the apps installed as detailed, but when I
attempt to access a password protected url it gives me the following
404 message:

Using the URLconf defined in logintest.urls, Django tried these URL
patterns, in this order:
^logintest/
^admin/doc/
^admin/
^secret/
The current URL, accounts/login/, didn't match any of these.

Secret is the app that simply renders a page that says 'secret'. It
works fine when the @login decorator is commented out.

Any ideas?

-- 
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: ModelForm validation in 1.2.3

2010-12-30 Thread Ferran
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 30/12/10 17:25, Burhan wrote:
>  In 1.2.3, this logic always fails because "is_clean()" fails if an
> existing customer enter's their email address. How can I do the same
> using django 1.2.3?

http://docs.python.org/tutorial/errors.html
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJNHLQCAAoJEAWOKfEESaOw/KkQAJpykIq4NuWT2pFlzT/jg2Ck
ZLPnKTABp7JmvDdNflreKhKDKmhMSmYTu9/ThF8RtGgtstq5oUtdhZmKoRnpnuWe
GHFPPidSBD9NOs1MFgj1+8kkvcTFLE6kPRupfNN9nJKFm4gZ8dpV602WOJWlK1dJ
4ViK5fFU4AwOoGpqZrmMG6J8bzOKs6U6rNJP4YLSvMyRyEOj5qVwAo9x4V+NpgHg
5NiWADvWnwISc7QdB84ViYsmF3ocIIZnzAgLbRa7kej/8NQ/ikndc7gAvjpseJi7
R3GiaW816m/PElkXlbiszKxjJQSYP9uDfzURJ9oJyU5LNa1cNkr1RrWAtlh/j5RI
mCwyq7I7MbFodsJe7ZGpUzspZfyk9lxSYAfaVZcE9v9fVJc1y6JbW0KyMl3MJyZG
K0x+PA+X03gEDnr9fso3cijBc1gz3sVGyj3C5rOgaCnlasRQzbjcjOaIx8GpUTgU
4OgP5k/Agz6eYr08JES1cvOeug7TYGY4x84MRwe++RgaOhf/1W7v4Hrvm22hBGcA
ivBr0xt0rdzCQKeX2JriDMcqWE99KTEEqqWX4bA1l47UiaWg16wvyoxgexQT7Y0O
larKwMr/5G9+2fQOoYzHL9EcDmzzWJHNjrIZmjrIMv+6fQ5b30aTIh+qI8yvg2vw
roI7MOFS6TYefl0QhP8R
=jP4n
-END PGP SIGNATURE-

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



ModelForm validation in 1.2.3

2010-12-30 Thread Burhan
Hello:

  In 1.2 ModelForm validation was changed so that not only does it
check the form validation, but it does validation of the model as
well.

  I have a model that has custom validation for one of its fields,
which should be unique in the table. Now I have a front end form,
created by ModelForm for this model.

  I want do to the following:

  1. Check if the fields are correctly filled in, as per the custom
validator written for this model.
  2. If an entry already exists for using the 'unique' field, return
that object.
  3. If and entry doesn't exist, create a new object.

  In the old django, before this change, I could easily do it:

  if request.method = 'POST':
 form = CustomerForm(request.POST)
 if form.is_clean():
try:
customer =
Customer.objects.get(email=form.cleaned_data['email'])
except Customer.DoesNotExist:
customer = form.save()

 In 1.2.3, this logic always fails because "is_clean()" fails if an
existing customer enter's their email address. How can I do the same
using django 1.2.3?

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



Attempting to save instance with null ID?

2010-12-30 Thread Jonathan Hayward
I'm migrating from SQLite to Oracle, and I'm getting an error thrown on the
line disn_requisition.save() claiming that it has a null ID. I have not
attempted to manually set or fiddle with id fields on any model, although I
do read them.
Any insight on what I need to do to address this?
IntegrityError at /upload/storage

ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID")

  Request Method: POST Request URL:
http://cmlnxbld01:8000/upload/storage Django
Version: 1.2.3 Exception Type: IntegrityError Exception Value:

ORA-01400: cannot insert NULL into ("INVDB"."INVDB_DISK_REQUISITION"."ID")

 Exception Location:
/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django/db/backends/oracle/base.py
in execute, line 507 Python Executable:
/tools/python/2.7/Linux_x86_64/bin/python Python Version: 2.7.0 Python
Path: ['/home/jhayward/invdb',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/django_filter-0.5.3-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/ez_setup-0.9-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/hgsvn-0.1.8-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/paramiko-1.7.6-py2.7.egg',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/pycrypto-2.3-py2.7-linux-x86_64.egg',
'/tools/python/cx_Oracle/10g/2.6/Linux_x86_64/lib/python2.6/site-packages',
'/home/jhayward', '/home/jhayward/invdb/HOME_DIRECTORY',
'/home/jhayward/invdb/HOME_DIRECTORY/invdb',
'/tools/python/2.7/Linux_x86_64/lib/python27.zip',
'/tools/python/2.7/Linux_x86_64/lib/python2.7',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/plat-linux2',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-tk',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-old',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/lib-dynload',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages',
'/tools/python/2.7/Linux_x86_64/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
Server
time: Thu, 30 Dec 2010 10:04:24 -0600
-- 
[image: Christos Jonathan Hayward] 
Christos Jonathan Hayward, an Orthodox Christian author.

Author Bio  • Books
 • *Email * •
Facebook
 • LinkedIn  •
Twitter
 • *Web * • What's
New?
I invite you to visit my "theology, literature, and other creative works"
site.

-- 
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: django using wrong python???

2010-12-30 Thread Alvaro Mouriño
2010/12/30 ozgur yilmaz :
> I have Centos, and it comes with python2.4(sorry, not 2.5). I installed
> python2.6 and django is under:

I work with CentOS too but installing different python versions in
parallel seemed like a lot of unnecessary work to maintain. So I
developed python-schizoid [0], a script that installs a virtual
environment with python 2.7, django trunk and many other useful
software.

It tries to install as much software inside the virtual environment as
possible to avoid depending on the (old) software installed on the
system. The only thing it does not install is the database engine.

Working like this makes packaging and deploying *a lot* easier because
your whole project and its dependencies (and even the python binaries)
are inside one directory. You also have the script bin/activate that
sets some useful environment variables that help working inside the
environment.

I know this doesn't actually answers your question but I thought you
may find it useful.

Regards,

[0] https://github.com/tooxie/python-schizoid

-- 
Alvaro Mouriño
http://askani.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Linux password authentication for django

2010-12-30 Thread Marc Aymerich
On Thu, Dec 30, 2010 at 4:41 PM, Marc Aymerich  wrote:

>
>
> On Thu, Dec 30, 2010 at 4:24 PM, Marc Aymerich wrote:
>
>>
>>
>> On Thu, Dec 30, 2010 at 6:35 AM, Bill  wrote:
>>
>>> Hi there,
>>>
>>> I want to know is there any authentication module base on Linux passwd/
>>> shadow file for django?
>>>
>>
>> http://atlee.ca/software/pam/module-index.html
>>
>> import pam
>> from django.contrib.auth.models import User
>>
>> class PamBackend:
>>
>> def authenticate(self, username=None, password=None):
>> # Check the username/password and return a User.
>> if pam.authenticate(username, password, service='login'):
>>  try:
>> return User.objects.get(username=username)
>> except User.DoesNotExist:
>> pass
>> return None
>>
>>
>>
> ouch, I misunderstood your question. if you're using mysql as a db backend
> for you django project, you can use pam-mysql
> http://pam-mysql.sourceforge.net/ for the authentication on your servers.
>

also you can look for libpam-mysql* package on your distro. repositories . *


-- 
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-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: ModelForm validation

2010-12-30 Thread derek
Alex

And I seem to have been equally unclear :}

I agree that cleaned_data is only available after is_valid() - the
point being that your form *will* be valid if you have set the value
for that field in a hidden input.  I do not see that this can be a
"security risk" - the default that you are setting beforehand is a
dummy (meaningless) value which, in any case, you are going to be
overriding.  How is this done?  Consider this example from the Django
Book (http://www.djangobook.com/en/1.0/chapter07/):

def contact(request):
if request.method == 'POST':
form = ContactForm(request.POST)
if form.is_valid():
topic = form.clean_data['topic']

Now if you wanted to overide the topic, you could instead have:
topic = 'my custom text'


Hope this is clearer!

Derek

On Dec 29, 4:07 pm, Axel Bock  wrote:
> hi derek,
>
> thanks for your hints - was I really that unclear? hm.
>
> anyway, could you please give an example about how to "override/check the
> value for that field after the form POST"? I don't seem to be able to do
> that, and believe me, I have read the docs.
>
> I think cleaned_data is only available after is_valid() was called, but
> is_valid() throws an exception because the required field is missing - and I
> can't set it.
>
> The hidden field thing is the last thing I wanted to try. bad style, you
> know :) , cause security risk.
>
> thanks!
> Axel.
>
> 2010/12/29 derek 
>
>
>
>
>
>
>
> > Axel
>
> > Not sure I have followed all your requirements, but perhaps you can
> > try:
> > * set a default value for the required field
> > * mask the required field on the form being shown to the user (make it
> > hidden)
> > * override/check the value for that field after the form POST and data
> > "clean" (see:
> >http://docs.djangoproject.com/en/dev/topics/forms/?from=olddocs#proce...
> > )
>
> > HTH
> > Derek
>
> > On Dec 28, 10:21 pm, Axel Bock  wrote:
> > > Hi all,
>
> > > I have this little problem. In my little webapp I have a data model which
> > > defines several required fields. Depending on WHO is logged on, some of
> > > these fields should not be changed by the user and be pre-filled (or
> > better:
> > > post-filled) by the application.
>
> > > Currently I delete the fields out of the formset like this:
> > >             # prevent entering missions for all other bases
> > >             del missionform.fields['base']
>
> > > so the field gets not rendered in the view. Which works nicely.
>
> > > Unfortunately base is required, so the validation fails. Now how can I
> > > insert the missing values into the POST data? I tried this:
> > >         if request.user.userflag.is_student:
> > >             logging.error("studen")
> > >             inst=FlownMission(
> > >                 student=request.user,
> > >                 base=request.user.studentinfo.current_base
> > >             )
> > >         flownmission = FlownMissionForm(request.POST, instance=inst)
>
> > > which does not work at all :( . The validation fails all the time ... . I
> > > just need to inject 2 required values somewhere in the POST data, but I
> > have
> > > no clue how.
>
> > > Any help would be greatly appreciated, and I am a total django "newb" ...
> > :)
>
> > > Thanks & greetings,
> > > Axel.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: Linux password authentication for django

2010-12-30 Thread Marc Aymerich
On Thu, Dec 30, 2010 at 4:24 PM, Marc Aymerich  wrote:

>
>
> On Thu, Dec 30, 2010 at 6:35 AM, Bill  wrote:
>
>> Hi there,
>>
>> I want to know is there any authentication module base on Linux passwd/
>> shadow file for django?
>>
>
> http://atlee.ca/software/pam/module-index.html
>
> import pam
> from django.contrib.auth.models import User
>
> class PamBackend:
>
> def authenticate(self, username=None, password=None):
> # Check the username/password and return a User.
> if pam.authenticate(username, password, service='login'):
>  try:
> return User.objects.get(username=username)
> except User.DoesNotExist:
> pass
> return None
>
>
>
ouch, I misunderstood your question. if you're using mysql as a db backend
for you django project, you can use pam-mysql
http://pam-mysql.sourceforge.net/ for the authentication on your servers.



-- 
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-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: Linux password authentication for django

2010-12-30 Thread Marc Aymerich
On Thu, Dec 30, 2010 at 6:35 AM, Bill  wrote:

> Hi there,
>
> I want to know is there any authentication module base on Linux passwd/
> shadow file for django?
>

http://atlee.ca/software/pam/module-index.html


import pam
from django.contrib.auth.models import User

class PamBackend:

def authenticate(self, username=None, password=None):
# Check the username/password and return a User.
if pam.authenticate(username, password, service='login'):
 try:
return User.objects.get(username=username)
except User.DoesNotExist:
pass
return None


-- 
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-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: django using wrong python???

2010-12-30 Thread smallfish
you can try ln -s python2.6 to default python, and then modify the yum
script to python2.4.
--
blog: http://chenxiaoyu.org



On Thu, Dec 30, 2010 at 10:53 PM, ozgur yilmaz  wrote:

> I have Centos, and it comes with python2.4(sorry, not 2.5). I installed
> python2.6 and django is under:
>
> /usr/lib/python2.4/site-packages/django
> /usr/lib/python2.6/site-packages/django
>
> i defined alias in bash_profile, so when i give "python" command from
> shell, python2.6 works...
>
> 2010/12/30 Robbington 
>
> Why/how have you two versions of Python installed?
>>
>> Where is Django installed?
>>
>> Rob
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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: django using wrong python???

2010-12-30 Thread ozgur yilmaz
I have Centos, and it comes with python2.4(sorry, not 2.5). I installed
python2.6 and django is under:

/usr/lib/python2.4/site-packages/django
/usr/lib/python2.6/site-packages/django

i defined alias in bash_profile, so when i give "python" command from shell,
python2.6 works...

2010/12/30 Robbington 

> Why/how have you two versions of Python installed?
>
> Where is Django installed?
>
> Rob
>
> --
> 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.
>
>

-- 
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: django using wrong python???

2010-12-30 Thread Robbington
Why/how have you two versions of Python installed?

Where is Django installed?

Rob

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



django using wrong python???

2010-12-30 Thread ozgur yilmaz
Hi,

I'm on centos and have two pythons 2.5 and 2.6.

I tried in models.py:

from fractions import Fraction

and got the error: No module named fractions

But when i use shell and type "from fractions import Fraction" it's OK, it
uses python2.6 installation.

How can i modify django installation to use python2.6???

I already defined alias in bash_profile for python2.6, but it seems it
doesnt work for django.

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-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: django test framework with no models.py

2010-12-30 Thread Seth Gordon
On 12/27/2010 09:58 AM, Henrik Genssen wrote:
> Hi,
> 
> I wanted to write a test for an app, that does not have a models.py itself.
> Doing so I get:
> django.core.exceptions.ImproperlyConfigured: App with label service could not 
> be found
> 
> if I create a models.py with just a "pass" in it everything works as expected.
> I use Django 1.1

I worked around the same problem (in 1.2, at least) with just an empty
models.py file—I didn’t even need the “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-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: django and eclipse

2010-12-30 Thread CrabbyPete
You have to set up the run environment. Make sure on run manage.py and
the parameters are runserver x.x.x.x:000 where x.x.x.x is the server
and :000 is the port you want to run from.  After that it should not
ask anything and run off your settings.

On Dec 29, 7:38 pm, Emmanuel Mayssat  wrote:
> I installed the pydev plugin in eclipse.
> I configured it.
> Imported my django project and it almost works.
>
> Is any one of you using django/eclipse?
>
> Well, all goes well until I start the django development server.
> 1/ how can I change the default port, it is running on ?
> 2/ My sqlite db files is regenerated by the runserver (I had never
> seen  that!) in a different directory (at the project level).
> If I symlink the 2 db files, it works as expected.
> Any clue?
>
> BTW, I noticed that when creating a django project in eclipse, it ask
> for the path to the db files (when using sqlite3)
> It is configured to point to the right location, but runserver doesn't get 
> that.
> So what is this db file path used for ? (settings.py is created but
> not even configured...)
>
> --
> Emmanuel Mayssat

-- 
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: database migration

2010-12-30 Thread Torsten Bronger
Hallöchen!

Torsten Bronger writes:

> Hallöchen!
>
> Michael P. Soulier writes:
>
>> On 29/12/10 Torsten Bronger said:
>>
>>> I don't recommend that.  If the database exceeds a certain size
>>> (and "certain" is MBs, not GBs), this simply fails.
>>
>> Is there a bug report for this issue? I find that very
>> disappointing.
>
> [...]

Sorry, an addition for Adblock occupied my clipboard.  The real link
is http://code.djangoproject.com/ticket/5423

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-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: database migration

2010-12-30 Thread Ferran
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 30/12/10 13:17, Torsten Bronger wrote:
>> Is there a bug report for this issue? I find that very
>> > disappointing.
> http://1.2.3.12/bmi/stc.celeb.gate.cc/banner/pi/0120.gif

What i found disappointing is sending a NSFW image to a django list
without a note.

Thank your for my first post-xmas first boss talk :D
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCAAGBQJNHIMpAAoJEAWOKfEESaOw7rEQAI8AUH7EeF51ZocVJJOzi5sa
gavH1N9MesBtEiraN1t+sQyXy7m/wzlO4qRbhDkb56V8LrS2UME6kse7OY6TmmLV
Qkmqfmg4s0RdVQnWaOPEQax0oqb19kwjetr2HSleVV/uWB6DV5xiDVqojtuP7s9x
Tj3PJs8V1kUBpK5twHkRFSJRFqv5Yy/KRNiOdLXrRpenqivbqVHb8jwLPtZFN4Cc
FSpOljQ/A08jI644vhfUCOQJuI40IRaRQjVINolRhqmR5i0nI7ZOEz/rIgksgiIq
m+T//vuXKfJJ7QxMw5zl8ERpqwl67uebkKEeeFgKzIW8Y1v39OWNcK0TkJlI3bgW
MHicwZ+TNkmzNwINPDbnuNiBmZdLE6Ypg+Cng5na4j7IKr/aiyRcRAQl2MWR67XK
hS+MPCmEZMyPFVyM0cnKz3DIMhVZWXVyCu6rf1iR4yyI/5FAdYLxAwsRKGeh9Llp
BLM4fozVrkx6aUnEaAgLpaOLTSD41M3lQiIlT/NtXM3zqWUWWFtYZT2/m5XwWins
yaeFSHiYobmAuYz6Z6uwLLsejpsv/TTLpuxi5vyOWAVZd1UBdTnLtYEtX5+twrur
/4qHgxs8S7y3XnDvc/Hei1sDq9QA9OLs+UXD8cOHqtFrDoS22g7rxzQnU2dSsal8
GdMSrAYBtIjeTnqJSiLS
=tOGZ
-END PGP SIGNATURE-

-- 
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: database migration

2010-12-30 Thread Torsten Bronger
Hallöchen!

Michael P. Soulier writes:

> On 29/12/10 Torsten Bronger said:
>
>> I don't recommend that.  If the database exceeds a certain size
>> (and "certain" is MBs, not GBs), this simply fails.
>
> Is there a bug report for this issue? I find that very
> disappointing.

http://1.2.3.12/bmi/stc.celeb.gate.cc/banner/pi/0120.gif

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-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: Linux password authentication for django

2010-12-30 Thread Michael P. Soulier
On 29/12/10 Bill said:

> Hi there,
> 
> I want to know is there any authentication module base on Linux passwd/
> shadow file for django?

You want pam authentication. Look for django and pam.

Mike


signature.asc
Description: Digital signature


OpenID Provider

2010-12-30 Thread antoniofcano
Hello,

I'm trying to setting up an OpenID provider for an application that I
wrote using Django. For this task I use the django_openid_provider
(http://www.romke.net/django/openid_provider/) app.

After installing, syncdb of the ddbb, associate an user with his
openid... the truth moment comes and it fails :(

I'm becoming crazy trying to debug the flow but without results. For
the consumer test I'm trying to publish a comment in blogspot. The log
of my runserver is this it:

[30/Dec/2010 12:59:50] "GET /openidprovider/?openid.ns=http://
specs.openid.net/auth/
2.0=checkid_setup_id=http://
ao.getcloud.info:8000/openidprovider/antoniofcano/
=http://ao.getcloud.info:8000/openidprovider/
antoniofcano/_to=https://www.blogger.com/comment.do?
loginRedirect%3DSFC1293710388560%26gx.rp_st
%3DAEp4C1u745Vy1t_hie5m36xCAqfy8xNlu_olr-
kpYzI5jg1CCl_0iZxlc0f2i6tYVCdNuOQ8VUIfNrE5xGlvjqd59od_U5p0r7AOHk67nQNc52CEabJVcds4v7zcglL9yM9BKma4En1Wv31nePI7sSXSH4YBZ_ddhmKRhg7Ggv4-
n0frnpGpZu4g24mi6-2veeYPFwmOzV5YezkuWNHjEgyi2YPrtn4p2i7oWsbzWnDQssv-0Bo4UdXqz3nmM9moyLyuYdx5m-
YfOdlhCzKPA0XDSjtnO3yQmfZ-sHxFcjLApDmkrPHMdAKbKwyZ-cUVz-
Nr0mPA3scTt2HhDfLH3bPoXuS7m3cxFw=https://
www.blogger.com=http://openid.net/srv/ax/1.0=fetch_request=http://axschema.org/namePerson/friendly=http://schema.openid.net/namePerson/friendly=http://axschema.org/namePerson=http://schema.openid.net/namePerson=attr0,attr1,attr2,attr3=http://openid.net/extensions/sreg/1.1=nickname,fullname
HTTP/1.1" 302 0

[30/Dec/2010 12:59:51] "HEAD /openidprovider/antoniofcano/ HTTP/1.1"
200 0
[30/Dec/2010 12:59:51] "GET /openidprovider/antoniofcano/ HTTP/1.1"
200 288
[30/Dec/2010 12:59:52] "POST /openidprovider/ HTTP/1.1" 403 2326

Someone has experience with this task? Please, I don't know where to
go now :)

Best wishes and happy new year,

-- 
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: django and eclipse

2010-12-30 Thread Rajendra Waghmare

To run Django server on specific  IP and port you can use following
command:

python manage.py runserver :

e.g. python manage.py runserver 11.12.13.145:5678

If you do not specify IP and the port it starts on
localhost(127.0.0.1) and port 8000.

If you are using command prompt and do not want to use it, you can use
eclipse for the same, following link is useful for this:

http://www.magpiebrain.com/2006/10/09/using-eclipse-and-pydev-for-django/

--Rajendra.

On Dec 30, 10:05 am, girish shabadimath 
wrote:
> to change port:
> django-admin.py runsserver 
>
> On Thu, Dec 30, 2010 at 6:24 AM, Emmanuel Mayssat wrote:
>
>
>
> > For the sqlite.db file issue, I changed the settings.py with:
>
> > import os
> > PROJECT_DIR = os.path.dirname(__file__)
> > ...
> > DATABASE_ENGINE = 'sqlite3'
> > DATABASE_NAME = os.path.join(PROJECT_DIR, 'sqlite.db')
>
> > that now works as expected.
> > --
> > Emmanuel Mayssat
>
> > On Wed, Dec 29, 2010 at 4:38 PM, Emmanuel Mayssat 
> > wrote:
> > > I installed the pydev plugin in eclipse.
> > > I configured it.
> > > Imported my django project and it almost works.
>
> > > Is any one of you using django/eclipse?
>
> > > Well, all goes well until I start the django development server.
> > > 1/ how can I change the default port, it is running on ?
> > > 2/ My sqlite db files is regenerated by the runserver (I had never
> > > seen  that!) in a different directory (at the project level).
> > > If I symlink the 2 db files, it works as expected.
> > > Any clue?
>
> > > BTW, I noticed that when creating a django project in eclipse, it ask
> > > for the path to the db files (when using sqlite3)
> > > It is configured to point to the right location, but runserver doesn't
> > get that.
> > > So what is this db file path used for ? (settings.py is created but
> > > not even configured...)
>
> > > --
> > > Emmanuel Mayssat
>
> > --
> > 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.
>
> --
> Girish M S

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



Getting model instances from cursor fetches

2010-12-30 Thread Viktor Kojouharov
Hello,

I have a stored procedure which creates a cursor for a query, and also 
returns the total count for the (unlimited) query. The query itself can be 
mapped to my model if ran through the raw method of the manager. However, 
I'm interested in using the procedure, rather than 2 separate queries for 
the count and the instances.

The documentation indicates that I should use the connection.cursor method 
for invoking custom sql. My initial plan is to first execute the procedure, 
which would return the count and open the query cursor, and then execute a 
'fetch all' for that cursor (I doubt 'fetch next' would be better, since the 
result is stuffed into the django cursor anyway, but I could be wrong here). 
But after I fetch from the query cursor, how do I initialize my model 
objects with the data from that cursor?

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