Re: django-registration with my custom user profile

2008-06-13 Thread Chr1s
any help:? On Jun 13, 6:02 pm, Chr1s <[EMAIL PROTECTED]> wrote: > Hi thanks for your replay, > It is the second situation, I re-write the form.py like this > > class RegistrationForm(forms.Form): >   (other stuff  ) > def save(self, profile_callback=None): > >         new_user = > Re

Re: Django HTML Editor

2008-06-13 Thread Ngu Soon Hui
Forgot to mention, it would be definitely helpful if there is a WYSIWYG editor available. Thanks On Jun 14, 2:06 pm, Ngu Soon Hui <[EMAIL PROTECTED]> wrote: > I want a free HTML editor that is compatible with Django template's > syntax. I just want to edit my Django power application's HTML faste

Django HTML Editor

2008-06-13 Thread Ngu Soon Hui
I want a free HTML editor that is compatible with Django template's syntax. I just want to edit my Django power application's HTML faster. When I say compatible, I mean that the editor shouldn't screw up all the Django template's tags and variables. I used some HTML editors out there, but they ar

Re: Disconnected ORM objects

2008-06-13 Thread Karish
Well, my objects start out as something disconnected (eg, an email message and its associated email addresses are download via POP3), and only then am I adding everything to the database. So the download_email_messages method of my EmailClient class would return a Python list of EmailMessage objec

Re: Disconnected ORM objects

2008-06-13 Thread James Bennett
On Fri, Jun 13, 2008 at 11:01 PM, Karish <[EMAIL PROTECTED]> wrote: > I want to be able to use my ORM objects (eg, EmailMessage, > EmailAddress) in some cases without a database. For example, I want to > write a function like download_email_messages that will download email > messages and return a

Re: Extending User model with model inheritance?

2008-06-13 Thread James Bennett
On Fri, Jun 13, 2008 at 10:54 PM, meppum <[EMAIL PROTECTED]> wrote: > With the query refactoring branch being merged to the trunk I wanted > to finally move some of the data I had put on my user profiles to a > derrived user model. I didn't see this mentioned in the documentation > and I wanted to

Cascading updates/inserts

2008-06-13 Thread Karish
I want to create a bunch of objects that are interconnected in my model (eg, one Book and three Author objects) and then call save() on the Book object to add everything to the database. In other words, I don't want to have to call save() on each and every object (not only will it result in excess

Disconnected ORM objects

2008-06-13 Thread Karish
Hi, I want to be able to use my ORM objects (eg, EmailMessage, EmailAddress) in some cases without a database. For example, I want to write a function like download_email_messages that will download email messages and return an EmailMessage object which has a set of EmailAddress objects (for the

Re: Handling unknown data

2008-06-13 Thread [EMAIL PROTECTED]
Thanks guys... to be a little more clear. Each event will have a x of entrants... probably around 30, but I don't really know In event A, they'll have scores in 3 different scored categories, an overall score, there's a couple of fields about them (name, home, etc). No classes. Event B doesn't h

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
Maybe because you actually have to pass `action`? ;) Pass it through your form. Maybe my use of 'action' confused you with the 's action property. Not what I meant, sorry. I didn't realize you had an actual form (Wait, why do you .. Ok, beyond the point) but in this case you can just check for an

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
This is what my template looks like: {{ form.as_table }} This is what my view looks like: ... myform = MyForm() if request.method=="GET": myform = MyForm(request.GET) if request.GET.get('action') == True: if myform.is_valid(): ... ... return render_to_response ('templat

Re: VM mentioned in Where2.0 GeoDjango talk

2008-06-13 Thread tlpinney
Hi Pedro, I uploaded it today. It is linked on the front page of http://geodjango.org. Cheers, Travis On Jun 13, 1:36 pm, "Pedro Valente" <[EMAIL PROTECTED]> wrote: > Hello, > > I was reading the presentation "Rapid Geographic Web Application > Development with GeoDjango" > (http://en.oreilly

Re: Django Tutorial Clarification

2008-06-13 Thread Kenneth Gonsalves
On 13-Jun-08, at 7:23 PM, shabda wrote: >> I have never used generic views, so share your confusion > > Well you really should. :) true - I *do* feel guilty about it, but not guilty enough to go find out how to use them > -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.i

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
If errors are showing when you first load the page then you need to check that the user has actually completed an action before validating the form. In this case, doing something like if request.GET.get('action') == True: # your form validation here In your links back to the system, simply add

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
The problem is when I use myform = MyForm(request.GET) if myform.is_valid(): ... Any fields which are required have their error message activated on first visit to page. Also, any 'initial' value that I put in the forms is not shown. --~--~-~--~~~---~--~~ You rec

