Re: How to pass values between views/templates

2009-10-02 Thread Shawn Milochik
Remember that people often represent their best work, and I bet they only answer the questions they're most confident about their experience with. If you care that much about your code, you'll be fine -- once you have your 10,000 hours* in as a coder, people will be in awe of your code

Re: How to pass values between views/templates

2009-10-02 Thread adelaide_mike
My only dissatisfaction is that other contributors to this list seem to do almost anything with very few lines of code, whereas I am using many. And, being a newbie I naturally worry that I am on the wrong pathway, having missed the turning. Thanks to both for your reassurance. Mike On Oct 3,

Re: Extending Django's Flatpages

2009-10-02 Thread Shawn Milochik
If you're trying to add template tags, check this out: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ Your custom tags go in a directory named "templatetags" in your app directory. Shawn --~--~-~--~~~---~--~~ You received this message

Re: How to pass values between views/templates

2009-10-02 Thread Shawn Milochik
Your current approach makes sense. If you're concerned that you're storing too much data in the session, you could just maintain a session ID in the session and use that as a key for an sqlite3 database or something, or even a model in your app's database, if that makes sense. Is there

Re: How to pass values between views/templates

2009-10-02 Thread djfis...@gmail.com
Mike, I think you're doing it right. Unless you want that data to be in the URL (perhaps) or sent page to page in post data (probably a bad idea) sessions are your best option. -David On Oct 2, 6:16 pm, adelaide_mike wrote: > Hi > In my app the user needs to drill

Session cache backend or cache API failure

2009-10-02 Thread Calvin Spealman
I've spent all day diagnosing this with no success. I would get random errors in logs with the traceback below, showing a failure to create a new session. Memcache logs show all 1 tries succeeding (I have also confirmed the empty sessions are still held in cache after). From what I can see,

Re: Populating an ImageField

2009-10-02 Thread akonsu
did you try company.logo = relative_path ? On Oct 2, 4:45 pm, Nan wrote: > OK, this seemed to work: > > def create_a_company(name, logo_path): >     company = Company() >     company.name = name >     relative_path = path_relative_to_media_root(logo_path) >    

How to pass values between views/templates

2009-10-02 Thread adelaide_mike
Hi In my app the user needs to drill down through a series of templates and their views to identify a house. We start with the city, then the street and finally the house, in each case chosen from a rendering of the possible values selected from the relevant database table. I have all this

Re: Radar

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 6:40 PM, Matt wrote: > > Also, I meant if view a parent template, it looks for child templates > around it that extend it. I think my question above is the other way > around > > I don't know what you are trying to ask. You don't view templates in

Sites module, URLs and templates

2009-10-02 Thread Joseph Wakeling
Hello all, I'm making some first steps with Django having worked my way through the tutorial. I'm finding myself somewhat confused by the sites module. I would like to run two or three different sites. It's trivial to 'create' them using the admin interface, and it's clear how different

Django comments

2009-10-02 Thread cirip
Hi, I am just reading about django comments framework that I planned to use. As I learned so far you have to have object to which comments belong in the database as well. Let's say I just want to have comments related to some paragraph on my page without having to create record for each

Re: Django running on Apache+WSGI and apache SSL proxy

2009-10-02 Thread Graham Dumpleton
On Oct 2, 10:39 pm, Fabrizio wrote: > Hi all, > > I'm trying to rewrite all requests for my Django server running on > apache+WSGI ( inside my local network) and configured as the WSGI's > wiki how to, except that I set a virtualhost for it. > > The server which from I

Re: Radar

2009-10-02 Thread Matt
Also, I meant if view a parent template, it looks for child templates around it that extend it. I think my question above is the other way around On Oct 2, 6:33 pm, Matt wrote: > then do you view the child template in a browser, and it looks for the > parent template,

Re: Radar

2009-10-02 Thread Matt
then do you view the child template in a browser, and it looks for the parent template, then outputs the all the code? On Oct 2, 1:42 pm, Karen Tracey wrote: > On Fri, Oct 2, 2009 at 7:00 AM, Matt wrote: > > > Does Django have a "radar", like it

