Re: nfa - how to access the standard admin views from a custom view?

2008-07-06 Thread Jan Rademaker
I think i've got it. Instead of putting this logic in a custom view I should just override the change_view method of my custom ModelAdmin. On Jul 6, 1:46 pm, Jan Rademaker <[EMAIL PROTECTED]> wrote: > Hello, > > I'm in the process of converting an app to nfa. In this app

nfa - how to access the standard admin views from a custom view?

2008-07-06 Thread Jan Rademaker
Hello, I'm in the process of converting an app to nfa. In this app some models have their own change view. Some of these views fall-back to using the standard amin view based on some condition; like this: from django.contrib.admin.views.main import change_stage def my_view(request, model_id):

Re: /admin Cross-Site Scripting (XSS) issue!

2008-05-07 Thread Jan Rademaker
It does work, make sure you're not logged in. $ lynx -source -dump http://localhost:8000/admin/%22%3E%3Cscript%3Ealert%283939%29%3C/script%3E/ | grep alert alert(3939)/" method="post" id="login-form"> On May 7, 9:10 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Wed, May 7, 2008 at 1:45 P

Re: Import connection error

2007-12-21 Thread Jan Rademaker
On Dec 21, 5:46 pm, newDjangoer <[EMAIL PROTECTED]> wrote: > I am experiencing an error when I try to run the following: > > >>> from django.db import connection > > Traceback (most recent call last): >   File "", line 1, in >   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ > pyt

Re: PYSQLITE

2007-12-20 Thread Jan Rademaker
newDjangoer wrote: > I am installing pysqlite 2.4.0. I have python 2.3.5 installed and > sqlite 3.1.3. When I run the python setup.py build I get this : > > skcompxp:~/Desktop/pysqlite-2.4.0 sptxk$ python setup.py build > running build > running build_py > running build_ext > building 'pysqlite2

Re: Any SELECT returns no results via Django

2007-12-20 Thread Jan Rademaker
On Dec 20, 1:41 am, Gloria W <[EMAIL PROTECTED]> wrote: > I am boggled. A SELECT from the MySql command line works just fine. > But within Django, it returns nothing. It doesn't matter what SQL > statement I issue. > > Here is my syntax: > > from django.db import connection > cursor = connect

Re: Any SELECT returns no results via Django

2007-12-20 Thread Jan Rademaker
On Dec 20, 1:41 am, Gloria W <[EMAIL PROTECTED]> wrote: > I am boggled. A SELECT from the MySql command line works just fine. > But within Django, it returns nothing. It doesn't matter what SQL > statement I issue. > > Here is my syntax: > > from django.db import connection > cursor = connect

Re: Models with multiple foreignkeys ( adding values )

2007-12-19 Thread Jan Rademaker
On Dec 19, 8:57 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello Ben, > > I'm not really sure what you mean by leave the _id out. > What i did with the sponsor_id and method_id was getting the correct > objects from the Method and Sponsor class > He means there is no reason the append

Re: Outputting MS word-friendly format

2007-12-19 Thread Jan Rademaker
On Dec 19, 6:52 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Thanks.. that's close, but I can't seem to get it to work properly > from within Django; > > They give an example like this: > def MakeExample1() : > doc = Document() > ss = doc.StyleSheet > sec

Re: DateField and output/input versus SelectDateWidget

2007-12-19 Thread Jan Rademaker
On Dec 19, 3:16 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > hello everyone, > > A) > if you render a DateField it renders as: /MM/DD and then you have to > tell the user he should use the input_format ( which is MM/DD/ by > default) which is kind of duh! :) I wrote some

Re: completely escaping an included template

2007-12-18 Thread Jan Rademaker
On Dec 18, 8:12 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > Hello everyone, > > trying to upgrade to the latest trunk, I'm wrestling a bit with the > autoescape function. Talking about embed-code for an enduser, I used to > write: > > {% include embedded_player.html %} > Copy-paste t

Re: Weird problem with request.POST, correct data not coming out from request.POST

2007-12-18 Thread Jan Rademaker
On Dec 18, 7:14 pm, shabda <[EMAIL PROTECTED]> wrote: > I am trying to get a value from request.POST. After form submit, > request.POST contains the values of the ids from the checkbox > selected. I want the list of those ids. SO I am doing something like, > entry_ids = request.POST['delete'] ,

Re: get_absolute_url not working as expected