Re: Form Validation for GET Request

2008-06-13 Thread Russell Keith-Magee
On Sat, Jun 14, 2008 at 9:05 AM, ichbindev <[EMAIL PROTECTED]> wrote: > > However, form.is_valid() is for POST only. Is there an is_valid() kind > of thing for forms where method is GET so that data may be validated? I don't know what gave you the idea that is_valid() is just for POST data. There

Re: Roadmap to 1.0 and internationalization in db

2008-06-13 Thread Russell Keith-Magee
On Sat, Jun 14, 2008 at 6:57 AM, James Bennett <[EMAIL PROTECTED]> wrote: > > On Fri, Jun 13, 2008 at 5:38 PM, Adrián Ribao <[EMAIL PROTECTED]> wrote: >> I think I can make this work in three weeks, If I do, could it be >> considered for Django 1.0? > > Since it appears that it wouldn't introduce

Form Validation for GET Request

2008-06-13 Thread ichbindev
I am writing a report page where users get to enter data in a form and based on it search results are provided. There are at least four fields in the form and all are used in searching. We are not making any changes to data, we should use GET instead of POST as form method. Since this input is goi

Value Error after update to latest Django

2008-06-13 Thread Steve Potter
I just updated the the latest version of Django and I started getting the following error in the admin interface: Caught an exception while rendering: invalid literal for int() with base 10: 'None' It seems to be the result of a model I have with a DateTimeField with both null and blank set to T

Re: Modeling complex ER-diagrams with Django. How to get started?

2008-06-13 Thread Jeff Anderson
giovanni wrote: Hello: I am new to Django. I am intrigued by the possibility of providing a web front-end to complex databases. Let's say I have a database with more than 10 or 20 related tables, with a complex ER-diagram, such as, for example, the picture here: http://blog.hundhausen.com/files

Re: Can I loop over attributes in model.attribute?

2008-06-13 Thread Wim Feijen
Works like a charm, thank you very much! On Jun 12, 2:09 am, Johannes Dollinger <[EMAIL PROTECTED]> wrote: > You are looking for setattr():http://docs.python.org/lib/built-in- > funcs.html#l2h-66 > > for attr in ('groupon', 'companyon', 'addressfirst', 'extendnames',   > 'clubfieldson'): >      s

Re: Add filters to the Users List/Page in the admin app

2008-06-13 Thread Rajesh Dhawan
lps you decide. > > Hi Rajesh, > > Is it possible for present admin and nf-admin to co-exist? No. > > i.e I change my apps/models to nf-admin one-by-one. So a app/model will > have old admin until it is changed to nf-admin > > Is it possible? You could instead use the following snippet to conve

Re: SQLobject vs SQLAlchemy

2008-06-13 Thread Oscar Carlsson
I'm wondering - are there any performance related reasons to switch from Django ORM to say sqlalchemy? Why does this discussion reoccur every once in a while if there is nothing to gain? Are there other Good Reasons (tm) to switch? Oscar On Fri, Jun 13, 2008 at 8:49 AM, James Bennett <[EMAIL PRO

Re: Add filters to the Users List/Page in the admin app

2008-06-13 Thread M.Ganesh
Rajesh Dhawan wrote: > Hi Rishabh, > > >> This is what I was thinking, but I thought there was a glimmer of hope of >> achieving this without moving over to newforms-admin. Is there absolutely no >> way to do this using trunk?? >> > > There is: > > 1. You can tweak the django.contrib.auth

