Re: Central Login with Redirecting users based on Groups

2010-11-25 Thread Knut Ivar Nesheim
Hi Stefan, If you roll your own login view, this can be done by simply redirecting to the correct url after authentication. You would have to come up with the correct url by looking at the groups. Consider something like this: def login_view(request): # login and authenticate.. user =

Re: get_object_or_404

2010-11-14 Thread Knut Ivar Nesheim
try: obj = Model.objects.get(x = y) except Model.DoesNotExist: On Mon, Nov 15, 2010 at 6:23 AM, Akn wrote: > Hi, > I would like to use get_object to retrieve an object form the > database, but if the object does not exist I do not want to display an > error

Re: Exclude form field when calling form from view

2010-11-09 Thread Knut Ivar Nesheim
the variable, does it need to be > explicitly passed in the 3rd line above: form = UploadFileForm(), when > I want the title shown?  Or simply when grabbing the request.POST/ > FILES? > > Thank you for your help so far, > Ed > > On Nov 9, 3:33 am, Knut Ivar Nesh

Re: Using Django's auth for Trac too

2010-11-09 Thread Knut Ivar Nesheim
Hi, See the following link to the docs. This should be exactly what you want. http://docs.djangoproject.com/en/dev/howto/apache-auth/ Regards Knut On Tue, Nov 9, 2010 at 6:51 AM, Torsten Bronger wrote: > Hallöchen! > > I know that my question has a strong Apache

Re: Exclude form field when calling form from view

2010-11-09 Thread Knut Ivar Nesheim
rks perfectly, > but always shows the title.  But with that in the form class, it > always says "This field is required."  For just the imagefield if the > title is suppressed or for both the title and the imagefield if the > title is not suppressed. > > Suggestio

Re: Total in a django template

2010-11-08 Thread Knut Ivar Nesheim
You need to sum the fines before you enter the templates. This can be done either in your view like this: total_fines = sum([item.fine for item in items]) Or you can do it in the db using the 'Sum' aggregate, see http://docs.djangoproject.com/en/dev/ref/models/querysets/#sum Regards Knut

Re: Enclosing intervals with dates on django

2010-11-08 Thread Knut Ivar Nesheim
Your query can be translated into the ORM by simply using '__gt' and '__lt' on your start_date and ends_date. Regards Knut 2010/11/8 Rogério Carrasqueira : > Hello Everybody! > > I'm developing a routine that will control the information about scheduled > events

Re: Why INSERT instead of UPDATE?

2010-11-08 Thread Knut Ivar Nesheim
Look at the HTML for the form. The 'action' attribute tells the browser where to submit the post. The view responsible for that URL is the one you should be looking at. If you have a ModelForm with no instance, Django will insert a new row. If there is an instance and you call form.save(), it

Re: Exclude form field when calling form from view

2010-11-08 Thread Knut Ivar Nesheim
Maybe you could just use subclassing instead of doing stuff at run-time: class UploadForm(forms.Form): file = ... # custom upload and validation code here class ThumbnailUploadForm(UploadForm): pass class UploadFileForm(UploadForm): title = ... As for your current approach, it

Re: Custom formset validation: having a "save?" checkbox for each form

2010-11-08 Thread Knut Ivar Nesheim
Hi, Every Form subclass defines a method called 'is_valid()', even the FormSet has one, which will repeatedly call it on every form. After running is_valid(), form.cleaned_data will contain cleaned data from the forms. On subclasses of FormSet you can also override the clean method, which allows

Re: 2D map application: performance and design question

2010-11-02 Thread Knut Ivar Nesheim
I would suggest rewriting the loop in your template as a templatetag. Something like this @register.simple_tag def render_locations(locations): html = u""" html %(x)s stuff %(y)s here %(link)s """ return '\n'.join([html % { 'x': loc.x, 'y': loc.y', 'link': loc.link } for loc in

Re: Executing ssh scripts with django

2010-11-01 Thread Knut Ivar Nesheim
of systems like Chef is that the configurations is plain text, so you can use your normal development tools, like version control, peer review, etc. It becomes very easy to reason about the proposed change, when you have a diff at hand. Regards Knut > > Thanks! > marc. > > On Mon, Nov 1

Re: Django admin for call center support?

2010-11-01 Thread Knut Ivar Nesheim
I've used the django admin for the user interface to a warehouse management system. The system managed some million pairs of shoes. In my experience the admin is a bit different than what most people expect it to be. On the other hand, it took my users 10 minutes to get accustomed to the system.

Re: Executing ssh scripts with django

2010-11-01 Thread Knut Ivar Nesheim
Hi, I would strongly suggest looking into using Celery or some other form of message queue. In general you want to decouple the logic of the web app, such as validating domain names, writing to the database, with operations that has real-world important side effects. Once you split these, the

ValidationError: ManagementForm data is missing or has been tampered with

2010-02-05 Thread Knut Ivar Nesheim
Hello fellow Django users, >From time to time users of one of my applications has problems with formsets. More specifically: ...my stuff... File "/usr/lib/python2.4/site-packages/django/forms/models.py", line 399, in __init__ super(BaseModelFormSet, self).__init__(**defaults) File

Re: How to execute an external application from View

2007-07-09 Thread Knut Ivar Nesheim
t this: http:// developer.yahoo.com/yui/examples/container/panelwait/1.html Just call the view and then when your external application returns, the view returns the exit status and the popup closes. I use it to import data and generating thumbnails, etc. It works great. :-) -- Knut

Large forms with unknown number of fileds

2007-05-28 Thread Knut Ivar Nesheim
ic: orders = student.order_set.filter(product=product) and then returns the quantity from the first order object. Any help would be greatly appreciated! -- Knut Ivar Nesheim --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group