Re: Naming and scoping guidelines to make apps that are actually 'pluggable'?

2009-10-02 Thread Bill Freeman
On Sun, Sep 20, 2009 at 6:46 PM, Hostile Fork wrote: > > Hello all, > > Page one of the tutorial features a large picture of a lightbulb, next > to a statement of Philosophy: > >     "Django apps are 'pluggable': You can use an app in multiple > projects, and you can

Extending Django's Flatpages

2009-10-02 Thread When ideas fail
Hello, i've been having a look at this post on overmortal about Extending Django's Flatpages: http://www.overmortal.com/blog/post/17-extending-django-s-flatpages specifically this section " Finally, in order to continue using the flatpages/default.html template file as the singular file for

Re: Populating an ImageField

2009-10-02 Thread Nan
OK, this seemed to work: def create_a_company(name, logo_path): company = Company() company.name = name relative_path = path_relative_to_media_root(logo_path) company.logo.name = relative_path company.save() Thank you! On Oct 2, 4:32 pm, Nan wrote: >

Re: Populating an ImageField

2009-10-02 Thread Nan
I tried this, but it's just throwing an AttributeError ("can't set sttribute"): def create_a_company(name, logo_path): company = Company() company.name = name logo_url = image_url_from_path(logo_path) company.logo.url = logo_url company.save() On Oct 2, 4:15 pm, akonsu

Re: Populating an ImageField

2009-10-02 Thread akonsu
hello, try setting the logo.url property. i do it with FileFields all the time and it works. konstantin On Oct 2, 4:12 pm, ringemup wrote: > Say I have an image file on disk and a model that uses an ImageField. > If I want to create a model instance with that image file in

Populating an ImageField

2009-10-02 Thread ringemup
Say I have an image file on disk and a model that uses an ImageField. If I want to create a model instance with that image file in the image field without explicitly running through a form and a POST operation, how could that be done? Example of what I'm trying to accomplish: class

Generating a single form with OneToOneField

2009-10-02 Thread Tiago Samahá
Hello All, i'm trying generate a single form with two models. class Contact(models.Model): phone = models.CharField(max_length=8) email = models.CharField(max_length=50) class Client(models.Model): name = models.CharField(max_length=50) type = models.CharField(max_length=10)

Re: Model.objects.values('some_column').distinct() returns the wrong results

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 11:49 AM, Jumpfroggy wrote: > > I have a model with a field, and I wanted to pull all the unique > values of that field. So I do this: > >distinct_values = Model.objects.values('some_column').distinct() >print 'distinct_values.count()',

Re: More Reverse Method Woes

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 11:01 AM, Streamweaver wrote: > > I'm continuing to struggle with the reverse method in Django. After > fixing some mistakes of mine earlier I'm getting an > ImproperlyConfigured Error whenever I try to use a reverse method. > The site works fine

filter magic to support i18n models

2009-10-02 Thread k88
Given the following models class Product(models.Model): price = models.IntegerField() class Product1I18n(models.Model) parent = models.ForeignKey(Product) language = models.CharField(max_length=2) title = models.CharField(max_length=255) description = models.TextField() is it

Re: name of the database column for a field?

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 8:18 AM, akonsu wrote: > > hello, > > i have found an (undocumented?) way to get the db table name from a > model: Model._meta..db_table. > > is there a way to get the name of the db column for a field? > > Model._meta.get_field_by_name('')[0].column

Re: Radar

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 7:00 AM, Matt wrote: > > Does Django have a "radar", like it searches for child templates that > extends the parent template? > No. Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: doctest and sqllite