Re: Roadmap to 1.0 and internationalization in db

2008-06-13 Thread James Bennett
On Fri, Jun 13, 2008 at 5:38 PM, Adrián Ribao <[EMAIL PROTECTED]> wrote: > I think I can make this work in three weeks, If I do, could it be > considered for Django 1.0? Since it appears that it wouldn't introduce any backwards-incompatible changes, I'd be against putting it on a 1.0 timeline; it

Roadmap to 1.0 and internationalization in db

2008-06-13 Thread Adrián Ribao
Hello, Here I'm again with the same subject, internationalization in db. I think this should be included in 1.0, it's not so hard, I have thought a way to make it work: We have a class like this: class Book(models.Model): name = models.CharField( max_length=255, i18n=True) And the followin

Re: OneToOneField

2008-06-13 Thread Sebastian Bauer
second is true, you need to use OnetOneField(Model,primary=True) to make field primary_key Juanjo Conti pisze: > Here > http://www.djangoproject.com/documentation/db-api/#one-to-one-relationships > says: > > ''' > The semantics of one-to-one relationships will be changing soon, so we > don't re

OneToOneField

2008-06-13 Thread Juanjo Conti
Here http://www.djangoproject.com/documentation/db-api/#one-to-one-relationships says: ''' The semantics of one-to-one relationships will be changing soon, so we don't recommend you use them. ''' But in http://www.djangoproject.com/documentation/model-api/#one-to-one-relationships says: ''' Ne

Re: Pb with dumpdata/loaddata and unicode

2008-06-13 Thread LB
Thanks a lot, that was it. Upgrading to an SVN version of django solved the case. -- LB --~--~-~--~~~---~--~~ 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@googleg

Modeling complex ER-diagrams with Django. How to get started?

2008-06-13 Thread giovanni
Hello: I am new to Django. I am intrigued by the possibility of providing a web front-end to complex databases. Let's say I have a database with more than 10 or 20 related tables, with a complex ER-diagram, such as, for example, the picture here: http://blog.hundhausen.com/files/AdventureWorksLT

Re: Timezone conversion

2008-06-13 Thread Horst Gutmann
Django initializes the time module with the timezone specified in your settings module. So if you use datetime.datetime.now() you get a datetime instance from the specified timezone (but still a naive datetime object). If you build your own datetime instances, I think they will get stored as is in

VM mentioned in Where2.0 GeoDjango talk

2008-06-13 Thread Pedro Valente
Hello, I was reading the presentation "Rapid Geographic Web Application Development with GeoDjango" ( http://en.oreilly.com/where2008/public/schedule/detail/1666 ). In it there is mention to a Virtual Machine with everything pre-installed. Does anyone know if it's available for download somewher

Re: Timezone conversion

2008-06-13 Thread Darthmahon
Hi Horst, Thanks to your earlier post I now have time zones working! :) To be honest I didn't like the sound of using the mysql way, sounded a bit too much like a hack to me. One final question though - when you use the datetime field and insert into the database, is that date UTC or based on m

Re: DjangoAMF vs. pyAMF - any opinions?

2008-06-13 Thread Ederson Mota Pereira
Hi J Peyret... I'm in the same trouble that you... Do you have an advice for me, based in you researchs and in your knowledges after this message (May 2)? Thanks a lot On 5/2/08, J Peyret <[EMAIL PROTECTED]> wrote: > > > I am just starting out with Flex 3 and I'd like to know if anybody's > go

Re: Template engine

2008-06-13 Thread Scott Moonen
Would it be possible to borrow from the embedded ruby syntax and define something like this: {{ variable.name -}} {% tag param1,param2 -%} If the '-' was present as part of the tag closure token, the template processor would eat the next 1-2 characters only if they were a CR or CR/LF. Although I

Re: Template engine

2008-06-13 Thread Norman Harman
Russell Keith-Magee wrote: > If there is a particular whitespace-eating behaviour that you would > like, you could always implement it yourself in a template tag. If you > think the template tag could be useful for others, you can share it on > djangosnippets.org, or open a ticket to have the tag

