Re: modelform validation errors

2009-08-01 Thread zayatzz
Thanks This might have solved another issue i had not encountered yet, but it did not solve my current issue :) Form is still not valid and i have no idea why. If someone would tell me how modelform error messages are supposed to be used, then they might help me. {% if

Re: subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-01 Thread David Haas
Ramiro: I've set up some models / forms / formsets which demonstrate the change here: http://dpaste.de/YhrI/ My initial report wasn't correct - the change in behavior is only seen when initalizing ModelFormSets . . . the ModelForm behavior is unchanged. With a formset, the value use to get

Template and substitute

2009-08-01 Thread David
Hi, When I tested sql of MySQL in Python interactive shell, I got an error of "not enough arguments for format string". I checked the arguments however I could not find anything wrong. Can anybody give me a clue? Thanks so much. >>> sql = Template('select dimension1

Re: subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-01 Thread Ramiro Morales
On Sat, Aug 1, 2009 at 8:28 PM, David Haas wrote: > > Hi: > > I'm hoping to get some feedback on a little change in behavior I'm > seeing when initializing ModelForms between 1.1-beta & the official > 1.1 release. > > The quick and dirty explanation is this: I have a

Re: Python Conditional help

2009-08-01 Thread prabhu S
Also declare dan_id and stu_id as string. Unless request.GET can magically return you number, which I am not sure. Looks we are doing compilers job here :) On Aug 2, 1:17 am, Alex Gaynor wrote: > On Sat, Aug 1, 2009 at 6:59 PM, prabhu S wrote: > > >

Re: Python Conditional help

2009-08-01 Thread Alex Gaynor
On Sat, Aug 1, 2009 at 6:59 PM, prabhu S wrote: > > change student_id_validate to student_id_check > > Invalid variable dude. > > On Aug 2, 12:46 am, cprsystems wrote: >> I'm trying to redirect users of an html page to another page depending >> on the

Re: Python Conditional help

2009-08-01 Thread prabhu S
change student_id_validate to student_id_check Invalid variable dude. On Aug 2, 12:46 am, cprsystems wrote: > I'm trying to redirect users of an html page to another page depending > on the user id entered. I'm using if else statements and declaring ids > within views.py

Re: Log in problem

2009-08-01 Thread prabhu S
I think this should fix. Additionally if you are using render_to_response for some reason, it passes Context instead of RequestContext. To solve this do render_to_response('view', {}, context_instance=RequestContext(request)) On Aug 1, 9:10 pm, OIM wrote: > You should use:

Re: modelform validation errors

2009-08-01 Thread prabhu S
The method create_profile returns profile after saving. But this object will not contain primary keys etc generated in the db. To work around this common issue with django profile.save() # Get the data again from db. profile = Profile.objects.get(user=username) return profile Let me know if

Python Conditional help

2009-08-01 Thread cprsystems
I'm trying to redirect users of an html page to another page depending on the user id entered. I'm using if else statements and declaring ids within views.py named htmlp2. I keep getting syntax errors, any insight as to why would be much appreciated. My code is below Thank you from

Re: Can i add initial admin user?

2009-08-01 Thread Russell Keith-Magee
On Sat, Aug 1, 2009 at 5:38 PM, Mirat Can Bayrak wrote: > > i am playing a lot with my models in my project nowadays. On every change i > am deleting my sqlite3 file and running syncdb again.. its ok but creating a > admin user in every syncdb is booored me. is there

Re: Django newbie deployment question

2009-08-01 Thread prabhu S
Your apache server would run as www user. Where as you have saved your project in /root with root as the owner. To do this properly, do not save your django project in /root. Have it somewhere like /var/www and make "www" as the owner. Also fix execute permissions. chmod -R 700 should do. Or

subclassed ModelForms initial values behavior changed from 1.1beta to 1.1

2009-08-01 Thread David Haas
Hi: I'm hoping to get some feedback on a little change in behavior I'm seeing when initializing ModelForms between 1.1-beta & the official 1.1 release. The quick and dirty explanation is this: I have a ModelForm which is a subclass of another ModelForm. The parent ModelForm has the fields

Re: Template links when Django not domain root

2009-08-01 Thread Graham Dumpleton
Hacks which embed knowledge of the mount point in the application generally indicate that you are doing something wrong in your configuration. Stop trying to jump to solutions when hasn't even been determined what you are doing wrong. As suggested, post the mod_wsgi configuration you are using

Re: Trouble getting page to work

2009-08-01 Thread cprsystems
Figured it out. I was making a simple mistake using the actual html file name instead of the incoming url that's mapped to its def. Thank you for responding so quickly. On Aug 1, 4:56 pm, Dan Harris wrote: > what error are you getting? > > On Aug 1, 4:41 pm, cprsystems

Re: limit_choices_to

2009-08-01 Thread Daniele Procida
On Sat, Aug 1, 2009, Ramiro Morales wrote: >If you need this for the admin app and are using Django 1.1 read about >the formfield_for_foreignkey ModelAdmin method: > >http://docs.djangoproject.com/en/dev/ref/contrib/admin/

Re: Trouble getting page to work

2009-08-01 Thread Dan Harris
what error are you getting? On Aug 1, 4:41 pm, cprsystems wrote: > I'm trying to write a simple html page using Django that passes one > variable via a submit button and text line and prints it out to > another hmtl document. I'm having trouble getting it to work. Could >

Image handling - Custom image field?

2009-08-01 Thread TiNo
Hi, I am working on an image gallery. I am making use of django-imagekit. My site is hosted at a VPS, with 80 MBs of memory. I use NginX with fastcgi. What I am trying to accomplish is the following: 1. A logged-in user goes to an /upload page, where information about the ftp server is listed 2.

Re: limit_choices_to

2009-08-01 Thread Ramiro Morales
On Sat, Aug 1, 2009 at 12:05 PM, Daniele Procida wrote: > > I am trying to set up a model. > > A Person has a ManyToMany relationship with Entities. One of those > relationships is special - we can capture that with a ForeignKey > relationship to Entity. > > But, I want

Trouble getting page to work

2009-08-01 Thread cprsystems
I'm trying to write a simple html page using Django that passes one variable via a submit button and text line and prints it out to another hmtl document. I'm having trouble getting it to work. Could someone explain what I'm doing wrong? I've included the code below. urls.py # -*- coding: cp1252

Re: Log in problem

2009-08-01 Thread OIM
You should use: {% block user_info %} {% if user.is_authenticated %} User {{ user.username }} (logout | profile) {% endif %} {% endblock %} It works. --~--~-~--~~~---~--~~ You received

Re: modelform validation errors

2009-08-01 Thread zayatzz
I figured ill add the code i have so far: The models: class ProfileManager(models.Manager): def create_profile(self, username): "Creates and saves a User with the given username, e-mail and password." now = datetime.datetime.now() profile =

Re: using the stable api

2009-08-01 Thread Faheem Mitha
Hi Malcolm, Thanks for the helpful reply. On Sat, 01 Aug 2009 12:24:29 +1000, Malcolm Tredinnick wrote: > On Fri, 2009-07-31 at 11:42 -0400, Faheem Mitha wrote: >> >> Hi everybody, >> >> I upgraded from somewhere around Django 1.0 to 1.0.2, and some things >>

Re: redirecting after login

2009-08-01 Thread James
You can access the page that they were previously on using HttpRequest.META['HTTP_REFERER']. You'll probably need to persist it in a session so you still have access to it after they submit their login credentials (otherwise HTTP_REFERER would be the login page). I'm not sure if HTTP_REFERER can

Re: Dynamic Choices for ChoiceField

2009-08-01 Thread mviamari
On Jul 31, 7:37 pm, Malcolm Tredinnick wrote: > On Fri, 2009-07-31 at 16:31 -0700,mviamariwrote: > > Hello, > > > I'm trying to make a form for data entry into my database that uses > > ChoiceFields for foreign keys.  Obviously, the ideal choice would be > >

Re: redirecting after login

2009-08-01 Thread Justin Myers
The included login view (django.contrib.auth.views.login) takes an optional "next" argument for this: http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.views.login Hope that helps. -Justin On Jul 31, 9:15 am, When ideas fail wrote: > I was

Re: Template links when Django not domain root

2009-08-01 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Check out RequestContext and setting it up with the setting in settings.py: http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors Luke luke.seelenbin...@gmail.com "I [may] disapprove of what you say, but I will defend to

Re: Template links when Django not domain root

2009-08-01 Thread Streamweaver
Thanks for the great replies here. It seems from this there might be less repetition if I can just put a SITE_URL attribute in my settings.py file and then make that available to the template without having to go through the view. Is this possible or easy? Custom template filter perhaps but

Re: 1 template and multiple views?

2009-08-01 Thread J. Cliff Dyer
On Sat, 2009-08-01 at 18:35 +0200, Daniel Svonava wrote: > Hi, > > I have a simple question regarding Django template system. > > Lets imagine I have two blocks defined in my base template like this: > > Search bar > {% block A %} > {% endblock %} > > Content > {% block B %} > {% endblock %}

1 template and multiple views?

2009-08-01 Thread Daniel Svonava
Hi, I have a simple question regarding Django template system. Lets imagine I have two blocks defined in my base template like this: Search bar {% block A %} {% endblock %} Content {% block B %} {% endblock %} I have 3 independent apps in my project called RenderA, RenderB1 and RenderB2.

limit_choices_to

2009-08-01 Thread Daniele Procida
I am trying to set up a model. A Person has a ManyToMany relationship with Entities. One of those relationships is special - we can capture that with a ForeignKey relationship to Entity. But, I want to limit the choices for that special relationship to Entities that the person already has a

Re: URL & DB question

2009-08-01 Thread Rob B (uk)
Solved it by doing this: def profile_detail(request, name): p = get_object_or_404(Profile, name=name) return render_to_response('profile_detail.html', {'name': p}) On 1 Aug, 12:22, "Rob B (uk)" wrote: > Using the url to look up a user profile just not sure

Re: using multilingual fields to slugify urls

2009-08-01 Thread Livoi
Maybe this helps: http://groups.google.com/group/django-multilingual/browse_thread/thread/a8f521068ab5e0a4 On 23 Jun., 14:08, Marco Bazzani wrote: > ok this is a little bit complex problem (at least for me) > > let's supose that I've a model like this one: > > class

Django newbie deployment question

2009-08-01 Thread Ankur Gupta
Hello folks, I have facing the same problem mentioned in the stackoverflow question here ( http://stackoverflow.com/questions/962533/django-modpython-error-importerror-could-not-import-settings ). The solution doesn't seem to work Problem description The app runs fine using django internal

Re: Amazon Product Advertising API

2009-08-01 Thread Luke Seelenbinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bryan, I decided not to totally write a new module for it. I took pyaws, and re-factored it to account for the secret key you now have to use with requests. If you want the new ecs.py from pyaws, I'll be happy to get it to you. I'm not 100% sure it

Re: Amazon Product Advertising API

2009-08-01 Thread br...@instantdirectmarketing.com
Luke, I was curious how this was going. I did find this: http://jjinux.blogspot.com/2009/06/python-amazon-product-advertising-api.html import time import urllib from boto.connection import AWSQueryConnection AWS_ACCESS_KEY_ID = '...' AWS_ASSOCIATE_TAG = '...' AWS_SECRET_ACCESS_KEY = '...'

Re: Stopping people loging in twice

2009-08-01 Thread Tim Chase
> So is there a viable django solution for this problem? To build on what Malcolm was saying, the problem you have is that the only things your server knows are (1) when a user last engaged in a transaction with your server and optionally (2) when a user has intentionally logged out. #2 is

URL & DB question

2009-08-01 Thread Rob B (uk)
Using the url to look up a user profile just not sure what to put in the view. Any suggestions welcome. Model: class Profile(models.Model): title = models.ForeignKey(User, unique=True) name = models.CharField(max_length=50, null=False, blank=False) def __unicode__(self):

Re: how to get some related data from different tables to one queryset?

2009-08-01 Thread Unnamed_Hero
I think, I found what I need! Thanx for your patience! On 1 авг, 10:21, Unnamed_Hero wrote: > > If these are meant to be referring to entries in the tables for > > Translation1, etc, then make them ForeignKey fields, not IntegerFields. > > The way you have set up your

Re: Can i add initial admin user?

2009-08-01 Thread Mirat Bayrak
hmm it works 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

Re: Can i add initial admin user?

2009-08-01 Thread Jon Atkinson
On Sat, Aug 1, 2009 at 10:38 AM, Mirat Can Bayrak wrote: > > i am playing a lot with my models in my project nowadays. On every change i > am deleting my > sqlite3 file and running syncdb again.. You don't need to delete your entire database; it might be worth checking

Can i add initial admin user?

2009-08-01 Thread Mirat Can Bayrak
i am playing a lot with my models in my project nowadays. On every change i am deleting my sqlite3 file and running syncdb again.. its ok but creating a admin user in every syncdb is booored me. is there any way to give django a inital user with username : admin, and pass : admin ? -- Mirat

modelform validation errors

2009-08-01 Thread zayatzz
How can i see why my model form does not save? I added messages into view and those messages tell me that the form was not valid. Then i added {% if pform.non_field_errors %} {{ pform.non_field_errors.as_ul }} {%

Re: how to get some related data from different tables to one queryset?

2009-08-01 Thread Unnamed_Hero
> If these are meant to be referring to entries in the tables for > Translation1, etc, then make them ForeignKey fields, not IntegerFields. > The way you have set up your models, there is no way for Django to know > there is any relationship here. The point is that database is already filled