2009-10-02 Thread Karen Tracey
On Fri, Oct 2, 2009 at 3:18 AM, gentlestone wrote: > > Hello Karen, > > another issue. If I'm using unicode characters in model's doctest: > >u""" >>>> osoba = Osoba(meno = u"Ľudmila", priezvisko = u"Šafářová") >>>> osoba.save() >>>> subjekt =

Re: unicode and manage.py test

2009-10-02 Thread Karen Tracey
On Thu, Oct 1, 2009 at 8:11 AM, gentlestone wrote: > > [snip] > My question is. Can anybody explain, what does it mean? How should I > rewrite my doctests in above way? How this piece of code should be? > > def slugify(name): >u""" >>>> slugify(u'Žabovitá zmiešaná

Re: Returning a file from a view

2009-10-02 Thread Javier Guerra
On Fri, Oct 2, 2009 at 7:51 AM, Marcelo Criscuolo (Jaú) wrote: > I'm thinking of something like this in the view: > > response = HttpResponse(mimetype="") > input = read contents of your hidden file > response.write(input) > return response and once it's working, replace

DatabaseOperations() problem (was: portable date_trunc?)

2009-10-02 Thread akonsu
i guess i can use this: def field_sql(table, field) : return '%s.%s' % (connection.ops.quote_name(table), connection.ops.quote_name(field)) select_sql = connection.ops.date_trunc_sql('year', field_sql (MyModel._meta.db_table, 'date')) MyModel.objects.extra(select = {'year' : select_sql}).values

Model.objects.values('some_column').distinct() returns the wrong results

2009-10-02 Thread Jumpfroggy
I have a model with a field, and I wanted to pull all the unique values of that field. So I do this: distinct_values = Model.objects.values('some_column').distinct() print 'distinct_values.count()', distinct_values.count() print 'len(distinct_values)', len(distinct_values) Which

Goflow

2009-10-02 Thread Todd Blanchard
Hi, I have a workflow type app I need to do and was looking at django with goflow. I'm a total django noob - mostly I've done rails, php, web objects, j2ee, and some other stuff. I can't seem to get the demos working and the goflow mailing list is silent. Is that project abandoned?

Problems with custom Auth Backends: 'NoneType' object has no attribute 'DoesNotExist'

2009-10-02 Thread Sandra Django
Hi, I want add a new attribute in User model and create custom backends. Steep by steep, I did the following: 1) I created an application named "profile" into my project 2) I created, in models.py of "profile" a class named "UserProfile", which inherits from User class of Django. I added

More Reverse Method Woes

2009-10-02 Thread Streamweaver
I'm continuing to struggle with the reverse method in Django. After fixing some mistakes of mine earlier I'm getting an ImproperlyConfigured Error whenever I try to use a reverse method. The site works fine with one but whenever I try to use a reverse method, even in shell I get the following

Re: UML and OCL

2009-10-02 Thread Geobase Isoscale
Thanks Maggie for your quick, response you keep me going. I hope to find one these tools that translate UML into Models. Thanks very much. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: UML and OCL

2009-10-02 Thread Russell Keith-Magee
On Fri, Oct 2, 2009 at 9:28 PM, Geobase Isoscale wrote: > Hi Everyone, > Is it possible to use UML and OCL or others like WebML  modelling tools with > Django. Because I find the conceptual design , logical design  and physical > design  tend to be more comphrensive rather

Re: How do I require login before accessing FormWizard forms?

2009-10-02 Thread Anıl KARADAĞ
hi, kmike yazmış: > My solution was > or > urlpatterns += patterns('', > url(r'^my_wizard/$', login_required(MyWizard().__call__), > name='my_wizard'), > ) > you add user control to call method for example # request user authenticate control if request.user.is_authenticated():

Re: How do I require login before accessing FormWizard forms?

2009-10-02 Thread kmike
My solution was urlpatterns += patterns('', url(r'^my_wizard/$', login_required(MyWizard().__call__), name='my_wizard'), ) On 2 окт, 18:11, JimR wrote: > After much searching, I found the answer that I was looking for - > using the login_required decorator directly in the

Re: Help debug strange errors

2009-10-02 Thread Gustavo Senise
I understand Fisher, But the app is loading the 500.html directly if I create it. I am receiving an error through email. Here it is: Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 86, in get_response response =

Re: Help debug strange errors

2009-10-02 Thread djfis...@gmail.com
The built-in Django development server handles 404s and 500s, but when you deploy onto mod_python or mod_wsgi, you need a 404.html and a 500.html. On Oct 2, 4:52 am, Gustavo Senise wrote: > Hey Mak, > > I understand that. The point is that locally the app is running