Re: Template engine

2008-06-13 Thread titaniumlou
Is this white-space behavior the case with all template tags? Is it desirable for all template tags? Maybe only tags that are common to be at the top of a template file could have this enhancement to erase whitespace between them and the next real tag in the template? It seems to me that if cer

Re: auto generate models

2008-06-13 Thread Brian Rosner
On 2008-06-12 15:13:23 -0600, Justin Kennedy <[EMAIL PROTECTED]> said: > With Django, as I understand it, the class models have to be developer > first, and it takes care of setting up the db tables. I really prefer > this method, however, I would still like to create my Class Diagrams or > DB Mod

Re: Template engine

2008-06-13 Thread Russell Keith-Magee
On Fri, Jun 13, 2008 at 11:58 PM, Arien <[EMAIL PROTECTED]> wrote: > > On Fri, Jun 13, 2008 at 9:48 AM, Norman Harman <[EMAIL PROTECTED]> wrote: >> Template's white space handling is one of the few things that irks me >> about Django. I hate having to make confusing formating, jamming stuff >> al

registration with mandatory profile

2008-06-13 Thread pihentagy
Hi all! I need an app, which registers users but also forces user to fill out a profile. I found the link below, but it seems to me, that django-profile will not send email, and with django-registration I cannot force users to fill out a profile (I would like to use ModelForm for this) So what i

Re: Timezone conversion

2008-06-13 Thread Horst Gutmann
Well, to what user's timezone? SET (IIRC) changes the setting for the whole database connection (at least) so if you have multiple inserts for multiple users while using the same connection, the same setting their applies. Meaning it would affect not only one user put potentially multiple users th

Re: Template engine

2008-06-13 Thread Arien
On Fri, Jun 13, 2008 at 9:48 AM, Norman Harman <[EMAIL PROTECTED]> wrote: > Template's white space handling is one of the few things that irks me > about Django. I hate having to make confusing formating, jamming stuff > all on the same line just to get white space correct. > > I really wish it h

Re: Handling unknown data

