Re: Form Wizard and captcha
On 13.04.2009, at 21:43, Kirill Zaborski wrote: > So no answers were given and I tried to fix FormWizard class. > The patch is attached and the only thing changed is that the > revalidation is made with forms which were before the last one (I > do not see any reason for the second validation of it). > Is there any chance to get it into the trunk? > Do I need to make any additional steps for this to happen? open a ticket on code.djangoproject.com/simpleticket attach the patch and see what the devs think of it. adi > > Kirill. > > On 8 апр, 22:29, qrilka wrote: > > I've stumbled upon from revalidation in form wizard. The similar > > problem was discussed a year ago > > -http://groups.google.com/group/django-users/browse_thread/thread/a6fd > ... > > I have somewhat different problem: on the last of my forms I use > > captcha field, but after successful validation the test string for > it > > gets erased (either in cache in supercaptcha or in DB in django- > simple- > > captcha) and its quite normal from my point of view. But form wizard > > does form revalidation at the end so I get validation error. > > The only solution I see now (except from not using from wizard) is > to > > hack captcha field and not to delete test string after success.But > > this option lokks somewhat nasty to me. > > Maybe there are some other ways around? > > > > Best regards,Kirill. > > > > Index: django/contrib/formtools/wizard.py > === > --- django/contrib/formtools/wizard.py(revision 9975) > +++ django/contrib/formtools/wizard.py(working copy) > @@ -76,19 +76,19 @@ > self.process_step(request, form, current_step) > next_step = current_step + 1 > > -# If this was the last step, validate all of the forms > one more > +# If this was the last step, validate all of the > previous forms one more > # time, as a sanity check, and call done(). > num = self.num_steps() > if next_step == num: > -final_form_list = [self.get_form(i, request.POST) > for i in range(num)] > +prior_form_list = [self.get_form(i, request.POST) > for i in range(num - 1)] > > # Validate all the forms. If any of them fail > validation, that > # must mean the validator relied on some other > input, such as > # an external Web site. > -for i, f in enumerate(final_form_list): > +for i, f in enumerate(prior_form_list): > if not f.is_valid(): > return > self.render_revalidation_failure(request, i, f) > -return self.done(request, final_form_list) > +return self.done(request, prior_form_list+[form]) > > # Otherwise, move along to the next step. > else: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: How To Change App Label in Admin Pages
Hi, On 09.04.2009, at 10:15, johan.uhIe wrote: > > I'd also liked to know ... > > On 8 Apr., 13:36, Burcu Hamamcıoğlu wrote: >> I have a question about Internationalization; is there anyway to >> change the >> name of app name in admin pages. But I dont't want to override >> admin html >> pages. Can i add a new name to appp like verbose name in models? This might help: http://code.djangoproject.com/ticket/10436 adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Positive integer form field with max lenght
On 09.04.2009, at 09:27, emonk wrote: > Hi people. > This is my doubt > > I need make a form field with this restrictions: > > _field content must be only integers numbers and postive. > _filed content must have a max lenght, for example 8 characters. > > I am confused beacuse models.PositiveIntegerField has no have > max_length atribute (have a max_value), but models.CharacterField > have max_lenght atribute. > > Any idea? :S An integer doesn't usually have a max length, if at all it has a max value. Which in your case sounds like 99.999.999. To actually achieve what you want read through the form validation docs http://docs.djangoproject.com/en/dev/ref/forms/validation/ adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Does anyone know how to prepopulate a form with model data
On 09.04.2009, at 08:18, Briel wrote: > > Hi. > It seems like your error and your problem is not the same. The error > is complaining about the get_object_or_404, not the profile thing. So > changing that code won't actually do anything as it doesn't get that > far. > Well, maybe not. I had the same error yesterday. If you pass a model instance as the value dict, then you get the exceptions he mentioned. > ~Jakob > > On Apr 9, 3:55 am, codecowboy wrote: >> I want to create a form that allows a user to edit his/her >> profile. I >> don't want to bind my form to a model because the form will involve >> two different models. Does anyone have any ideas. I've read chapter >> 7 in the Django Book but it only to a simple example that does not >> help me. >> >> Here is what I have tried. >> >> s = get_object_or_404(Scientist, pk=7) >> form = ScientistProfileForm(initial=s) >> have you tried making a dict with the keys being the fieldnames and the dict values should then be prepopulated in the fields. adi >> I've also tried. >> >> form = ScientistProfileForm(s) >> >> I always get the following error message. >> >> Caught an exception while rendering: 'Scientist' object has no >> attribute 'get' >> >> Thanks in advance for any help. If I figure this out then I will >> post >> my solution in here in great detail for anyone else that needs it. > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Pre-filling form data without submission?
On 08.04.2009, at 17:10, Facundo Casco wrote: > > On Tue, Jan 20, 2009 at 11:17 AM, shogunm...@googlemail.com > wrote: >> >> Thanks guys, I'm gonna give this a try! >> >> Mike. > Hi, I'm having the exact same problem you had and I can't find a nice > way around it. > I want the name of the currently logged in user to be pre-selected in > a combo box in the form. > > The form is used to create a new object in the database. What I've > found as the main problem is that when I display the form for the > first time, if it's bound it throws validation errors (because I don't > want to pre-populate all the required fields) and if it is not bound > it just doesn't display the pre-populated data. > > My workaround at the time is to pass a flag to the template so it > doesn't show the errors but I still don't think that is the best way > to do it. > > Any help would be appreciated. > If you create tHe Form ala form = Form( initial={'user': request.user}) it should prepopulate the field and not throw validation errors. if on the other hand you create the form like: form = Form({'user': request.user}) you bind the form and it validates on output. adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: request.user Null value in foreign key save[Repost]
Hi, On 08.04.2009, at 16:43, ramya wrote: > > class Property(models.Model): > property_id = models.AutoField(primary_key = True) > property_name = models.CharField("Name", max_length = 30) > user = models.ForeignKey(User) > > class PropertyForm(ModelForm): > class Meta: >model = Property >exclude = ('user') > > def addProperty(request): > formContent = PropertyForm(request.POST) > formContent.save(commit = False) > formContent.user = request.user AFAIK, you can't assign values to a form field you properties. > formContent.save() > try. # create the new Property model instance, but don't save it to the DB. new_property = formContent.save(commit=False) # assign the user. new_property.user = request.user #save the model instance to the DB. new_property.save() adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: OperationError: fe_sendauth: no password supplied
Hi, a full traceback would be helpful. did you supply a password for your database in the settings.py? adi On 08.04.2009, at 15:12, LeeRisq wrote: > > I've been following along with the Djangobook. When I try to configure > the postgresql db, I get that error. I've tried tracing the problem > myself and have been unsuccessful. > > From Chapter 5: > from django.db import connection cursor = connection.cursor() > > Then I get the error. 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-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Determining server identity from views.py?
Hi, On 31.03.2009, at 21:54, Ross wrote: > > Thanks for your reply, and you anticipated my follow up question. A > brief look found how to read an enviro var from python: > > os.environ['USER'] give me $USER from the OS it appears (haven't > tried it yet). > > BUT, I also took a close look at the request.META data, wondering if > there isn't something in there. Sure enough, I found the strangely > named META variable "_" (underscore) which exists when the request is > handled by the dev server, whose value is "manage.py" > > When the same thing is requested through mod_python + apache2, I see > that META['_'] doesn't exist. So I could test for the existence of > underscore in the meta tags I guess. But perhaps using an enviro > variable is a more elegant approach. > > Thx for the info... > Do you really need to determine between devserver and mod_python or do you actually want to determine between dev and production server? If it's just dev and production server why not use settings.DEBUG? adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django and IIS 7
Hi, On 26.03.2009, at 14:21, Sergey Petrov wrote: > > I've blown my brains away, trying to make django work under IIS7 on > Windows Server 2008. > > I've tried PyISAPIe. I've tried fastcgi module. > > I'm no guru of windows, not even a expirienced user, though. > > Google tells nothing about django on IIS7. > > So, I'm begging you — please, anyone, give me a hint (better — step by > step howto) — how to make it work. > > Performance is not in question — anything that works will do. > > Thanks a lot. > I have no idea about IIS, but a quick google for django on iis7 turned up this: http://ironpython-urls.blogspot.com/2008/11/wsgi-on-net-and-in-cloud.html adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django form: Allow user to insert a date in dd-mm-yyyy format and then convert in yyyy-mm-dd
On 18.03.2009, at 20:48, MarcoS wrote: > > Thanks for your replies, Koeb and Ady. > > Ady, if I understood I've to place the code from > > http://code.djangoproject.com/attachment/ticket/3672/ticket%233672--patch-test.diff > > to > > - python/site-packages/django/forms/forms.py and > - python/site-packages/django/forms/widgets.py > Yes, basically. > and then I call the form with the follow field: > > date = forms.DateField(widget=DateTextInput(format='d/m/y'), > input_formats=['%d/%m/%y']) > > It's correct? > In the diff file there are some regression tests which show you how to use the Fields. adi > On 18 Mar, 13:45, Adi Sieker wrote: >> Hi, >> >> On 18.03.2009, at 13:01, MarcoS wrote: >> >> >> >>> Hi Adi, thanks for your reply! >> >>> I had just tried the DateField.input_formats, but the problem was >>> that >>> I'm using the date admin widgets. >>> If I specify input_formats like: '%d.%m.%y', I can't use the admin >>> widgets 'cause it insert the date in the format: '%Y-%m-%d' (how you >>> can see in django/contrib/admin/media/js/admin/DateTimeShortcuts.js >>> line 239)... >> >> The Problem with the Admin is that the DateField doesn't respect any >> output formats. >> Check this ticket for a possible >> solution:http://code.djangoproject.com/ticket/3672 >> >> adi >> >> -- >> Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 >> Freelance developer skype: adijsieker >> SAP-Consultantweb:http://www.sieker.info/profile >>openbc:https://www.openbc.com/hp/ >> AdiJoerg_Sieker/ > -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: yet another unicode question...
Hi, On 19.03.2009, at 11:02, Juan Hernandez wrote: > Hi there, > > This has been killing me for hours and I don't know what else to do. > Is about the famous charset in django. > > I have this model: > > class Post(models.Model): > user = models.ForeignKey(User) > category = models.ForeignKey(Categories) > title = models.CharField(max_length=50) > post = models.CharField(max_length=1) > date = models.DateTimeField(auto_now_add=True) > > def __unicode__(self): > return u%s %s %s %s %s(self.user, self.category, self.title, > self.post, self.date) > > with this information on the database: > > mysql> select * from blog_post; > ++-+-+-- > + > > + > -+ > | id | user_id | category_id | title| > post > | > date| > ++-+-+-- > + > + > -+ > | 8 | 1 | 2 | html Aqui | asdfasd > sdfsdfsd | 2009-03-18 01:27:49 | > ++-+-+-- > + > > + > -+ > 8 rows in set (0.00 sec) > > and the post column is being rendered on django html like this: > > asdfasd sdfsdfsd > > What is going on? I have changed the CHARACTER_SET in settings.py > and followed many things on different threats with no success at all > > Everything on the DB is utf8 and I also have DEFAULT_CHARSET = > 'utf8' at settings.py > > How can I have django display html code from the databse without any > problems? Read this http://docs.djangoproject.com/en/dev/releases/1.0/#automatic-escaping-of-template-variables and see if it helps you along. adi > > Thanks a lot > Juan > > > > -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Using
Hi, On 18.03.2009, at 15:47, NoviceSortOf wrote: > > We have a web form where the enduser clicks on a link and > is moved to different parts of the page. > > With the previous 3 generations of the site, we simply did something > like the following . > > ...in html to mark the spot > > > ...in html to jump to the spot. > < href="/mypage#top_of_page"> > I'd guess that the href doesn't match the current url, so the browser think it has to load the page in the href before being able to jump to the anchor. This doesn't really have much todo with django. adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: DateField with Django
Hi, On 18.03.2009, at 11:51, Wim Feijen wrote: > > Hello people, > > It has been over a month do I'd like to raise the same question again, > with all due respect. > > Does anybody know how to control a form's output format of a stored > DateField? Unfortunately, different countries use different customs to > represent dates and I'd like to represent the date in another > international format (%d-%m-%Y). Any help would be very much > appreciated! > > A major thanks, Check this ticket: http://code.djangoproject.com/ticket/3672 adi -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django form: Allow user to insert a date in dd-mm-yyyy format and then convert in yyyy-mm-dd
Hi, On 18.03.2009, at 13:01, MarcoS wrote: > > Hi Adi, thanks for your reply! > > I had just tried the DateField.input_formats, but the problem was that > I'm using the date admin widgets. > If I specify input_formats like: '%d.%m.%y', I can't use the admin > widgets 'cause it insert the date in the format: '%Y-%m-%d' (how you > can see in django/contrib/admin/media/js/admin/DateTimeShortcuts.js > line 239)... The Problem with the Admin is that the DateField doesn't respect any output formats. Check this ticket for a possible solution: http://code.djangoproject.com/ticket/3672 adi -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django form: Allow user to insert a date in dd-mm-yyyy format and then convert in yyyy-mm-dd
Hi, On 18.03.2009, at 11:43, MarcoS wrote: > > Hi all, > I'm implementing a form in django with a DateField field in forms.py. > My purpose is to allow a user to insert a date in european format (dd/ > mm/) and then, obviously, convert it in the /mm/dd format to > let's django check if it's a valid date and save it in a db. > > currently I've a javascript code that intercept the "submit command" > in the html form and converts the date in /mm/dd. > > My ask is: It's possible to implement the convertion, not in a > javascript function, but directly in views.py or forms.py before > cleaning the date? check the DateField form widget. It allows you to specify what format the date should be in. http://docs.djangoproject.com/en/dev/ref/forms/fields/#datefield adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django Pluggable application for invoicing / accounts?
Hi, there is also djime http://github.com/mikl/djime/tree/master though that leans more in the direction of hourly charges. adi On 06.03.2009, at 21:15, John Boxall wrote: > > Trolling through the board a bit here are some other postings on > similar topics: > > Suggesting looking at Satchmo > http://groups.google.com/group/django-users/browse_thread/thread/94ac6b1766a96208/e6b5f4189648bf53?lnk=gst&q=accounting#e6b5f4189648bf53 > > Suggesting Beancounter: > http://github.com/lincolnloop/django-beancounter/blob/736b627c337fdc2cab41f45375fd4eecbdd55526/beancounter/models.py > > Thanks, > > John > > On Mar 5, 4:36 pm, Malcolm Tredinnick > wrote: >> On Thu, 2009-03-05 at 16:23 -0800, John Boxall wrote: >>> Hey everyone, >> >>> I'm building a Django app that charges users monthly and one time >>> fees. I need to generate invoices and keep track of orders and I >>> most >>> definitely don't want to write this non-core code myself :) Someone >>> else must have done it (or something like it!) >> >>> I've tried searching in the usual places but haven't found anything >>> yet. >> >>> Has anyone seen any Django pluggable apps for maintaining billing >>> history for users? >> >> No idea about the collecting of raw data stuff. It's likely only a >> single model to record line items that you then summarise later >> when you >> actually generate the reports. So that might be easy enough to just >> knock up and even use the admin interface to populate. >> >> For the reporting side of things, you might want to look at Marinho >> Brandão's Geraldo project. I looked at an early version of it and it >> looked promising and sensibly designed (which sounds like damning >> with >> faint praise, but I just haven't had time or motivation to dig deeper >> into it. It's certainly on my list of apps to invest more time in). >> >> http://github.com/marinho/geraldo/tree/master >> >> Regards, >> Malcolm > -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Adding a slug
Hi, as far as I know loaddata doesn't use the ORM to insert the data. So things like signals and overloaded save methods don't work when using loaddata. adi On 24.01.2009, at 17:48, Kless wrote: > > > > On 24 ene, 15:51, Daniel Roseman > wrote: >> Are you saying that the slug is not being created when you reload >> your >> previously dumped data via ./manage.py loaddata? This is expected >> behaviour. > Yes, that's it. > > The slug is succesfully created when a new objects is added but it > doesn't works since ./manage.py loaddata > -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Flatpages
Hi, check this out. http://code.djangoproject.com/ticket/6932 adi On 21.01.2009, at 16:53, Gordon wrote: > > Hi > I've just started to use Django and have been using the flatpages > plugin for serving static pages. Does anyone know how or a plugin that > will generate a content's tree from the URLs? > e.g. > /staff/ > /staff/management/ > /staff/clerical/ > /staff/technical/ > /projects/ > /projects/ace/ > /projects/django/ > /projects/ruby/ > > what I'm looking for is someway of automatically traversing the URLS > for all the flatpages on my site so that I can generate a table of > contents relative to where I am on the site. > > Regards > Gordon > > -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem saving a User object to a profile
Hi, On 19.12.2008, at 21:15, DragonSlayre wrote: > > I've got a profile model which has a django.contrib.auth.models.User > as a foreign key. > > I am trying to assign the User object to my profile model after I've > checked that the user is valid and that the profile contents are also > valid. > > Once I've saved my user object, I then call > > profile_form.user = user; > profile_form.save() > I assume that you are using ModelForm to create your form. If so, check the documentation [1] and you'll know that the save method returns the model instance. So you should be able todo: profile = profile_form.save() profile.user = user profile.save() that'll cause 2 database hits, but should work fine. adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: range-like template tag?
Hi, On 08.12.2008, at 17:30, Berco Beute wrote: > > The 'someInt' is an attribute of an object I pass to the template. It > varies with each object. I could of course make a dictionary with the > object and a list of the integers but it would be handy to solve it in > the template (although you may argue that such functionality should > stay out of the view) Couldn't you add a method get_range() (or whatever name makes sense in your context) to the class the object is an instqnce of. The method would look something like this: def get_range(self): return range(self.someInt) in your template you could then do: {% for i in object.get_range %} adi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Two different django version on the same server?
Hi, On 07.12.2008, at 16:56, Pablo Ruiz Múzquiz wrote: > Hi all, > > I'm afraid I googled and googled with no success. Django official docs > or my django book weren't of any help either. > > I've got a "legacy" django project which was developed using 0.97svn a > year ago and a brand new SVN one, sharing the same server. > > Django 097 lives at /srv/whatever/django097/django while Django SVN at > the usual site-packages location. > > No matter what I do with Apache's PythonPath, the virtualhost > referring > to the old project will load the SVN version and, thus, /admin and > some > template handling will fail to load. > > Any clues? Thanks in advance, > I'm doing that on one of my domains with mod_python and it's working just fine. Here is my relevant apache config. ServerName vhost1 SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE project.settings PythonPath "['', \ '', \ ''] + sys.path" in this VirtualHost points to a pre newforms admin version of django and then a duplicate of this VirtualHost where the points to a trunk version of django. The _really_ important part is that sys.path comes after the version you want to use for this host. Since sys.path will include your site.packages it'll find the trunk version first. adi -- Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 Freelance developer skype: adijsieker SAP-Consultantweb:http://www.sieker.info/profile openbc: https://www.openbc.com/hp/ AdiJoerg_Sieker/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---