Mashup competition

2009-10-02 Thread Russell Keith-Magee
Hi all, Here's something that might be of interest to the Django crowd - especially those based in Australia (or people who know someone that lives in Australia). On Wednesday, Australia's Government 2.0 Taskforce announced a mashup competition. This competition is open to everyone, as long as

UML and OCL

2009-10-02 Thread Geobase Isoscale
Hi Everyone, Is it possible to use UML and OCL or others like WebML modelling tools with Django. Because I find the conceptual design , logical design and physical design tend to be more comphrensive rather than just using the models.py classes that can overlook relationships, integrity

Re: Confirmation dialog on deleting...

2009-10-02 Thread Tim Chase
> I search over the net, but I don't find how can do this. I > need to pop up a dialog with: "Are you sure to delete this?" > every time when I want to delete a row from a list, etc. Can > you tell me where I found an exemple or some documentation, or > how to pop up a dialog box in Django. The

Django running on Apache+WSGI and apache SSL proxy

2009-10-02 Thread Fabrizio
Hi all, I'm trying to rewrite all requests for my Django server running on apache+WSGI ( inside my local network) and configured as the WSGI's wiki how to, except that I set a virtualhost for it. The server which from I want to rewrite requests is another apache server listening on port 80. I

Re: IOError: request data read error on POST, anyone solved this?

2009-10-02 Thread Ole Laursen
On 9 Sep., 12:18, Graham Dumpleton wrote: > It is because from the server perspective the client connection was > dropped before the request body had been able to be completely read. > So, shouldn't be anything wrong with the application or the server. > Can be caused

Re: Confirmation dialog on deleting...

2009-10-02 Thread Jaú
I think you'll need some Javascript. Try jQuery: http://jqueryui.com/demos/dialog/#modal-confirmation. On Fri, Oct 2, 2009 at 3:23 AM, Nicu Marcu wrote: > Hello all, > >     I search over the net, but I don't find how can do this. I need to pop > up a dialog with:

Re: Returning a file from a view

2009-10-02 Thread Jaú
I'd try to use HttpResponse as a file object. As in http://docs.djangoproject.com/en/dev/howto/outputting-pdf/#write-your-view. I'm thinking of something like this in the view: response = HttpResponse(mimetype="") input = read contents of your hidden file response.write(input) return response

name of the database column for a field?

2009-10-02 Thread akonsu
hello, i have found an (undocumented?) way to get the db table name from a model: Model._meta..db_table. is there a way to get the name of the db column for a field? thanks konstantin --~--~-~--~~~---~--~~ You received this message because you are subscribed to

portable date_trunc?

2009-10-02 Thread akonsu
hello, this works with sqlite: AppModel.objects.extra(select={'year':"django_date_trunc('year', \"date \")"}).values('year').order_by().annotate(total = Count('id')) i assume that for postgresql i would have to use date_trunc function. is there a portable way to do this? thanks konstantin

Re: How do I require login before accessing FormWizard forms?

2009-10-02 Thread JimR
After much searching, I found the answer that I was looking for - using the login_required decorator directly in the URLconf, then adding a subclass of __name__ to the FormWizard class. (r'^contact/$', login_required(ContactFormWizard([ContactFormPartOne, ContactFormPartTwo]))) but since it

Re: Help debug strange errors

2009-10-02 Thread Gustavo Senise
Hey Mak, I understand that. The point is that locally the app is running fine! So how can I understand whats wrong? 2009/10/2 Maksymus007 > > On Fri, Oct 2, 2009 at 1:46 PM, gustavo wrote: > > > > Hello fellows, > > > > I have been developing a

Re: Help debug strange errors

2009-10-02 Thread Maksymus007
On Fri, Oct 2, 2009 at 1:46 PM, gustavo wrote: > > Hello fellows, > > I have been developing a little blog app as described in > http://www.aprendendodjango.com, what means Learning Django. It this > very interesting. > > But I've got problems when I tryed to deploy. It

Help debug strange errors