2008-06-13 Thread Rajesh Dhawan
Hi, > I've got an "events" model. One of the things many (but not all) of > the events will have is results. Problem is, I don't know what the > results will look like in terms of rows or columns. > > Event 1 may have three classes, two groups and 40 winners, with 5 > fields for each winner (home

Re: Django test Client problems

2008-06-13 Thread Chatchai Neanudorn
Hi, If you want to add functionalities to test client, you may need to modify (or subclass, if posible ) the client code (django.test.client.Client). I used to add ability to set, get "HTTP_HOST" environment, For example, > self.client.http_host = "google.com" So, when my I run unit test, my co

Re: newforms-admin permissions

2008-06-13 Thread Rajesh Dhawan
emont88 wrote: > I just switched over to the newforms-admin branch because I need to > add specific permissions to my admin site. > I have been looking over the newforms-admin howto and the ModelAdmin > class, but I haven't been able to figure very much out. > > My app is a blogging app that nee

Re: Custom filters tied to form fields

2008-06-13 Thread Rajesh Dhawan
Hi Roodie, > Anyway, currently I see 2 solutions: > > 1. The longer way is to use the filter in the clean_ functions - > tedious job... > 2. Create a custom TextArea widget and implement the cleaning feature > there > > I think I wills tick with option #2 but maybe I missed some > undocumented at

Re: remove references

2008-06-13 Thread Rajesh Dhawan
Hello, > how can I achieve that a custom function (maybe in my model class) gets > called if a model becomes deleted? > > What I want to do is to ensure that all references to a model are > removed when it woun't exist any longer in the database. > > Is that possible? Yes, in a couple of ways:

Re: Session lost between two requests from the test client

2008-06-13 Thread Norman Harman
ksachdeva wrote: > Hi, > > From a testcase I first issue a 'get' request to a view (say view1) > where I set a request.session['m_key'] = 'myval'. Now I issue a 'post' > request to a view (say view2). In view2, I tried to obtain > request.session['m_key'] but I get an error that session does not

Re: Add filters to the Users List/Page in the admin app

2008-06-13 Thread Rajesh Dhawan
Hi Rishabh, > This is what I was thinking, but I thought there was a glimmer of hope of > achieving this without moving over to newforms-admin. Is there absolutely no > way to do this using trunk?? There is: 1. You can tweak the django.contrib.auth models.py file in your local installation i.e.

Re: Template engine

2008-06-13 Thread Norman Harman
Juanjo Conti wrote: > Hi, I am using Django's template engine to produce rtf files and I > have noticed something: if the first line of my template is a {%load > ... %} tag then the result has a withe like at the to of it. This is > not a problem in html, the common use of the tempalte engine, but

Re: Does django-driven Blog popular?

2008-06-13 Thread phillc
<3 byteflow i dont use the blog itsself, but i have stolen a ton of ideas from it. On Jun 13, 12:11 am, Eugene Lazutkin <[EMAIL PROTECTED]> wrote: > It is stupidly easy to write a blog using Django, and many people do so. > You can find many examples out there. One complete example is the > Bytef

Django test Client problems

2008-06-13 Thread shabda
I have some code like this, c = Client() client.get('/myurl/') where '//myurl' calls view function, def foo(request): ip_addrs = request.META['REMOTE_ADDR'] This view function works when I use a browser, as request.META['REMOTE_ADDR'] is populated. But when I use test Client, I get a keyerr

Re: Django Tutorial Clarification

2008-06-13 Thread shabda
> I have never used generic views, so share your confusion Well you really should. :) Well I have seen your name many times on the list so know that you are a longtime Django user. If you are not using generic views, you are missing something. On Jun 13, 12:41 pm, Kenneth Gonsalves <[EMAIL PROTE

Re: Timezone conversion

2008-06-13 Thread Darthmahon
Hi, Just been having a chat with someone at work and was offered an alternative. First of he said I should use a timestamp field instead of a datetime field, and then I can use " SET time_zone " in MySQL and that way all dates will be automatically converted to the users timezone. http://dev.my

remove references

2008-06-13 Thread Constantin Christmann
Hello, how can I achieve that a custom function (maybe in my model class) gets called if a model becomes deleted? What I want to do is to ensure that all references to a model are removed when it woun't exist any longer in the database. Is that possible? Regards, Constantin --~--~---

Re: Add filters to the Users List/Page in the admin app

2008-06-13 Thread Rishabh Manocha
This is what I was thinking, but I thought there was a glimmer of hope of achieving this without moving over to newforms-admin. Is there absolutely no way to do this using trunk?? I'll give newforms-admin a shot on my dev box over the weekend and see what comes out of it. I will research this too,

Re: django-registration with my custom user profile

2008-06-13 Thread Chr1s
Hi thanks for your replay, It is the second situation, I re-write the form.py like this class RegistrationForm(forms.Form): (other stuff ) def save(self, profile_callback=None): new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['userna

django-registration with my custom user profile

2008-06-13 Thread Chr1s
Hi guys I am newbie for django, today I tried django-registration, in the source code it said that --- To enable creation of a custom user profile along with the ``User`` (e.g., the model specified

Custom filters tied to form fields

2008-06-13 Thread Roodie
Hello, Is there an easy way to add a filter function to specific fields defined in a newforms Form? I have some large forms with lots of textareas. I am using tinymce to add some basic formatting capabilities to the textareas, and I need to use a filter function to "sanitize" the value of the tex

Re: django-registration with my custom user profile

2008-06-13 Thread James Bennett
2008/6/13 Chr1s <[EMAIL PROTECTED]>: > But still I don't know how to implement this, anyone could give me a > simple example? thanks very much This feature is intended for a situation where each of the following is true: 1. You have a custom user-profile model. 2. The user-profile model has been

django-registration with my custom user profile

2008-06-13 Thread Chr1s
Hi guys, I tried django-registration 0.5 today, it is powerful indeed, but I have a site-specific user profile just like this writen in my model.py class Userdetail(models.Model): user = models.ForeignKey(User, primary_key = True) # nickname = models.CharField(max_length=30) DOB = mo

Re: Does django-driven Blog popular?

2008-06-13 Thread Yves Serrano
If you don't want to start from scratch take a look at this links from "this week in django" http://blog.michaeltrier.com/2008/5/14/this-week-in-django-22-2008-05-11 byteflow http://blog.michaeltrier.com/2007/12/30/django-blogging-apps http://blog.michaeltrier.com/2007/12/6/blogmaker-for-django

Re: Timezone conversion

2008-06-13 Thread Darthmahon
Yea that's the one - so hopefully, once I assign it a timezone with .replace it will recognise it properly :) Excellent, I'll try it tonight. Thanks for all your help Horst :) On Jun 13, 9:27 am, "Horst Gutmann" <[EMAIL PROTECTED]> wrote: > Do you mean something like this? > > ValueError: astime

Re: Timezone conversion

2008-06-13 Thread Horst Gutmann
Do you mean something like this? ValueError: astimezone() cannot be applied to a naive datetime This just means that the datetime instance you're working with, has no timezone associated with it :-) -- Horst On Fri, Jun 13, 2008 at 10:22 AM, Darthmahon <[EMAIL PROTECTED]> wrote: > Right, so it

Re: Timezone conversion

2008-06-13 Thread Darthmahon
Right, so it doesn't automatically assign timezone information to it? I've seen some other examples where people have two/three fields just to store the timezone and date but I'd rather not have to go through all of that. At work at the moment, but will try this when I get home :) Any idea what

Re: Timezone conversion

2008-06-13 Thread Horst Gutmann
>From what I can see in the database, DateTime stores its content in the timezone specified in the settings.py by default. So when you fetch a datetime from the database you have to associated the respective timezone with that datetime instance: tzedate = edate.replace(tzinfo=gettz(settings.TIMEZ

Timezone conversion

2008-06-13 Thread Darthmahon
Hi Guys, I want to convert a datetime field for an entry in my database to a specified timezone. Here is the code I have so far: from dateutil.parser import * from dateutil.tz import * from datetime import * event = get_object_or_404(Event, id__exact=eventid) edate = event.date tz = gettz('Amer

Re: DB Models best practice

2008-06-13 Thread Brad Wright
On Jun 12, 11:44 pm, "Bartek Gniado" <[EMAIL PROTECTED]> wrote: > Instead of over complicating it like this. Why not just use memcached or > django's own cache? He's referring to: http://www.djangoproject.com/documentation/cache/ --~--~-~--~~~---~--~~ You receive

Re: Django Tutorial Clarification

2008-06-13 Thread James Bennett
On Fri, Jun 13, 2008 at 2:24 AM, wave connexion(BQ) <[EMAIL PROTECTED]> wrote: > Does this mean Django generated API code for you? No. The phrase "no code generation necessary" means precisely what it says: that, unlike some frameworks which require you to run a script which generates files of co

Re: Django Tutorial Clarification

2008-06-13 Thread Kenneth Gonsalves
On 13-Jun-08, at 12:54 PM, wave connexion(BQ) wrote: > 1. in reading overview, "you've got a free, and rich, Python API to > access your data. The API is created on the fly, no code generation > necessary?" > > Does this mean Django generated API code for you? django does not generate a sin

Django Tutorial Clarification

2008-06-13 Thread wave connexion(BQ)
I am new to Django, can someone make following clarification on Django tutorial: 1. in reading overview, "you've got a free, and rich, Python API to access your data. The API is created on the fly, no code generation necessary?" Does this mean Django generated API code for you? 2. in tutorial pa

Re: more info when serializing

2008-06-13 Thread [EMAIL PROTECTED]
Hi, With a bit of prompting from another Djangoista I've posted the python and json "full" serializer implementations to http://code.djangoproject.com/ticket/4656 . Please have a try and let me know if you find and bugs or have any other feedback. cheers Matthew On Dec 14 2007, 5:02 pm, "[EM