ModelForm witn ImageField, how to add file programmatically?

2009-04-15 Thread bashu
Hello, I have a form derived from ModelForm with ImageField inside. How to select file to upload for a generated FileInput field programmatically? Could this be done by passing file object as one of initial values, when I create a form object? ... from = Form(initial={'image.field.name' :

Need help first user of django..

2009-04-15 Thread Aaron
Hi, I am trying to learn how to use if statements. I need a form to appear on 2 pages. Also how does flatpages work? I was given by my workplace a zip file that contains the flatpages html pages. I used the admin to add flatpages and I added a template. I then have 4 pages. Currently these

Re: Unittests

2009-04-15 Thread Luc Saffre
On 16.04.2009 0:04, Daniel Joshua Worth wrote: > I'm trying to learn unit test and have a unit test for a model in > test.py and have a test set up to fail. > When I run manage.py test it returns that all tests are OK. > If I run manage.py test it returns OK. > If I run manage.py test . it

Re: Is django-users available via NNTP?

2009-04-15 Thread Eugene Lazutkin
Go to http://gmane.org and read using their web UI. There are different ways to read/write, and I use NNTP. You can find more information on that here: http://dir.gmane.org/gmane.comp.python.django.user In general you just tell your NNTP reader (I use Thunderbird) to get news from news.gmane.org

Re: request.urlconf does not get used in URL template tag

2009-04-15 Thread Sean Brant
I knew I couldn't be that easy. Thanks for the heads up. Any other work around? besides the patch mentioned. On Apr 15, 11:17 pm, Alex Gaynor wrote: > On Thu, Apr 16, 2009 at 12:15 AM, Sean Brant wrote: > > > If you set request.urlconf in say a

Re: request.urlconf does not get used in URL template tag

2009-04-15 Thread Alex Gaynor
On Thu, Apr 16, 2009 at 12:15 AM, Sean Brant wrote: > > If you set request.urlconf in say a Middleware then the reverse > function and the url tag will not work because those try to match > based on your ROOT_URLCONF. I was trying to find a solution to this > problem and

request.urlconf does not get used in URL template tag

2009-04-15 Thread Sean Brant
If you set request.urlconf in say a Middleware then the reverse function and the url tag will not work because those try to match based on your ROOT_URLCONF. I was trying to find a solution to this problem and came across this ticket. http://code.djangoproject.com/ticket/5034 Then It dawned on

manage.py loaddata fails to report error [was: Why does dumpdata, flush, loaddata cycle not result in same db content?]

2009-04-15 Thread Phil Mocek
On Thu, Apr 16, 2009 at 11:03:33AM +0800, Russell Keith-Magee wrote: > Loaddata doesn't take input from stdin - it loads files that are > specified on the command line. Thanks, Russell. I should have read the documentation for the loaddata command more closely, but this is quite

Re: Issue saving model in latest Django 1.1-beta-1

2009-04-15 Thread tm
Strangely, if I do this before the second save, it saves: ... foo.title = 'my_new_title foo.username = '%s' % ('awesome_user') foo.save() But if I don't explicitly copy 'awesome_user' into a string then save, it saves username as the user id. I should also note that foo.id from my

Issue saving model in latest Django 1.1-beta-1

2009-04-15 Thread tm
Hello, I just updated to the latest django dev version and it changed the behavior of my code (not suprisingly :) Get data from a form, save it to the DB, then in the same save function get the id from what was just saved, update a values and save it again. I need to do this to get the id of

Re: Why does dumpdata, flush, loaddata cycle not result in same db content?

2009-04-15 Thread Russell Keith-Magee
On Thu, Apr 16, 2009 at 10:43 AM, Phil Mocek wrote: > > I have a simple project using the flatpages app.  If I use > manage.py to run dumpdata (with no command line arguments, > redirecting output to a file), then flush, then loaddata (with no > command line

setting a model field to null

2009-04-15 Thread rvr
How can I set a model field to null after it has had a non-null value? -- class Blah(models.Model): foo = models.IntegerField(null=True) blah = Blah() blah.foo = 5 # now set it to null blah.foo = ??? -- None doesn't seem to work and I don't seem to be able to figure this out from the

Re: Stuck in Tutorial Part 2: can't find django/contrib/admin/templates

2009-04-15 Thread David Chambers
I had the same problem. Thanks very much for taking the time to post the solution, Alex. On Apr 8, 12:36 pm, "ab3...@gmail.com" wrote: > Thanks! You have unlocked the rest of the tutorial for me. I > appreciate your help. > > On Apr 7, 12:57 pm, Alex Gaynor

Why does dumpdata, flush, loaddata cycle not result in same db content?

2009-04-15 Thread Phil Mocek
I have a simple project using the flatpages app. If I use manage.py to run dumpdata (with no command line arguments, redirecting output to a file), then flush, then loaddata (with no command line arguments, redirecting input from a file), my sqlite3 database file is different than a backup copy

Re: Is django-users available via NNTP?

2009-04-15 Thread Phil Mocek
On Wed, Apr 15, 2009 at 07:49:00PM -0500, Eugene Lazutkin wrote: > I use NNTP provided by gmane. The group is gmane.comp.python.django.user. That group isn't carried by my Usenet provider, Giganews. Are you connecting directly to a Gmane server, or do you get it through your own Usenet

Re: Is django-users available via NNTP?

2009-04-15 Thread Eugene Lazutkin
I use NNTP provided by gmane. The group is gmane.comp.python.django.user. Eugene Lazutkin http://lazutkin.com/ On 04/15/2009 07:24 PM, Phil Mocek wrote: > Is this list available via NNTP on Usenet? Google Groups started > out as a Web interface to Usenet. It's unclear now where the line >

Is django-users available via NNTP?

2009-04-15 Thread Phil Mocek
Is this list available via NNTP on Usenet? Google Groups started out as a Web interface to Usenet. It's unclear now where the line between mailing list and newsgroup lies with Google Groups. -- Phil Mocek --~--~-~--~~~---~--~~ You received this message because

How to download archives for this mailing list?

2009-04-15 Thread Phil Mocek
How can I download a complete archive of this list? Various Web searches for combinations of "google groups," "list," "archive," "download," etc., have not turned up the answer. I'd like to be able to search and browse the list using my own MUA instead of having to go through Google's Web

Re: Unittests

2009-04-15 Thread Russell Keith-Magee
On Thu, Apr 16, 2009 at 5:04 AM, Daniel Joshua Worth wrote: > I'm trying to learn unit test and have a unit test for a model in test.py > and have a test set up to fail. > When I run manage.py test it returns that all tests are OK. > If I run manage.py test it returns

Re: Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Anthony
Thanks. I was just trying to get the stylesheet to show up. I have a full CSS template I got from somewhere else that I'll be using now that it's being successfully pulled in. On Apr 15, 4:06 pm, Wayne Koorts wrote: > >> > The picture shows up, but the text doesn't turn

Re: Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Wayne Koorts
>> > The picture shows up, but the text doesn't turn green like I think it >> > should. See if it helps changing your code and CSS as follows (basically making it XHTML compliant - not sure what you're aiming at specifically with what you've done): Test paragraph. p.baseline {

Re: Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 6:59 PM, Anthony wrote: > > Yes, they are right next to each other in the same folder. > > On Apr 15, 3:55 pm, Alex Gaynor wrote: > > On Wed, Apr 15, 2009 at 6:50 PM, Anthony wrote: > > > > > Hello, > >

Re: Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Anthony
Yes, they are right next to each other in the same folder. On Apr 15, 3:55 pm, Alex Gaynor wrote: > On Wed, Apr 15, 2009 at 6:50 PM, Anthony wrote: > > > Hello, > > > I'm pretty new to CSS as well as Django, so I'm sure I'm doing > > something

Java-doc style api docs.

2009-04-15 Thread Eddified
Are there up-to-date java-doc style api docs like this: http://djangoapi.matee.net/ anywhere on the official django site? I've looked high and low and can't find it... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 6:50 PM, Anthony wrote: > > Hello, > > I'm pretty new to CSS as well as Django, so I'm sure I'm doing > something simple wrong. Anyway, I'm able to serve up a test pic that > I placed in the media folder, but I can't get the html to use the CSS >

Serving Static Files - Pics work, but CSS doesn't

2009-04-15 Thread Anthony
Hello, I'm pretty new to CSS as well as Django, so I'm sure I'm doing something simple wrong. Anyway, I'm able to serve up a test pic that I placed in the media folder, but I can't get the html to use the CSS template. My Site Test paragraph. My CSS

Re: Does QuerySet have a refresh to catch when database data changes underneath running django?

2009-04-15 Thread Darrell Silver
Indeed, this is due to transaction management w/in MySQL. The table type was InnoDB. The thread you pointed me toward, http://groups.google.com/group/django-users/browse_thread/thread/e25cec400598c06d has all the answers. Thanks so much! And speedy it was! Darrell

Help writing a record/table display view function?

2009-04-15 Thread kjarsenal
I've created model class "Record", with a few CharFields (job_number, client_job_number, project_name), an IntegerField and a DateTimeField. It utilizes the ModelForm class. Its view is defined as "def record_add(request):", which returns "render_to_response('record_add.html'). The .html is a

Re: finding out what SQL Django generated

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 5:39 PM, Justin Bronn wrote: > > > If it's docs links you want :) : > > > > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-ra... > > This isn't in the docs, but it also works: > > >>> qs = Foo.objects.all() > >>> qs.query.as_sql() > >

Re: finding out what SQL Django generated

2009-04-15 Thread Justin Bronn
> If it's docs links you want :) : > > http://docs.djangoproject.com/en/dev/faq/models/#how-can-i-see-the-ra... This isn't in the docs, but it also works: >>> qs = Foo.objects.all() >>> qs.query.as_sql() It returns a two-element tuple comprised of the generated SQL and parameters,

Re: Trying to wrap my head around nested regroups or other ways to handle ordered ForeignKey stuff

2009-04-15 Thread Kevin Cole
On Apr 14, 6:32 pm, Daniel Roseman wrote: > On Apr 14, 6:11 pm, Kevin Cole wrote: > > Hi, > > > First let me say I've looked at documentation, but feel a bit dyslexic > > when it comes to this stuff. > > > The situation: I have three tables: a

Re: Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread Graham Dumpleton
On Apr 16, 6:20 am, usaar33 wrote: > Ah, I suspect the request.form code in mod_python must do doing block > read.  Either way, it worked for me. It will work with Apache/mod_wsgi as well, but by doing so you are breaking WSGI 1.0 standard. Use a different WSGI hosting

Re: Does QuerySet have a refresh to catch when database data changes underneath running django?

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 5:30 PM, Karen Tracey wrote: > On Wed, Apr 15, 2009 at 5:18 PM, Darrell Silver > wrote: > >> >> I've been searching high and low for an answer to this question, but >> haven't had any luck. If the database data changes

Re: Does QuerySet have a refresh to catch when database data changes underneath running django?

2009-04-15 Thread Karen Tracey
On Wed, Apr 15, 2009 at 5:18 PM, Darrell Silver wrote: > > I've been searching high and low for an answer to this question, but > haven't had any luck. If the database data changes somehow, my django > process, happily running, doesn't see the data if it's already got a

Re: Sending large, generated files

2009-04-15 Thread Graham Dumpleton
On Apr 16, 1:36 am, Rick Wagner wrote: > > From memory, file wrappers at django level, in order to work across > > different hosting mechanisms supported, only allow a file name to be > > supplied. At the WSGI level the file wrapper actually takes a file > > like

Does QuerySet have a refresh to catch when database data changes underneath running django?

2009-04-15 Thread Darrell Silver
I've been searching high and low for an answer to this question, but haven't had any luck. If the database data changes somehow, my django process, happily running, doesn't see the data if it's already got a cache someplace. I believe this cache is stored in QuerySet. The closest conversation

Unittests

2009-04-15 Thread Daniel Joshua Worth
I'm trying to learn unit test and have a unit test for a model in test.py and have a test set up to fail. When I run manage.py test it returns that all tests are OK. If I run manage.py test it returns OK. If I run manage.py test . it returns OK. If I run manage.py test .. if Fails. What gives. Am

Re: Adding a "View" Link (similar to add and change links) to the admin

2009-04-15 Thread Adam Olsen
> > You'd need to overide the admin template to do this, as documented here: > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates > > Alex I guess I should be more specific. I've already got this working, but I'm wondering if someones come up with a better

Re: finding out what SQL Django generated

2009-04-15 Thread Chris Curvey
On Apr 15, 4:25 pm, Alex Gaynor wrote: > On Wed, Apr 15, 2009 at 4:23 PM, Chris Curvey wrote: > > > I'm getting unexpected results from a database query that was > > generated by Django, and I'm sure the problem is that I'm mis-using > > the API.  Is

Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm
patrickk wrote: > line 53 of base.html is {% get_help request.path %}. > > I´m not exactly sure what´s happening here and I´m not able to > reproduce this error. > you might wanna try to debug ... request.user seems to work (because > that´s a couple of lines before), so request.path should also

custom Field for Model choice

2009-04-15 Thread Christopher Dodd
Once I populated my database with thousands and thousands of rows the widgets available for manipulating the data on the Admin site became virtually unusable. So I have written a custom forms.Field that is a simple TextField that maps to a (hopefully) unique char field on a Model. The Field

Re: how to require/validate minimum number of forms in formset?

2009-04-15 Thread patrickk
this is strange (at least to me), but the clean-method doesn´t seem to be called when _all_ forms are marked for deletion. patrick On 15 Apr., 22:05, patrickk wrote: > to be more precise: > > class AmountBaseFormset(formsets.BaseFormSet): > >     def clean(self): >      

Re: Sending large, generated files

2009-04-15 Thread Alex Loddengaard
Thanks for the responses, guys. Regarding my deployment, I've been doing my development on my local machine using manage.py. I'll give this a go in WSGI and see what happens. Graham, I totally agree that there are ways to get around my problem outside of trying to send HTTP headers before the

Re: finding out what SQL Django generated

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 4:23 PM, Chris Curvey wrote: > > I'm getting unexpected results from a database query that was > generated by Django, and I'm sure the problem is that I'm mis-using > the API. Is there a way to get Django to tell me what SQL was sent to > the database

finding out what SQL Django generated

2009-04-15 Thread Chris Curvey
I'm getting unexpected results from a database query that was generated by Django, and I'm sure the problem is that I'm mis-using the API. Is there a way to get Django to tell me what SQL was sent to the database server? (Sorry if this is a FAQ, I've been looking for a while. Pointers to docs

Re: Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread usaar33
Ah, I suspect the request.form code in mod_python must do doing block read. Either way, it worked for me. So in conclusion, it sounds like there is either an issue with A) mod_deflate not modifying the header or B) WSGI 1.0 being wrong. Interestingly, there was a large debate on this 4 years

Re: how to require/validate minimum number of forms in formset?

2009-04-15 Thread patrickk
to be more precise: class AmountBaseFormset(formsets.BaseFormSet): def clean(self): (pseudo-code) if number of forms equal number of deleted forms: raise forms.ValidationError(u'At least one Item is required.') question is: how do I figure out the number of forms resp. the

Re: Adding a "View" Link (similar to add and change links) to the admin

2009-04-15 Thread Alex Gaynor
On Wed, Apr 15, 2009 at 3:13 PM, Adam Olsen wrote: > > Sometimes I want to give people access to a report in the admin > section, and I'd like it to fit in and look well with the rest of the > models in the associated application. > > Look at this image, you'll see what I

Query puzzle

2009-04-15 Thread zayatzz
I need help understanding the results of following queries Bacground. I have 4 trans objects in database. 2 which are related to poll objects and 2 which are related to another content type. each of those 2 has 1 objec where keel = 1 and 2 where keel = 2. I want this single poll related Trans

Adding a "View" Link (similar to add and change links) to the admin

2009-04-15 Thread Adam Olsen
Sometimes I want to give people access to a report in the admin section, and I'd like it to fit in and look well with the rest of the models in the associated application. Look at this image, you'll see what I mean: http://www.exaile.org/report.png That view button is just some "search" icon I

Re: can’t input @ sign on a Windows PC which I installed Portable Ubuntu -- which gives you linux on it

2009-04-15 Thread google torp
This group is for Django related subjects only, please help us keep the posts on subject. I would suggest you asked this question in a Portable Ubuntu group instead. ~Jakob On 15 Apr., 20:58, bconnors wrote: > I have a Windows PC which I installed Portable Ubuntu --

can’t input @ sign on a Windows PC which I installed Portable Ubuntu -- which gives you linux on it

2009-04-15 Thread bconnors
I have a Windows PC which I installed Portable Ubuntu -- which gives you linux on it. I’m trying to do Python manage.py syncdb so I can get Django working. Trouble is in Linux I’m not able to input @ sign 1 Tried ascii representation of @ sign #64 and 2 Tried hex representation of @

how to require/validate minimum number of forms in formset?

2009-04-15 Thread patrickk
I´m allowing the forms within a formset to be deleted. but I need at least one form to save the formset. is it possible to require at least one form? if yes, how do I achieve this? thanks, patrick --~--~-~--~~~---~--~~ You received this message because you are

Re: django-grappelli setup problem

2009-04-15 Thread patrickk
line 53 of base.html is {% get_help request.path %}. I´m not exactly sure what´s happening here and I´m not able to reproduce this error. you might wanna try to debug ... request.user seems to work (because that´s a couple of lines before), so request.path should also work. but I´ve never

Re: Problem querying database

2009-04-15 Thread google torp
The two ways are pretty much the same, one picks a random number to use for a slice, the other picks a random element in a queryset. I would go for whatever you think is the easiest to understand, when browsing through the code. Also, if you're not sure that atleast 3 elements will come from the

Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm
patrickk wrote: > in order to use the admin, just use /admin/ (grappelli doesn´t change > the admin-urls). Thanks, but that got me in to some other problem: TemplateSyntaxError at /admin/ Caught an exception while rendering: Failed lookup for key [request] in u"[{'root_path': u'/admin/',

How to make add a listbox to admin template?

2009-04-15 Thread Burcu Hamamcıoğlu
--~--~-~--~~~---~--~~ 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

Re: Converting from local DST to UTC

2009-04-15 Thread Jamie
On Apr 14, 9:34 pm, Brian Neal wrote: > This is how I am doing it (I'm also integrating with Google Calendar): > tz = pytz.timezone(tz_name)  # create timezone > local = tz.localize(d)  # make naive datetime localized > zulu = local.astimezone(FixedOffset(0))  # convert to UTC

Re: Models.py - retrieve information from other models via ForeignKey field?

2009-04-15 Thread Adi
paste the code for your models --~--~-~--~~~---~--~~ 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

Re: Problem querying database

2009-04-15 Thread Baxter
On Apr 15, 10:44 am, google torp wrote: > What I meant was that you could do it like this > > import random > sa = Article.objects.filter(...).order_by('-id') > random_choice = sa[random.randrange(2, len(sa))] > Thanks Jakob. Is there an advantage to doing it that way

Re: Problem querying database

2009-04-15 Thread google torp
What I meant was that you could do it like this import random sa = Article.objects.filter(...).order_by('-id') random_choice = sa[random.randrange(2, len(sa))] random.randrange will create a "random" number for you. Giving it those arguments it can output a number of 2 (so the first wont be

Re: Problem querying database

2009-04-15 Thread Baxter
On Apr 15, 9:39 am, Baxter wrote: > On Apr 15, 9:33 am, google torp wrote:> Hi. > > You can just use the python random function, I believe it's in math, > > and generate a random number in range of the number of articles. > > You could do that before

Re: How do you retrieve a username that is not in the URL?

2009-04-15 Thread JL
Also, you might want to make sure you have an authenticated user (by either decorating your view function with @login_required) or check that the user in the request is either authenticated or not the anonymous user (by including an if statement). On Apr 14, 8:36 pm, James Bennett

Re: Problem querying database

2009-04-15 Thread Baxter
On Apr 15, 9:33 am, google torp wrote: > Hi. > You can just use the python random function, I believe it's in math, > and generate a random number in range of the number of articles. > You could do that before the slice even, and just get a random > number with min value of

Re: Problem querying database

2009-04-15 Thread google torp
Hi. You can just use the python random function, I believe it's in math, and generate a random number in range of the number of articles. You could do that before the slice even, and just get a random number with min value of 2 instead. ~Jakob On 15 Apr., 16:23, "bax...@gretschpages.com"

Re: add 'link' to admin interface of model

2009-04-15 Thread Psihonavt
On 10 Кві, 12:18, "ramu...@gmail.com" wrote: > If I understand correctly the same problem solve by this code: > > > def colored_name(self): >     return '%s %s' % > (self.color_code, self.first_name, self.last_name) > colored_name.allow_tags = True > > >

Problem querying database

2009-04-15 Thread bax...@gretschpages.com
I'm hoping someone can help me get the info I'm trying to get. This is the structure: I have Categories Each Category has one or more subcategory Articles have a M2M relationship with subcategory so they can turn up in more than one category as needed. I'm trying to get one random

Changing raw_id_field from 'id'

2009-04-15 Thread Alfonso
Is there an easy way to change the raw_id_field in a foreign key relationship? I'd like to change an inline formset to display not the item pk id alongside the raw_id_field 'magnifying glass' but a barcode field instead. Thanks --~--~-~--~~~---~--~~ You received

Re: Basic RSS in Django

2009-04-15 Thread Jeff FW
It looks like you're missing (or at least, didn't mention) the templates. In documentation: http://docs.djangoproject.com/en/dev/ref/contrib/syndication/#ref-contrib-syndication make sure to read the paragraph starting with "One thing's left to do" under "A simple example". -Jeff On Apr 15,

sanitizing the regex in Entry.objects.get(title__iregex=regex)

2009-04-15 Thread commander_coder
I have a question about escaping a db query that uses iregex. I wonder if there isn't just a function that I need to use that I don't know how to find. I have a text box where users can enter multiple words and I will search the database for a regex made from those words (the underlying databse

Re: Auth permitions in templates

2009-04-15 Thread Gil Sousa
Thanks a lot :) It works now :) On 15 Abr, 13:58, Daniel Roseman wrote: > On Apr 15, 11:56 am, Gil Sousa wrote: > > > I am new with django, sorry about this kind of questions. > > > I don't know how to pass the 'user' variable into the

Re: Adding model instance attributes

2009-04-15 Thread Mitch Chapman
On Apr 14, 9:43 am, Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 11:33 AM, Mitch Chapman > wrote: > > Is it bad form in Django to add "transient" instance variables to > > model instances? > > > I'm rendering a set of search results.  Each result

Re: single queryset from multiple tables

2009-04-15 Thread veearrsix
Thanks guys that was perfect On Apr 14, 3:53 pm, Alex Gaynor wrote: > On Tue, Apr 14, 2009 at 10:50 AM, veearrsix wrote: > > > Thanks for the help so far guys, I've used that recipe suggested by > > Malcolm, where by I pass a number of querysets

Basic RSS in Django

2009-04-15 Thread Oto Brglez
Hi all you Django users and developers! I have a question about RSS framework in Django. I want basic RSS. Nothing custom nothing advanced. Just RSS from my model for last 10 imports in model. This is what i got: # Model: class Koda(models.Model): naslov =

Iterable blocks in templates

2009-04-15 Thread Daniel Isla
I'm trying to make our web designers will not see source code in template files is possible do this in django template system? there is something similar? Template - index.html Test News {% block content %} New number {{ number }} {% endblock %} Controller - test.py def index(request):

Re: code from database in template -> br

2009-04-15 Thread google torp
Just wanted to add, the danger is not if the data is coming from the db, as all the data, more or less will come from the db. The problem is if the user has made the input that was saved to the db, like the username. Marking such content with the safe tag would make it possible for evil minded

Re: code from database in template -> br

2009-04-15 Thread mag_dex
sorry: Description:{{ script.desc | safe }} no need to put {% autoescape off %} in this second statement. On Apr 15, 3:28 pm, mag_dex wrote: > Thanks. I've been on that page but I just found > >       {% autoescape off %} >       Description:{{  script.desc }} td> >      

Re: code from database in template -> br

2009-04-15 Thread mag_dex
Thanks. I've been on that page but I just found {% autoescape off %} Description:{{ script.desc }} {% endautoescape %} Using 'safe' it goes like: {% autoescape off %} Description:{{ script.desc | safe }} {% endautoescape %} Data goes from the db (by but

Re: save message text with registered character

2009-04-15 Thread CrabbyPete
Karen, Sorry for the cryptic message.I just start using google groups and django. I was storing email that I received in a database. One of the characters was a mark that could not be coverted for some reason. I found the program decodeh.py and it fixed it for me. On Apr 7, 1:40 pm, Karen

Re: Error: no module named manager

2009-04-15 Thread Daniel Sisco
This problem was caused by the fact that my __init__.py file contained two lines of "from django include ..." code. I must have copied these from somewhere instead of creating them fresh. Removing these lines fixes the problem. > I don't understand this error, but I can tell you that you need a

Re: code from database in template -> br

2009-04-15 Thread google torp
Hi There is a page for all the django template tags: http://docs.djangoproject.com/en/dev/ref/templates/builtins/ Your problem is the auto escape, you can use "|safe" to mark something safe and it wont be escaped. Doing this for user submitted data is a bad idea though, so make sure you don't

Re: Auth permitions in templates

2009-04-15 Thread Daniel Roseman
On Apr 15, 11:56 am, Gil Sousa wrote: > I am new with django, sorry about this kind of questions. > > I don't know how to pass the 'user' variable into the template, how > can I do that? > > Thanks for your help! > The same way you pass all the other variables when you

Re: Auth permitions in templates

2009-04-15 Thread Gil Sousa
I am new with django, sorry about this kind of questions. I don't know how to pass the 'user' variable into the template, how can I do that? Thanks for your help! On 15 Abr, 11:39, Daniel Roseman wrote: > On Apr 15, 9:32 am, Gil Sousa wrote:

Re: Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread Graham Dumpleton
Oh, reading past content length also will not necessarily work in mod_python due to bugs it has: http://issues.apache.org/jira/browse/MODPYTHON-212 If you read in blocks may be okay, but not if you try and read all data in one go. Graham On Apr 15, 8:44 pm, Graham Dumpleton

code from database in template -> br

2009-04-15 Thread mag_dex
Hey, I've gotten a following problem. I have stored some pieces of html code in the database. If the django renders html code it is changed to br ;( I guess there is easy one to change behaviour of rendering but I can't find it. Any ideas? M.

Re: Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread Graham Dumpleton
On Apr 15, 7:44 pm, usaar33 wrote: > I just looked at the source code.  This is a django bug. > Ticket filed @http://code.djangoproject.com/ticket/10819 When Apache is decompressing the content you run up against a limitation in way mutating input filters are dealt with.

Re: Leopard deploy directory?

2009-04-15 Thread Graham Dumpleton
On Apr 15, 9:26 pm, Ayaz Ahmed Khan wrote: > On 14-Apr-09, at 4:12 AM, Shannon wrote: > > > > > Hi -- I am working on a django-powered site on Leopard server.  Where > > is the recommended/conventional deployment directory?  Every example I > > see uses a particular user's home

Re: Leopard deploy directory?

2009-04-15 Thread Ayaz Ahmed Khan
On 14-Apr-09, at 4:12 AM, Shannon wrote: > > Hi -- I am working on a django-powered site on Leopard server. Where > is the recommended/conventional deployment directory? Every example I > see uses a particular user's home directory, but that does not seem > appropriate for a production-level

Re: Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread usaar33
I just looked at the source code. This is a django bug. Ticket filed @ http://code.djangoproject.com/ticket/10819 On Apr 15, 1:41 am, usaar33 wrote: > Hello, >   For my application, I am using using gzip content-encoding to > compress POSTDATA that the client is giving to

Django request.POST is truncating data when 'Content-Encoding', 'gzip' is set in client request

2009-04-15 Thread usaar33
Hello, For my application, I am using using gzip content-encoding to compress POSTDATA that the client is giving to django. The actual content-type is multipart/form-data (although django is screwing up on any content-type). mod_deflate is used to decompress data coming in from the client.

Re: residual fields admin error

2009-04-15 Thread Daniel Roseman
On Apr 15, 4:24 am, CrabbyPete wrote: > I am just starting coding with django. So please bear with me. > > I made a change to my User model so the field email_addr is now email. > I deleted the database, made new tables with manage.py, did a resync, > and changed all the

Re: Auth permitions in templates

2009-04-15 Thread Daniel Roseman
On Apr 15, 9:32 am, Gil Sousa wrote: > Hi! > > I have one menu that I use as a "base" template, this menu has some > entries which some of them should be restricted to logged users, but > even when I loggin I cannot see those entries. > > This is my menu.html: > >

Auth permitions in templates

2009-04-15 Thread Gil Sousa
Hi! I have one menu that I use as a "base" template, this menu has some entries which some of them should be restricted to logged users, but even when I loggin I cannot see those entries. This is my menu.html: http://www.w3.org/1999/xhtml;> {% block title %}{% endblock %}

Re: django-grappelli setup problem

2009-04-15 Thread patrickk
in order to use the admin, just use /admin/ (grappelli doesn´t change the admin-urls). patrick On 15 Apr., 10:06, Lars Stavholm wrote: > patrickk wrote: > > which URL causes that error? > > http://localhost:8000/grappelli/admin/ > > > please note that in order to use

Re: django-grappelli setup problem

2009-04-15 Thread Lars Stavholm
patrickk wrote: > which URL causes that error? http://localhost:8000/grappelli/admin/ > please note that in order to use grappelli you have to setup the admin- > site before, see > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin. > maybe this should be mentioned in

Re: Two projects, one admin, filebrowser

2009-04-15 Thread patrickk
although I don´t fully understand the problem, there seem to be different solutions: ### when using the filebrowsefield, you could also write a custom model method to get the different URLs. ### if your intranet-site and your public-site are on the same server you could maybe use a symlink as

Re: Different approach?

2009-04-15 Thread google torp
Hi. As I'm not sure exactly what your goals with this site is, I'll be guessing a bit here. Using the admin to create customers ect, can be a solution, but having access to the admin also means having access to a whole bunch of stuff that you can mess with. You could instead make some views that

Re: django-grappelli setup problem

2009-04-15 Thread patrickk
which URL causes that error? please note that in order to use grappelli you have to setup the admin- site before, see http://docs.djangoproject.com/en/dev/ref/contrib/admin/#ref-contrib-admin. maybe this should be mentioned in the docs, but I guess it´s pretty obvious. patrick. On Apr 14,

Re: Error: no module named manager

2009-04-15 Thread Daniel Roseman
On Apr 15, 2:14 am, Daniel Sisco wrote: > All: > > I'm adding an app (from django snippits) that is just a template tag > for a calendar application in my blog. This is the new directory > structure: > > /apps/postcal >               | >               -->

Re: RadioSelect widget not rendering

2009-04-15 Thread Daniel Roseman
On Apr 15, 7:10 am, Adam Yee wrote: > Can't get the forms.RadioSelect widget to render.  I'm using svn > 10559, I've looked over forms/widgets.py, but I don't know...  I'm > able to use forms.CheckboxSelect just fine. > > Is it Firefox giving me issues?  What's going on here?

  1   2   >