Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Konstantin Sushenko
I can see the markup that you published in your original post. :) what does the browser show when you look at the page source? konstantin On Aug 16, 12:04 am, Adam Zedan wrote: > Its at the top most post.. > have a look >

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Adam Zedan
Yes the title changes but my table does not appear. It only appear if i double click it ... :( On Tue, Aug 16, 2011 at 7:46 AM, Landy Chapman wrote: > When you get a blank page Does the title change? > Is debug mode on/off? > Is there an error message? > > > You could

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Adam Zedan
the url you're using when you get a blank page? http://127.0.0.1:8000/db/ urls.py url('^db/$', dbdemo), views.py def dbdemo(request): list= Student_Info.objects.all() #field=Student_Info._meta.get_all_field_names() return render_to_response("db.html",{'content':list}) On

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Adam Zedan
Its at the top most post.. have a look at http://groups.google.com/group/django-users/browse_thread/thread/8a509a916ae0023?hl=en On Aug 16, 6:11 am, Konstantin Sushenko wrote: > what is the source code for the blank page? > > On Aug 15, 8:50 pm, Adam Zedan

Re: How to avoid repeated "context_instance = RequestContext(request)" args when rendering?

2011-08-15 Thread Rodney Topor
Great! Just what I hoped to find. Thank you. Rodney On Aug 16, 12:54 pm, fredb wrote: > Rodney, > > Take a look at the render() [1] shortcut provided in Django 1.3. Also > the current trunk provides a static template tag [2]. > > Fred > >

Re: How to avoid repeated "context_instance = RequestContext(request)" args when rendering?

2011-08-15 Thread fredb
Rodney, Take a look at the render() [1] shortcut provided in Django 1.3. Also the current trunk provides a static template tag [2]. Fred [1] https://docs.djangoproject.com/en/1.3/topics/http/shortcuts/#render [2] https://docs.djangoproject.com/en/dev//ref/contrib/staticfiles/#static On Aug 15,

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Landy Chapman
When you get a blank page Does the title change? Is debug mode on/off? Is there an error message? You could add this: My html IS being displayed -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Landy Chapman
On Aug 15, 9:11 pm, Konstantin Sushenko wrote: > what is the source code for the blank page? > beat me to the punch... can you paste the url you're using when you get a blank page urls.py views.py thanks -- You received this message because you are subscribed to

How to avoid repeated "context_instance = RequestContext(request)" args when rendering?

2011-08-15 Thread Rodney Topor
As I understand it, when using the development server, if you want to access static files from templates, you write something like {{ STATIC_URL }}css/mystyle.css. For STATIC_URL to be bound to the value assigned in settings.py, it is apparently necessary to include "context_instance =

Re: Form label is same as first RadioSelect item

2011-08-15 Thread wayne
On Aug 15, 7:56 pm, Karen Tracey wrote: > I found your post confusing; I think you have used the word "form" in > several places where you really mean "field". Sorry, I can see the confusion. You are correct, I am referring to a field. In this particular case, the entire

Re: Template html works when double clicked but empty when accessed through server

2011-08-15 Thread Konstantin Sushenko
what is the source code for the blank page? On Aug 15, 8:50 pm, Adam Zedan wrote: > Hi my html works properly when i double click it. > > The code is > > > >     >         >         Demo >         href="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.css" >

Re: Form label is same as first RadioSelect item

2011-08-15 Thread Karen Tracey
On Mon, Aug 15, 2011 at 2:51 PM, wayne wrote: > I have noticed that when I use one of the "shortcut" template > rendering calls (eg, as_ul) that the resulting form gets a label that > is the same as the first item in a selection list--in this case, a > RadioSelect. For

Re: For loop problem in template..Is this correct

2011-08-15 Thread Konstantin Sushenko
I would just write a template tag that outputs the whole JS function. templates are too limiting in what you can use in {{}} brackets. konstantin On Aug 15, 8:38 pm, Landy Chapman wrote: > You may be right.  I am out of my element (pardon the pun). However, > assuming

Re: Deleting a model object then returning it

2011-08-15 Thread Colin Bean
On Mon, Aug 15, 2011 at 5:29 PM, Kevin Anthony wrote: > Accoding to the documentation all i need to do is > object = someobject.objects.all().filter(somefield=somevalue) > print object > object.delete() > print object > > and theoretically, object should be unchanged,

Re: For loop problem in template..Is this correct

2011-08-15 Thread Landy Chapman
You may be right. I am out of my element (pardon the pun). However, assuming your "content" was this: content = [ { 'roll_no':1, 'cell_no': 1, 'nationality':'nation1'}, { 'roll_no':2, 'cell_no': 2, 'nationality':'nation2'}, { 'roll_no':3, 'cell_no': 3, 'nationality':'nation3'}, the django

Deleting a model object then returning it

2011-08-15 Thread Kevin Anthony
Accoding to the documentation all i need to do is object = someobject.objects.all().filter(somefield=somevalue) print object object.delete() print object and theoretically, object should be unchanged, since according to the documentation: Issues a SQL DELETE for the object. This only deletes

Re: For loop problem in template..Is this correct

2011-08-15 Thread Adam Zedan
I dont think we could even use "[]" as in roll_no: {{content[0].roll_no}}, am i correct ?? couldnt find any reference to it on https://docs.djangoproject.com/en/dev/topics/templates/ On Tue, Aug 16, 2011 at 5:07 AM, Landy Chapman wrote: > @Konstantin Sushenko

Re: Nested serialization of model instances

2011-08-15 Thread Russell Keith-Magee
On Mon, Aug 15, 2011 at 5:58 PM, Christo Buschek wrote: > Hi list, > > I'm busy writing a custom json serializer for django. It works very > good, only now I want to serialize ForeignKey and M2M relations inside > the same serialization call and build nested json objects with

Re: For loop problem in template..Is this correct

2011-08-15 Thread Landy Chapman
@Konstantin Sushenko nice catch! >> as a result of this you will have a series of 'data[i] = ...' >>assignments in your output. where 'i' would be undefined. So could he use this: JS isn't my thing, and this is approaching too_clever > $(function() { i = 0; >             var

Re: For loop problem in template..Is this correct

2011-08-15 Thread Adam Zedan
okay so i temporarily removed the loop just to see if the template works $(function() { var data = []; data[0] = { roll_no: {{content[0].roll_no}}, cell_no: {{content[0].cell_no}},

Re: For loop problem in template..Is this correct

2011-08-15 Thread Landy Chapman
On Aug 15, 11:45 pm, Adam Zedan wrote: > Hi i am getting a problem with my for loop which i used in my template.Could > you kindly let me know what is going wrong in here. > The for loop is in a jquery function I think this: >                {% for x in range(len(content))

Re: For loop problem in template..Is this correct

2011-08-15 Thread Adam Zedan
Ooops.. sorry for the i: The code is $(function() { var data = []; {% for x in range(len(content)) %} data[x] = { roll_no: {{content[x].roll_no}}, cell_no: {{content[x].cell_no}},

Limiting choices for inline manytomany field

2011-08-15 Thread DelS
I am fairly new and using Django Admin to manage a set of lists and forms for a database GUI. I am not happy with the performance rendering a form which has foreignkey fields or manytomany fields with numerous values. This inspired me to get involved with overloading "formfield_for_foreignkey"

Re: For loop problem in template..Is this correct

2011-08-15 Thread Konstantin Sushenko
hello, as a result of this you will have a series of 'data[i] = ...' assignments in your output. where 'i' would be undefined. konstantin On Aug 15, 7:45 pm, Adam Zedan wrote: > Hi i am getting a problem with my for loop which i used in my template.Could > you kindly let me

For loop problem in template..Is this correct

2011-08-15 Thread Adam Zedan
Hi i am getting a problem with my for loop which i used in my template.Could you kindly let me know what is going wrong in here. The for loop is in a jquery function $(function() { var data = []; {% for x in range(len(content)) %} data[i] =

Re: New user - Trouble starting

2011-08-15 Thread Landy Chapman
Hopefully this will help >> http://weblog.greenpeace.org/it/2006/04/getting_started_with_django_on.html > I'm trying to start the tutorial (on Windows by the way) and I can't > get anywhere. When I enter "django-admin.py startproject mysite" into > either the interpreter or the Python command

Re: Convert dictionaries to django model (recursively)

2011-08-15 Thread Landy Chapman
This forum may help you with the dictionary-within-dictionary... >> http://www.daniweb.com/software-development/python/threads/248240 for help with your models, check out (at least) >> https://docs.djangoproject.com/en/1.3/intro/tutorial01/ >>

Re: 3rd party Apps in Django

2011-08-15 Thread Chris Lawlor
+1 for using virtualenv. Indispensable for working on more than one dingo project on the same development machine. If you're developing on Linux or Mac, take a look at virtualenvwrapper. It makes working with virtual environments practically painless. -- You received this message because you

Re: New user - Trouble starting

2011-08-15 Thread Thomas Weholt
Have you tried this in the command window ( assuming python is installed in c:\python27 ): c:\python27\python c:\python27\scripts\django-admin.py startproject mysite On windows you might need to run python scripts through python like shown above. And add c:\python27; c:\python27\scripts; to your

New user - Trouble starting

2011-08-15 Thread squirrel
I'm trying to start the tutorial (on Windows by the way) and I can't get anywhere. When I enter "django-admin.py startproject mysite" into either the interpreter or the Python command line I get the same message: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32

(Solved) Re: Admin inlines suddenly missing?

2011-08-15 Thread Nan
User error (ish). Some data updates we'd made directly to the database had resulted in an invalid foreign key. Lesson learned: don't use MyISAM unless absolutely necessary. On Aug 15, 5:11 pm, Nan wrote: > Further investigation indicates that the template engine is

Re: Admin inlines suddenly missing?

2011-08-15 Thread Nan
Further investigation indicates that the template engine is simply failing to include/render the template for the inline -- i.e. the following line is reached but is producing nothing: {% include inline_admin_formset.opts.template %} I've checked the value of

Re: Successfully Running Command Line Application from Django

2011-08-15 Thread wayne
On Aug 15, 2:40 pm, octopusgrabbus wrote: > I get a file permissions error, and this is running on Apache. > > It's dying on the retrbinary line. However, it's logging in using > valid user names and passwords, so I'm confused as to why it's dying. Yes, but it looks as

Re: Django-Registration, How can a beginner work with this 3rd party App?

2011-08-15 Thread william ratcliff
Perhaps the following blog post will be useful for you if you just want to get something up and running: http://devdoodles.wordpress.com/2009/02/16/user-authentication-with-django-registration/ The author even has a link where you can download some of the standard templates. Best, William On

Controlling order of form media

2011-08-15 Thread Croepha
I was wondering if there was a way to control the order the tags will appear for {{ form.media }} when using widget media and a Media class in the form. I need something to be pulled in before the widget media, but for some reason, the widget media is being pulled in before the Media class

Re: Successfully Running Command Line Application from Django

2011-08-15 Thread octopusgrabbus
I get a file permissions error, and this is running on Apache. It's dying on the retrbinary line. However, it's logging in using valid user names and passwords, so I'm confused as to why it's dying. def getInvRpt(id, filename, path, db): file_list = [] os.chdir('/home/amr/ics_in/')

Using {% url somenamedview %} in a custom page extending admin templates

2011-08-15 Thread Thomas Weholt
My urls.py for my app: urlpatterns = patterns('', url(r'^geocoding/$', geocoding, name='geocoding'), ) I've extended the change_list.html template based on the standard change_list.html and added this piece : {% block content %} {% block object-tools %} {% if has_add_permission

Re: Successfully Running Command Line Application from Django

2011-08-15 Thread wayne
What error exactly do you get? Do you encounter this error while using runserver, or is it live on a web server (Apache et al)? -- 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.

Successfully Running Command Line Application from Django

2011-08-15 Thread octopusgrabbus
My Django application successfully executes functions belonging to user amr. I want to execute an external command line application from views.py def exec_external_cmd(cmd_line): retcode = None try: process = Popen(cmd_line, bufsize=2048, executable="/bin/ bash", shell=True,

Re: Django-Registration, How can a beginner work with this 3rd party App?

2011-08-15 Thread Andre Terra
To be honest, django registration is quite complex in some aspects for a beginner, due to its modularity. Creating a custom backend for a third party app isn't the easiest exercise for a newbie. If anyone has examples on how to customize django registration, now would be a great time to share it!

Re: Django-Registration, How can a beginner work with this 3rd party App?

2011-08-15 Thread Thomas Weholt
Have you followed the standard tutorial on https://docs.djangoproject.com/en/1.3/intro/tutorial01/? Look at the http://www.djangobook.com/en/2.0/ ? If you haven't you should start there and not jump directly at a third app. After doing the tutorials and reading through the djangobook the online

Form label is same as first RadioSelect item

2011-08-15 Thread wayne
I have noticed that when I use one of the "shortcut" template rendering calls (eg, as_ul) that the resulting form gets a label that is the same as the first item in a selection list--in this case, a RadioSelect. For example, I get something akin to the following: Membership level: Benefactor

Django-Registration, How can a beginner work with this 3rd party App?

2011-08-15 Thread Andre Lopes
Hi, another question from a beginner. I am getting some trouble to get Django-Registration working. The on-line documentation(http://readthedocs.org/docs/django-registration/en/latest/) is not for a beginner like me, there are many steps that I don't know how to do them. For example the creation

Aw: Re: Weird Problem: Template Shows Templatevariable's Name Instead Of It's Value

2011-08-15 Thread Schmidtchen Schleicher
What is the advantage in using a context? You only put the content i would put directly into the render_to_response arguments in an own dict, like context = {'foo':'bar'} return context is equal to return {'foo':'bar'} ??? But thanks to your code -- it's much better than mine ;-) -- You

Re: 3rd party Apps in Django

2011-08-15 Thread Cal Leeming [Simplicity Media Ltd]
+1 Although I haven't personally used virtual-env, from what I've seen this may be worth looking at (seems to be the bridge between users that don't want to have root privs, but do want to manage their python install) On Mon, Aug 15, 2011 at 2:17 PM, william ratcliff <

Convert dictionaries to django model (recursively)

2011-08-15 Thread Jacco77
Hi, I want build a custom api (have tried and abandoned tastypie and restframework). I have come to the the point where I want to save a dictionary in a django model. Example: class Person(models.Model): name = models.CharField() title = models.CharField() class

Re: Changing App/Model Names and Sort Order in index.html

2011-08-15 Thread Konstantin Sushenko
hello, your question indicates that you have a limitedknowledge of django templates and template tags. python code is ot supported in templates, so your string.replace won't work. to change the order: https://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by konstantin On Aug 14,

Re: Admin inlines suddenly missing?

2011-08-15 Thread Nan
Yes, the ModelAdmins are declared in a separate admin.py. Just tried the import on the command line and got no import errors. The admin and the rest of the app are otherwise running just fine, btw -- it's just that one inline that's not showing up at all (and then because it's not output to the

Re: custom template tag. success message after form-submit in the same .html file

2011-08-15 Thread Konstantin Sushenko
hello, you can just add a context variable 'submitted' to your context in your view's get_context_data konstantin On Aug 15, 4:06 am, doniyor wrote: > Hi There, > > I am heading well now, but have still some confusing things here.. > > this is my html file, where i

Re: Admin inlines suddenly missing?

2011-08-15 Thread Reinout van Rees
On 15-08-11 16:18, Nan wrote: I'm having a problem with admin inlines on a particular model suddenly not showing up, even though they were working previously. Oddly, they're working just fine on the exact same code in staging (granted, on a somewhat different server setup) but not in

Re: Doing maths on fields in a query

2011-08-15 Thread Thorsten
Thank you, it is working, seems I missed that somehow while searching in the documentation. P.S. It is not that simple, I just prefer to keep the example as simple as possible, it also includes doing min,avg,max calculations over thousands of entries etc. -- You received this message because

Re: How to store variable timedeltas in a Django model?

2011-08-15 Thread Derek
Perhaps all those that contributed code can add their contributions to: http://djangosnippets.org/ Where it will be centrally accessible, searchable etc etc. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Doing maths on fields in a query

2011-08-15 Thread Daniel Roseman
On Monday, 15 August 2011 15:27:44 UTC+1, Thorsten wrote: > > Hello, > > I am wondering if it is possible to do math on fields inside a query > with using the django syntax for example like > > SELECT (buyout / quantity) as buyout_per_item > > Currently I am using raw queries, because i

Doing maths on fields in a query

2011-08-15 Thread Thorsten
Hello, I am wondering if it is possible to do math on fields inside a query with using the django syntax for example like SELECT (buyout / quantity) as buyout_per_item Currently I am using raw queries, because i couldn't find anything about such cases. Greetings, -- You received this message

Admin inlines suddenly missing?

2011-08-15 Thread Nan
Hi folks -- I'm having a problem with admin inlines on a particular model suddenly not showing up, even though they were working previously. Oddly, they're working just fine on the exact same code in staging (granted, on a somewhat different server setup) but not in production. The only changes

Selecting a directory on a local machine

2011-08-15 Thread ggavy
Hi, I have a django app running on a webfaction account. I want to be able to make use of a list of files that I hold locally on my own machine. Is there a way through forms to allow a user of the webapp to select a local directory on which files within this directory can then be uploaded? I

Re: 3rd party Apps in Django

2011-08-15 Thread Andre Lopes
Thanks for your replies.Now I understand the differences. Best Regards, On Mon, Aug 15, 2011 at 2:17 PM, william ratcliff wrote: > Generally, I tend to create a local cache of dependencies (ex. beautiful > soup, django-registration, etc.) and then use pip to install

Re: 3rd party Apps in Django

2011-08-15 Thread william ratcliff
Generally, I tend to create a local cache of dependencies (ex. beautiful soup, django-registration, etc.) and then use pip to install them to the python site-packages directory. The reason I use pip is because uninstall can be a pain. It's only when there are 3rd party apps that I need to

Re: 3rd party Apps in Django

2011-08-15 Thread william ratcliff
Yes--as I recalled from the documentation: *I’ve got functions listening for the registration/activation signals, but they’re not getting called!* The most common cause of this is placing django-registration in a sub-directory that’s on your Python import path, rather than installing it directly

Re: 3rd party Apps in Django

2011-08-15 Thread Thomas Weholt
Hmmm... Using pip will take care of requirements the package might have and install it in the right python lib folder so several projects can use it among other things. Are there good reasons NOT to use pip/easy_install or at least python setup.py install? Thomas On Mon, Aug 15, 2011 at 2:59

Re: 3rd party Apps in Django

2011-08-15 Thread william ratcliff
Someone else may want to confirm this, but were there any issues with signals depending on location within the project? Best, William On Mon, Aug 15, 2011 at 9:02 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Personally, I don't rely on easy_install/pip

Re: 3rd party Apps in Django

2011-08-15 Thread Cal Leeming [Simplicity Media Ltd]
Personally, I don't rely on easy_install/pip to install project specific packages into the OS site-packages. There is absolutely nothing stopping you from doing this on a project level, as I would recommend to do it where ever possible. Although do remember, some packages won't be cross-system

3rd party Apps in Django

2011-08-15 Thread Andre Lopes
Hi, I have put this question in StackOverflow, but no response untill now... This is an important question to me to understand how Django works I am new to Django. I have some doubts about installing 3rd party Apps in Django. A specific example. The "django-registration" App in

Re: showing an attribute of a foreign key in admin

2011-08-15 Thread Karen Tracey
On Mon, Aug 15, 2011 at 4:51 AM, i...@webbricks.co.uk wrote: > > I want to display the Level of the Category that the product belongs > to, in the admin page for the Product. snipped a lot of the > unimportant fields out of the display below. > > class

Nested serialization of model instances

2011-08-15 Thread Christo Buschek
Hi list, I'm busy writing a custom json serializer for django. It works very good, only now I want to serialize ForeignKey and M2M relations inside the same serialization call and build nested json objects with all model instances that the current model instance relates to. {'field_a': 'value',

Re: Authentication App to use?

2011-08-15 Thread Andre Lopes
Thanks for the reply. Django-Registration (http://djangopackages.com/packages/p/django-registration/) have the Social Auth (Google, Yahoo, OpenId, etc)? Best Regards, On Mon, Aug 15, 2011 at 10:11 AM, Reinout van Rees wrote: > On 15-08-11 11:01, Andre Lopes wrote: >> >>

Re: showing an attribute of a foreign key in admin

2011-08-15 Thread Daniel Roseman
I've answered your query there: http://stackoverflow.com/questions/7009010/how-to-display-an-attribute-of-a-foreign-key-in-django-admin-page/7063318#7063318 -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the

Re: Authentication App to use?

2011-08-15 Thread Reinout van Rees
On 15-08-11 11:01, Andre Lopes wrote: My question. There are others Apps I can research to take a decision on what App should I use? A handy list: http://djangopackages.com/grids/g/authentication/ Reinout -- Reinout van Reeshttp://reinout.vanrees.org/

Authentication App to use?

2011-08-15 Thread Andre Lopes
Hi, I am new to Django, and I have been reading about authentication and authorization in Django. Due to the complexity of this subject I was thinking to use a 3rd party developed App for this. I have found this App: https://github.com/pennersr/django-allauth My question. There are others Apps I

showing an attribute of a foreign key in admin

2011-08-15 Thread i...@webbricks.co.uk
copied and pasted from stackoverflow, since i didnt get an answer in a week and i just can't believe its not possible. I want to display the Level of the Category that the product belongs to, in the admin page for the Product. snipped a lot of the unimportant fields out of the display below.

custom template tag. success message after form-submit in the same .html file

2011-08-15 Thread doniyor
Hi There, I am heading well now, but have still some confusing things here.. this is my html file, where i want to get a success message after the form is submitted: __ {% load forms %} {% if submitted %}

Re: ANN: django-socketio 0.1.0 released

2011-08-15 Thread francescortiz
Looks really good. Thank you. On Aug 13, 6:06 am, Stephen McDonald wrote: > Hi all, > > Our Django Dash entryhttp://drawnby.jupo.orgmade extensive use of > Socket.IO (cross-browser websockets) and born out of that I've created a new > django-socketio package which is now

[ANN]: FeinCMS v1.4.0 final

2011-08-15 Thread Matthias Kestenholz
Hello everyone FeinCMS v1.4.0 has been released this morning and is available from usual places. The differences to v1.4.0.rc1 are a small (cosmetic) bugfix and documentation updates. Please note that the official repository has been moved to the feincms organization on github and does not live