2009-10-02 Thread gustavo
Hello fellows, I have been developing a little blog app as described in http://www.aprendendodjango.com, what means Learning Django. It this very interesting. But I've got problems when I tryed to deploy. It seems everything is ok, but the log server is telling me that it is searching for a

Re: unicode and manage.py test

2009-10-02 Thread gentlestone
I changed the _doctest.py line 2180 to: if failures: raise self.failureException(self.format_failure (new.getvalue()).encode('UTF-8')) Whitout this bug correction, the doctests with non ascii characters doesn't work. So your >It says, instead write u'blah blah', which you

Re: select_related() and Additional keywords

2009-10-02 Thread Maksymus007
On Fri, Oct 2, 2009 at 12:58 PM, Daniel Roseman wrote: > > On Oct 2, 11:45 am, Maksymus007 wrote: >> I used query in form >> >> a = X.objects.select_related('gate__keywords_set').filter(field=value) >> >> and then tried to get elements from related

Radar

2009-10-02 Thread Matt
Does Django have a "radar", like it searches for child templates that extends the parent template? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: select_related() and Additional keywords

2009-10-02 Thread Daniel Roseman
On Oct 2, 11:45 am, Maksymus007 wrote: > I used query in form > > a = X.objects.select_related('gate__keywords_set').filter(field=value) > > and then tried to get elements from related > a[x].gate.keywords_set - there is a RelatedManager object which forces > me to call

select_related() and Additional keywords

2009-10-02 Thread Maksymus007
I used query in form a = X.objects.select_related('gate__keywords_set').filter(field=value) and then tried to get elements from related a[x].gate.keywords_set - there is a RelatedManager object which forces me to call all() method to get elements. And problem is that this causes additional

Re: 'NoneType' object has no attribute 'widget'

2009-10-02 Thread dijxtra
On Oct 1, 2:54 pm, Karen Tracey wrote: > On Thu, Oct 1, 2009 at 5:33 AM, dijxtra wrote: > > Traceback: > > [snip] > > 234.             value = field.widget.value_from_datadict(self.data,> > self.files, self.add_prefix(name)) > > > Exception Value:

Re: unicode and manage.py test

2009-10-02 Thread nausikaa
Hi I think you're already have it right. It means do not write "print ..some stuff.." in your docstring. It says, instead write u'blah blah', which you are doing already. My question is: Isn't it expected that the doctest fails if you change a letter because then the output will disagree with

Re: doctest and sqllite

2009-10-02 Thread gentlestone
I pulled out non ascii characters, but anyway, how strange it is: >>> Osoba.objects.all() [] >>> Subjekt.objects.all() [] >>> gama = Subjekt(nazov = u"Gama s.r.o", osoba = Osoba(meno = "Ivan", priezvisko = "Zajac")) >>> gama.save() Traceback (most recent call last):

Message Box with yes and no option ( confirm a deleting operation )

2009-10-02 Thread Nicu Marcu
Hello, There is something similar in django and Python with msgbox? I need to have a confirmation before doing a deletion. -- All the best, Nicolae MARCU --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: doctest and sqllite

2009-10-02 Thread gentlestone
Hello Karen, another issue. If I'm using unicode characters in model's doctest: u""" >>> osoba = Osoba(meno = u"Ľudmila", priezvisko = u"Šafářová") >>> osoba.save() >>> subjekt = Subjekt(nazov = u"Žaba s.r.o.", osoba = osoba) >>> subjekt.save() >>> subjekt =

Re: Django 1.1, cx_oracle 5.0.2, Oracle 9i, NCLOB Textfield

2009-10-02 Thread Ian Kelly
On Oct 1, 6:26 pm, alphacc wrote: > I installed 9i at home and did some more test. > With the same application  running (and updating the same field) I > discovered that the limit is not the same for my database. > It is now 1246 Characters. > I started a new application (a

Confirmation dialog on deleting...

2009-10-02 Thread Nicu Marcu
Hello all, I search over the net, but I don't find how can do this. I need to pop up a dialog with: "Are you sure to delete this?" every time when I want to delete a row from a list, etc. Can you tell me where I found an exemple or some documentation, or how to pop up a dialog box in Django.