2007-12-17 Thread Jan Rademaker
> If that does not get you any further, could you paste your complete > model on dpaste.com? Never mind dpaste, just post to this group. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post t

Re: get_absolute_url not working as expected

2007-12-17 Thread Jan Rademaker
dented right, e.g. did you mix spaces and tabs? Did you try to raise an exception in the method? A simple `assert False` before `return self.id` should do. If that does not get you any further, could you paste your complete model on dpaste.com? Regards, Jan Rademaker --~--~-~--~~---

Re: Negation in queries

2007-12-13 Thread Jan Rademaker
On Dec 13, 5:18 pm, Kent Johnson <[EMAIL PROTECTED]> wrote: > Is there a way to express != in a database query? > > or mayby >filter(s1=1, !Q(s2=1)) > but I don't see any way to do this in the docs. Hopefully I am just > overlooking something! There is an undocumented class called QNot w

Re: Run time lookups

2006-03-01 Thread Jan Rademaker
aaloy wrote: > I'm trying to make a dynamic lookup filter depending on the parameters > that the user inputs on a web search. > > That is, I have three optional search fields and I wan't to be able to > make a lookup search on my database withot having to code all the > search options. Something l

Re: 1st page

2006-02-26 Thread Jan Rademaker
No need for Apache, you can put this in your urlpatterns: ('^$', 'django.views.generic.simple.redirect_to', {'url' : '/home/'}), -janr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: generic views - object_detail and info_dict

2006-02-21 Thread Jan Rademaker
Glenn, The 'archive_day' you see in urlpatterns is the name of the view, eg. django.views.generic.date_based.archive_day and not some string that's appended to the module's name. The default template names for date based views happen to be the same as the name of the corresponding view. The defa

Re: Making Django Development server available to local network.

2006-02-05 Thread Jan Rademaker
Panos Laganakos wrote: > Hello, > > I am using a local server for all web development stuff. So I set up > django on it and started the tutorial. > > Thing is, that when I try '$ python manage runserver 10.0.0.3:8000' to > start the server, it won't make it available to the network. You could tr

Re: Using gettext_lazy in __repr__

2006-02-03 Thread Jan Rademaker
hugo wrote: > >Are you sure? Because now it throws a NameError exception. > >global name 'gettext_lazy' is not defined > > Yes, I am sure. I wrote that stuff ;-) > I'm convinced. > >>> from django.utils.translation import gettext_lazy, activate > >>> activate('de-de') > >>> print gettext_lazy('Us

Re: Using gettext_lazy in __repr__

2006-02-02 Thread Jan Rademaker
Are you sure? Because now it throws a NameError exception. global name 'gettext_lazy' is not defined I must say I'm rather new to Python and haven't got the faintest idea where to look when I get exceptions like this thrown at me. This is what I import at the top of my model: from django.core

ManyToMany: get_FOO_count() and get_FOO()

2006-02-02 Thread Jan Rademaker
The documentation states: "It doesn't matter which model gets the ManyToManyField, but you only need it in one of the models -- not in both." See this example: http://www.djangoproject.com/documentation/models/many_to_many/ So how come the article objects in this example don't have a get_publica

Using gettext_lazy in __repr__

2006-02-02 Thread Jan Rademaker
Is it possible to use gettext_lazy in a model's __repr__ while using the objects from a python shell (started with 'manage.py shell')? When I try to do so I get the following error: Traceback (most recent call last): File "", line 1, in ? File "/var/home/j.rademaker/django/myproject/../mypro

Re: What is save to use in __repr__

2006-01-30 Thread Jan Rademaker
A bit of code would have clarified my problem. This is what I tried the first time: return "Testing %s %s %.2f" % (self.someForeignKey.someThing(), self.somedate.strftime("%d-%m-%Y"), self.someFloat) There were 2 problems, basically. First, I tried to access an object instance directly and not t

What is save to use in __repr__

2006-01-30 Thread Jan Rademaker
What is save to use __repr__ ? I've found out that I shoud use self.get_someForeignKey().someThing() instead of self.someForeignKey.someThing(), but what about date fields and such? Because, when I use self.someDateField in __repr__ django crashes the moment _add_ a new object (using admin). Th

Lookup by week

2006-01-30 Thread Jan Rademaker
Hello, As far is I know it's not possible to query date fields for a cerain week number, eg. # Select all polls from week 5, 2006 polls.get_list( pub_date__year=2006, pub_date__week=5 ) Would it make sense to implement such a thing? An alternative would be to figure out at what date a w