[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 in my personal account anymore.

Development of 1.5 has started already. FeinCMS 1.4 will be the last
release supporting Django 1.2.




What is FeinCMS anyway?
===


FeinCMS is one of the most advanced Content Management Systems built on top
of Django. FeinCMS not only includes a page module with many bundled content
types (plugins), a media library and up-to-date documentation but also the
tools to build your own CMS if our view of how a page CMS is supposed to
act like does not fit your requirements.


PyPI: http://pypi.python.org/pypi/FeinCMS/
Github: https://github.com/feincms/feincms/
Docs: http://www.feinheit.ch/media/labs/feincms/

Please report any issues you find in the issue tracker of github:
https://github.com/feincms/feincms/issues


This release would not have been possible without the contributions by the
community. Thanks for all the patches, bug reports and ideas which went into
this release.




=
FeinCMS 1.4 release notes
=

* FeinCMS supports more than one site from the same database with
  ``django.contrib.sites`` now. Thanks to Bojan Mihelac and Stephen Tyler
  for the work and insistence on this issue.

* It is possible to customize the administration model inline used for
  content types. This means that it's possible to customize more aspects
  of content type editing and to reuse more behaviors from Django itself,
  such as ``raw_id_fields``.

* FeinCMS has gained support for ``django-reversion``.

* Reusing the media library in your own content types has become much
  easier than before. When using a
  ``feincms.module.medialibrary.fields.MediaFileForeignKey`` instead of
  the standard ``django.db.models.ForeignKey`` and adding the media file
  foreign key to ``raw_id_fields``, you get the standard Django behavior
  supplemented with a thumbnail if the media file is an image. This requires
  the next feature too, which is...

* Custom ``InlineModelAdmin`` classes may be used for the content types now
  by adding a ``feincms_item_editor_inline`` attribute to the content type
  specifying the inline class to be used.

* New projects should use ``feincms.content.medialibrary.v2.MediaFileContent``
  instead of ``feincms.content.medialibrary.models.MediaFileContent``. The
  argument ``POSITION_CHOICES`` and the corresponding field have been
  renamed to ``TYPE_CHOICES`` and ``type`` because that's a more fitting
  description of the intended use. The old and the new media file content
  should not be mixed; the hand-woven ``raw_id_fields`` support of the
  old media file content was not specific enough and interferes with
  Django's own ``raw_id_fields`` support.

* FeinCMS has gained a preview feature for pages which shouldn't be
  accessible to the general public yet. Just add the following line
  above the standard FeinCMS handler::

  url(r'', include('feincms.contrib.preview.urls')),

  Another button will be automatically added in the page item editor.


Apart from all these new features a few cleanups have been made:

* FeinCMS 1.2 removed the CKEditor-specific rich text content in favor of a
  generalized rich text content supporting different rich text editors.
  Unfortunately the documentation and the available settings only reflected
  this partially. This has been rectified. Support for ``TINYMCE_JS_URL``,
  ``FEINCMS_TINYMCE_INIT_TEMPLATE`` and ``FEINCMS_TINYMCE_INIT_CONTEXT`` has
  been completely removed. The two settings ``FEINCMS_RICHTEXT_INIT_CONTEXT``
  and ``FEINCMS_RICHTEXT_INIT_TEMPLATE`` should be used instead. See the
  :ref:`contenttypes` documentation for more details.

* The two settings ``FEINCMS_MEDIALIBRARY_ROOT`` and
  ``FEINCMS_MEDIALIBRARY_URL`` have been removed. Their values always
  defaulted to ``MEDIA_ROOT`` and ``MEDIA_URL``. The way they were used
  made it hard to support other storage backends in the media library.
  If you still need to customize the storage class used in the media
  library have a look at ``MediaFile.reconfigure``.

* Support for the ``show_on_top`` option for the ``ItemEditor`` has been
  completely removed. This functionatliy has been deprecated since 1.2.

* A few one-line Page manager methods which were too similar to each other
  have been deprecated. They will be removed in the next release of FeinCMS.
  This concerns ``page_for_path_or_404``, ``for_request_or_404``,
  ``best_match_for_request`` and ``from_request``. The improved
  ``for_request`` method should cover all bases.

* A few page methods have been deprecated. This concerns ``active_children``,
  ``active_children_in_navigation`` and ``get_siblings_and_self``. The useful
  bits are already avail

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 available:
>
> Github:https://github.com/stephenmcd/django-socketio
> Bitbucket:https://bitbucket.org/stephenmcd/django-socketio
> PyPI:http://pypi.python.org/pypi/django-socketio/
>
> Here's an overview from the docs:
>
> django-socketio is a BSD licensed Django application that brings together a
> variety of features that allow you to use WebSockets seamlessly with any
> Django project. django-socketio was inspired by Cody Soyland's introductory
> blog post on using Socket.IO and gevent with Django, and made possible by
> the work of Jeffrey Gelens' gevent-websocket and gevent-socketio
> packages. The features provided by django-socketio are:
>
> - Installation of required packages from PyPI
> - A management command for running gevent's pywsgi server with
> auto-reloading capabilities
> - A channel subscription and broadcast system that extends Socket.IO
> allowing WebSockets and events to be partitioned into separate concerns
> - A signals-like event system that abstracts away the various stages of a
> Socket.IO request
> - The required views, urlpatterns, templatetags and tests for all the above
>
> Cheers,
> Steve
>
> --
> Stephen McDonaldhttp://jupo.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 %}
{{ success }}
{% else %}
 
{% endif %}
Clear cache:  Cache leeren 

-
this is my def  in templatetags folder:

success = 'Cache erfolgreich geleert'

def submitted(self):
if request.method == 'GET':
return True

register.tag('submitted', submitted)





BUT i dont see anything after submission of the form. where is my
mistake, can you please help ?,

thanks in advance..

Doni

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.

class Category(models.Model):
name = models.CharField(max_length=50, default=False)
level = models.IntegerField(help_text="1, 2 ,3 or 4")

class Product(models.Model):
category = models.ForeignKey(Category)
name = models.CharField(max_length=100)


prepopulated_fields = {'slug': ('name',)}
fieldsets = [
('Product Info',{'fields': ['name',
'slug','partno','description']}),
('Categorisation',{'fields': ['brand','category']}),


obviously i've tried a little to get this working and googled a lot,
but i've found reference to list_filter lots, but nothing about just
showing the field. best guess was
'category__level' inside the fieldset as a field, but that didnt work.

anyone know the right way to do this?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 can research to take a decision
on what App should I use?

Best Regards,

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 web visit 
https://groups.google.com/d/msg/django-users/-/jPKRT15bUrQJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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:
>>
>> 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 Rees                    http://reinout.vanrees.org/
> rein...@vanrees.org             http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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',
 'field_b': 'value',
 'field_c': { <-- Nest Foreign Keys
'field_d': 'value',
'field_e': 'value',
 },
 'field_f': [ <-- Nest M2M
{'field_g': 'value'},
{'field_h': 'value'}
 ]
}

I found https://code.djangoproject.com/ticket/4656 that discusses this
problem, but, from what I understood, is not offering a clean solution yet.

So I actually have 2 questions:

1) Is there an "common way" how people do that? I'm sure other people
were doing thesame thing already. I found
http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers that
seems to do exactly this, but if possible I prefer not to use another
3rd party dependency.

2) I found 'a way' where I iterate through each field of the model and
test the field in the following way:

 if type(a._meta.get_field('field_c')) == models.ForeignKey:
 # follow relation and serialize it

Now is it a smart idea to access the model option with _meta, or can I
expect this not to work anymore with the next django release?

Any hint or input is appreciated.

greetinx
crito

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Category(models.Model):
>name = models.CharField(max_length=50, default=False)
>level = models.IntegerField(help_text="1, 2 ,3 or 4")
>
> class Product(models.Model):
>category = models.ForeignKey(Category)
>name = models.CharField(max_length=100)
>
>
>prepopulated_fields = {'slug': ('name',)}
>fieldsets = [
>('Product Info',{'fields': ['name',
> 'slug','partno','description']}),
>('Categorisation',{'fields': ['brand','category']}),
>
>
> You can do this so long as you only want to display the level, and not
change it from the Product edit page. Admin was not designed to allowed
editing of related-model attributes so you cannot do that. But with readonly
fields you can easily display information:

1 - Define a method on Product that returns the information you want, eg:

def category_level(self):
try:
return u'%s' % self.category.level
except Category.DoesNotExist:
return u'No Category'

(You need to allow for Category not existing since it will not exist on an
add page.)

2 - Include that method in readonly_fields and wherever you want it in your
fieldsets, eg:

class ProductAdmin(admin.ModelAdmin):
   readonly_fields = ['category_level']
   fieldsets = [
   ('Product Info',{'fields': ['name', etc etc etc ]}),
   ('Categorisation',{'fields': ['category', 'category_level']}),
]

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
https://bitbucket.org/ubernostrum/django-registration/src. Reading the
instructions the doc tell us to install this app with PIP(pip install
django-registration), doing this the App will be installed in Python
Site-packages, right?

My question is: The App must to be installed in that way? Why not put
the 'django-registration' folder in our Project as an App?

PS: This is a starter Django Question.

Best Regards,

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 compatible (such
as MySQL-python).

Cal

On Mon, Aug 15, 2011 at 1:59 PM, Andre Lopes  wrote:

> 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
> https://bitbucket.org/ubernostrum/django-registration/src. Reading the
> instructions the doc tell us to install this app with PIP(pip install
> django-registration), doing this the App will be installed in Python
> Site-packages, right?
>
> My question is: The App must to be installed in that way? Why not put
> the 'django-registration' folder in our Project as an App?
>
> PS: This is a starter Django Question.
>
> Best Regards,
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 compatible (such
> as MySQL-python).
>
> Cal
>
> On Mon, Aug 15, 2011 at 1:59 PM, Andre Lopes wrote:
>
>> 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
>> https://bitbucket.org/ubernostrum/django-registration/src. Reading the
>> instructions the doc tell us to install this app with PIP(pip install
>> django-registration), doing this the App will be installed in Python
>> Site-packages, right?
>>
>> My question is: The App must to be installed in that way? Why not put
>> the 'django-registration' folder in our Project as an App?
>>
>> PS: This is a starter Django Question.
>>
>> Best Regards,
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 PM, Andre Lopes  wrote:
> 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
> https://bitbucket.org/ubernostrum/django-registration/src. Reading the
> instructions the doc tell us to install this app with PIP(pip install
> django-registration), doing this the App will be installed in Python
> Site-packages, right?
>
> My question is: The App must to be installed in that way? Why not put
> the 'django-registration' folder in our Project as an App?
>
> PS: This is a starter Django Question.
>
> Best Regards,
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 onto the import path as normal. Importing from django-registration
in that case can cause various issues, including incorrectly connecting
signal handlers. For example, if you were to place django-registration
inside a directory named django_apps, and refer to it in that manner, you
would end up with a situation where your code does this:

from django_apps.registration.signals import user_registered

But django-registration will be doing:

from registration.signals import user_registered

>From Python’s point of view, these import statements refer to two different
objects in two different modules, and so signal handlers connected to the
signal from the first import will not be called when the signal is sent
using the second import.

To avoid this problem, follow the standard practice of installing
django-registration directly on your import path and always referring to it
by its own module name: registration (and in general, it is always a good
idea to follow normal Python practices for installing and using Django
applications).


On Mon, Aug 15, 2011 at 9:07 AM, william ratcliff <
william.ratcl...@gmail.com> wrote:

> 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 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 compatible (such
>> as MySQL-python).
>>
>> Cal
>>
>> On Mon, Aug 15, 2011 at 1:59 PM, Andre Lopes wrote:
>>
>>> 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
>>> https://bitbucket.org/ubernostrum/django-registration/src. Reading the
>>> instructions the doc tell us to install this app with PIP(pip install
>>> django-registration), doing this the App will be installed in Python
>>> Site-packages, right?
>>>
>>> My question is: The App must to be installed in that way? Why not put
>>> the 'django-registration' folder in our Project as an App?
>>>
>>> PS: This is a starter Django Question.
>>>
>>> Best Regards,
>>>
>>> --
>>> 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
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>>
>>  --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
modify (which I try to avoid :p) that I include them in an "external_apps"
folder under the project directory.   I suppose some of this is a matter of
personal preference.  I use pip instead of easy_install because it keeps a
record of which packages are installed and allows for uninstall. You
might also want to investigate virtual-env.   I think the main goal for me
is to try to keep things as decoupled as possible and to keep packages
locally in case their source somehow vanishes online, or if I depend on the
particulars of a given version...

Best,
William

On Mon, Aug 15, 2011 at 9:11 AM, Thomas Weholt wrote:

> 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 PM, Andre Lopes 
> wrote:
> > 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
> > https://bitbucket.org/ubernostrum/django-registration/src. Reading the
> > instructions the doc tell us to install this app with PIP(pip install
> > django-registration), doing this the App will be installed in Python
> > Site-packages, right?
> >
> > My question is: The App must to be installed in that way? Why not put
> > the 'django-registration' folder in our Project as an App?
> >
> > PS: This is a starter Django Question.
> >
> > Best Regards,
> >
> > --
> > 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
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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
> modify (which I try to avoid :p) that I include them in an "external_apps"
> folder under the project directory.   I suppose some of this is a matter of
> personal preference.  I use pip instead of easy_install because it keeps a
> record of which packages are installed and allows for uninstall.     You
> might also want to investigate virtual-env.   I think the main goal for me
> is to try to keep things as decoupled as possible and to keep packages
> locally in case their source somehow vanishes online, or if I depend on the
> particulars of a given version...
> Best,
> William
>
> On Mon, Aug 15, 2011 at 9:11 AM, Thomas Weholt 
> wrote:
>>
>> 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 PM, Andre Lopes 
>> wrote:
>> > 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
>> > https://bitbucket.org/ubernostrum/django-registration/src. Reading the
>> > instructions the doc tell us to install this app with PIP(pip install
>> > django-registration), doing this the App will be installed in Python
>> > Site-packages, right?
>> >
>> > My question is: The App must to be installed in that way? Why not put
>> > the 'django-registration' folder in our Project as an App?
>> >
>> > PS: This is a starter Django Question.
>> >
>> > Best Regards,
>> >
>> > --
>> > 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
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 have seen people make reference to uploadify, but was
wondering if there wasn't a simpler way?

Thanks in advance,
G

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 I've made between versions are to wrap any help text
for each model field in ugettext_lazy.

I've googled, and the only suggestion I've found is that the
__unicode__ methods of the models might be throwing errors -- I tested
them on the command line, on those specific objects, and everything
was fine.

Below are the (simplified) models and admins.  Since I can't reproduce
the problem in staging, can anyone suggest where to start in terms of
tracking down what's going wrong without disrupting production?

Thanks!
Nan


### models.py
class Zone(models.Model):
name = models.CharField(max_length=100)
...

def __unicode__(self):
return self.name
...


class MyThing(models.Model):
ticket = models.ForeignKey('Ticket', related_name='played_zones')
zone = models.ForeignKey(Zone)
...

objects = MyThingManager()

def __unicode__(self):
return u'%s / %s' % (self.ticket, self.zone)
...



class Ticket(models.Model):
activation_code = models.CharField(max_length=64, unique=True,
help_text=_l('Max length 64 characters for a regular ticket; 30
characters for demo ticket.'))
...

objects = TicketManager()

def __unicode__(self):
return self.activation_code
...


### admin.py
class MyThingInline(admin.TabularInline):
model = MyThing
extra = 0

class TicketAdmin(admin.ModelAdmin):
inlines = [MyThingInline,]
save_as = True
...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 couldn't find anything 
> about such cases. 
>
> Greetings,


You can use the `extra()` model manager method to include extra calculated 
fields in your queries.

I would say though that if you're just doing simple calculations, you're not 
really gaining anything by doing them in the database. It's just as easy to 
create a model method that returns the calculated value, which you can call 
as necessary.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ON4AWP51xv0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/NahgPWFQ9_oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 production.

The only changes I've made between versions are to wrap any help text
for each model field in ugettext_lazy.


My guess is that there is an import error somehow in the admin.py 
(assuming you've put that in a different file from your models.py).


So could you try importing "yourproject.admin" from "manage.py shell"?


Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 want to get a success message after the
> form is submitted:
>
> __
> 
>         {% load forms %}
>         {% if submitted %}
>                 {{ success }}
>         {% else %}
>              
>         {% endif %}
>         Clear cache:  Cache leeren  a>
> 
> -
> this is my def  in templatetags folder:
> 
> success = 'Cache erfolgreich geleert'
>
> def submitted(self):
>     if request.method == 'GET':
>         return True
>
> register.tag('submitted', submitted)
> 
>
> BUT i dont see anything after submission of the form. where is my
> mistake, can you please help ?,
>
> thanks in advance..
>
> Doni

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 browser the ModelFormSet throws a
ValidationError: [u'ManagementForm data is missing or has been
tampered with'] when we try to save the Ticket.)

Thanks for your suggestions!


On Aug 15, 11:29 am, Reinout van Rees  wrote:
> 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 production.
>
> > The only changes I've made between versions are to wrap any help text
> > for each model field in ugettext_lazy.
>
> My guess is that there is an import error somehow in the admin.py
> (assuming you've put that in a different file from your models.py).
>
> So could you try importing "yourproject.admin" from "manage.py shell"?
>
> Reinout
>
> --
> Reinout van Rees                    http://reinout.vanrees.org/
> rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> "If you're not sure what to do, make something. -- Paul Graham"

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, 8:27 pm, Lee  wrote:
> Is there an easy way to change "Auth" to "My Authentication App Name"
> in index.html? I tried changing {{ name }} to
> {{ string.replace(name,'Auth','My Authentication App Name') }} but it
> just kills the label completely -- hopefully just a syntax problem.
>
> How about changing the order that the models are list in on this page?
>
> Thanks for any help or ideas.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Log(models.Model):
person  = models.ForeignKey(Person)
action   = models.CharField()
time = models.DateTimeField()


I have a dictionary, and would like it to be saved to database

d = {
'person':{'name':'Joe', 'title':'Boss'},
'action':'Got to work',
'time':'2011-01-01 14:00'
}

if I do:
Log(**d)

I get error message:
Cannot assign "'person':{'name':'Joe', 'title':'Boss'}": "Log.person"
must be a "Person" instance.

How can I get django to understand that I want it to convert my
dictionary recursively? Then I want to full save it (the whole blob)
recursively, that is fields that are pointing to other models should
be saved first.


Thanks in advance

David


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 <
william.ratcl...@gmail.com> wrote:

> 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
> modify (which I try to avoid :p) that I include them in an "external_apps"
> folder under the project directory.   I suppose some of this is a matter of
> personal preference.  I use pip instead of easy_install because it keeps a
> record of which packages are installed and allows for uninstall. You
> might also want to investigate virtual-env.   I think the main goal for me
> is to try to keep things as decoupled as possible and to keep packages
> locally in case their source somehow vanishes online, or if I depend on the
> particulars of a given version...
>
> Best,
> William
>
>
> On Mon, Aug 15, 2011 at 9:11 AM, Thomas Weholt wrote:
>
>> 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 PM, Andre Lopes 
>> wrote:
>> > 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
>> > https://bitbucket.org/ubernostrum/django-registration/src. Reading the
>> > instructions the doc tell us to install this app with PIP(pip install
>> > django-registration), doing this the App will be installed in Python
>> > Site-packages, right?
>> >
>> > My question is: The App must to be installed in that way? Why not put
>> > the 'django-registration' folder in our Project as an App?
>> >
>> > PS: This is a starter Django Question.
>> >
>> > Best Regards,
>> >
>> > --
>> > 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
>> django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9J3zPpBG5iwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 of the templates (login.html,
registration_form.html, etc) I have must to search them on Goggle, and
I found out examples on how to do this templates
(http://www.lightbird.net/dbe/forum3.html).

My question is, there are any tutorial on Django-Registration that
will help a beginner like me to get this wonderful App working?

Best Regards,

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
Membership - $5000 / year10% off
all classes3 Free Indian Taco Meals1 Free House
RentalFree Parking Space During OU Football Games

Note that the form itself has the same identifier (id_1_MembershipForm-
membership_level_0) as the first RadioSelect option.  This breaks
accessibility for us (viewable at wave.webaim.org), and html
validation (at validator.w3.org).  I am well aware that I can take
care of this by writing my own html in the template, and that as_p,
as_ul, and as_table are really just for simple forms and/or
prototyping.  However, what I'm wondering is if there is a
"better" (read: solution that doesn't require me writing the html)
solution or a specific class/method to override that will correct this
behavior.  Or am I missing something else about this entirely?

Thanks,

Wayne

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 documentation of
third-party apps won't be so cryptic.

Thomas

On Mon, Aug 15, 2011 at 8:38 PM, Andre Lopes  wrote:
> 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 of the templates (login.html,
> registration_form.html, etc) I have must to search them on Goggle, and
> I found out examples on how to do this templates
> (http://www.lightbird.net/dbe/forum3.html).
>
> My question is, there are any tutorial on Django-Registration that
> will help a beginner like me to get this wonderful App working?
>
> Best Regards,
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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! I unfortunately use my own app, so I'll have to
pass.


Cheers,
AT

On Mon, Aug 15, 2011 at 3:53 PM, Thomas Weholt wrote:

> 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 documentation of
> third-party apps won't be so cryptic.
>
> Thomas
>
> On Mon, Aug 15, 2011 at 8:38 PM, Andre Lopes 
> wrote:
> > 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 of the templates (login.html,
> > registration_form.html, etc) I have must to search them on Goggle, and
> > I found out examples on how to do this templates
> > (http://www.lightbird.net/dbe/forum3.html).
> >
> > My question is, there are any tutorial on Django-Registration that
> > will help a beginner like me to get this wonderful App working?
> >
> > Best Regards,
> >
> > --
> > 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
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
> >
>
>
>
> --
> Mvh/Best regards,
> Thomas Weholt
> http://www.weholt.org
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, stdout=None, stderr=None)

while retcode == None:
retcode = process.poll()

if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -
retcode
elif retcode > 0:
print >>sys.stderr, "Child returned", retcode

except OSError, e:
print >>sys.stderr, "Execution failed:", e

return retcode

def proc_inv_file(request):
info_dict = {}

errors = []
inventory_file = ''
inventory_file_path = ''

if request.method == 'GET':
if not request.GET.get('inventory_file', ''):
errors.append('Please enter a valid inventory file name.')
else:
if not request.GET.get('inventory_file_path', ''):
errors.append('Please enter a valid inventory file
name path.')
else:
inventory_file = request.GET.get('inventory_file', '')
inventory_file_path =
request.GET.get('inventory_file_path', '')

cmd_line = "/home/amr/bin/invXfer.py " + " " +
inventory_file + " " + inventory_file_path
rc = exec_external_cmd(cmd_line)

If I run invXfer.py logged in as amr, it runs fine. From Django I get
an error, 1.

How can I launch an external program as the logged in user from
Django?

Thanks.
cmn

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 %}


  From geocoding


where {% url geocoding %} is the problem. When rendered it says:

TemplateSyntaxError at /admin/locationbase/location/
Caught NoReverseMatch while rendering: Reverse for '' with arguments
'()' and keyword arguments '{}' not found.

So the question is; how can I use the url template tag in templates
extending the standard admin templates and refer to a view defined in
my app by name?

What am I now seeing here?

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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/')

ftp_info = getFtpInfo(2, db)

ftp = FTP(ftp_info[0])
ftp.login(ftp_info[1], ftp_info[2])

if None == path:
ftp.cwd('/home/ics/amr')
else:
ftp.cwd(path)

avail_file_list = ftp.nlst()

for row in avail_file_list:
if filename == row:
ftp_cmd = 'RETR ' + row
ftp.retrbinary(ftp_cmd, open(row, 'wb').write)
file_list.append(row)
break

return file_list

I got more details after taking what the command line program did and
putting most of it into a new function in views.py.

def process_file_load(inventory_file, inventory_file_path):
my_cnf = '/home/amr' + '/.my.cnf'
db = connectToMysqlDBuc(my_cnf)

file_list = []
# dies here performing the ftp.
file_list = getInvRpt(2, inventory_file, inventory_file_path, db)

out_file = cvtInvData(file_list)

rc = truncateInvInTables(None)

rc = loadIncomingInvData(out_file)

total_items = []
items_processed = []
errors = []
load_rpt = []

rc = xferInvInData(total_items, items_processed, errors, db)

if 0 != rc:
load_rpt.append(("SQL Error: ", str(-1)))
print("SQL Error")

process_string = "Inventory items for processing: " +
str(len(total_items))
load_rpt.append((process_string, -1))

process_string = "Inventory items processed: " +
str(len(items_processed))
load_rpt.append((process_string, -1))

if 0 < len(errors):
process_string = "Inventory items processing errors: " +
str(len(errors))
load_rpt.append((process_string, -1))
load_rpt.append(("\n", str(-1)))

load_rpt.append(("Part Number", "Serial Number\n"))
load_rpt.append(("\n", str(-1)))

for row in errors:
load_rpt.append(row)

fp = open('/tmp/inv_rpt.txt', 'w')

for rpt_line in load_rpt:
if rpt_line[1] != str(-1) and rpt_line[1] != -1:
"""
This is kludgy, but appears to work on handling special
strings that are not
part of the inventory.
"""
if 15 <= len(rpt_line):
fixed_rpt_line = rpt_line[0] + ' ' + str(rpt_line[15])
+ '\n'
else:
fixed_rpt_line = str(rpt_line) + '\n'
else:
fixed_rpt_line = rpt_line[0] + ' ' + '\n'

fp.write(fixed_rpt_line)

fp.close()

fp = open('/tmp/inv_rpt.txt', 'r')
msg = MIMEText(fp.read())
fp.close()

this_day = datetime.today()
.
.
.



I believe it's hanging up on an ftp in one of the imported modules.


On Aug 15, 3:33 pm, wayne  wrote:
> 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.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 media

Any ideas or comments?

Django 1.3

Thanks
--Dave B

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Mon, Aug 15, 2011 at 3:06 PM, Andre Terra  wrote:

> 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! I unfortunately use my own app, so I'll have to
> pass.
>
>
> Cheers,
> AT
>
>
> On Mon, Aug 15, 2011 at 3:53 PM, Thomas Weholt wrote:
>
>> 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 documentation of
>> third-party apps won't be so cryptic.
>>
>> Thomas
>>
>> On Mon, Aug 15, 2011 at 8:38 PM, Andre Lopes 
>> wrote:
>> > 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 of the templates (login.html,
>> > registration_form.html, etc) I have must to search them on Goggle, and
>> > I found out examples on how to do this templates
>> > (http://www.lightbird.net/dbe/forum3.html).
>> >
>> > My question is, there are any tutorial on Django-Registration that
>> > will help a beginner like me to get this wonderful App working?
>> >
>> > Best Regards,
>> >
>> > --
>> > 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
>> django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>>
>>
>> --
>> Mvh/Best regards,
>> Thomas Weholt
>> http://www.weholt.org
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 though you are passing a callback command to your
ftp retrbinary() method that saves the file on your local filesystem
(as expected).  I would bet that your django instance does not have
permission to write to the directory that your server is trying to
save the file to.  If the command line program is working outside of
django, then the ftp setup is fine.  Test by setting the permissions
of the directory you are saving to to something like 777.  If it
works, that is your problem.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 inline_admin_formset.opts.template (admin/
edit_inline/tabular.html) and that the file exists and has global read
permissions.

Does that help at all with the diagnosis?


On Aug 15, 11:52 am, Nan  wrote:
> 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 browser the ModelFormSet throws a
> ValidationError: [u'ManagementForm data is missing or has been
> tampered with'] when we try to save the Ticket.)
>
> Thanks for your suggestions!
>
> On Aug 15, 11:29 am, Reinout van Rees  wrote:
>
>
>
>
>
>
>
> > 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 production.
>
> > > The only changes I've made between versions are to wrap any help text
> > > for each model field in ugettext_lazy.
>
> > My guess is that there is an import error somehow in the admin.py
> > (assuming you've put that in a different file from your models.py).
>
> > So could you try importing "yourproject.admin" from "manage.py shell"?
>
> > Reinout
>
> > --
> > Reinout van Rees                    http://reinout.vanrees.org/
> > rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> > "If you're not sure what to do, make something. -- Paul Graham"

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



(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 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 inline_admin_formset.opts.template (admin/
> edit_inline/tabular.html) and that the file exists and has global read
> permissions.
>
> Does that help at all with the diagnosis?
>
> On Aug 15, 11:52 am, Nan  wrote:
>
>
>
>
>
>
>
> > 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 browser the ModelFormSet throws a
> > ValidationError: [u'ManagementForm data is missing or has been
> > tampered with'] when we try to save the Ticket.)
>
> > Thanks for your suggestions!
>
> > On Aug 15, 11:29 am, Reinout van Rees  wrote:
>
> > > 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 production.
>
> > > > The only changes I've made between versions are to wrap any help text
> > > > for each model field in ugettext_lazy.
>
> > > My guess is that there is an import error somehow in the admin.py
> > > (assuming you've put that in a different file from your models.py).
>
> > > So could you try importing "yourproject.admin" from "manage.py shell"?
>
> > > Reinout
>
> > > --
> > > Reinout van Rees                    http://reinout.vanrees.org/
> > > rein...@vanrees.org            http://www.nelen-schuurmans.nl/
> > > "If you're not sure what to do, make something. -- Paul Graham"

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
Type "copyright", "credits" or "license()" for more information.
>>> import django
>>> django-admin.py startproject mysite
   ^
SyntaxError: invalid syntax
>>>

I've already made sure "C:\Python27\Lib\site-packages\django\bin" is
set to my system path settings, and django-admin.py is in bin.

What am I doing wrong?

Also, I haven't been able to cd. I've tried os.chdir(), but it says
'os' is not defined. In the Python docs it says that's supposed to
work on Windows machines, so is that not the right function for what
I'm trying to do?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 path.

The other question, about os.chdir; you'll have to import os before
calling methods defined in it, like so :

c:\python27\python
>>> import os
>>> os.chdir('c:\temp')

Hope this helps :-)

PS! It seems like your new to python as well. I strongly recommend you
dive into python first before getting into django.

Thomas

On Mon, Aug 15, 2011 at 11:54 PM, squirrel  wrote:
> 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
> Type "copyright", "credits" or "license()" for more information.
 import django
 django-admin.py startproject mysite
>                                               ^
> SyntaxError: invalid syntax

>
> I've already made sure "C:\Python27\Lib\site-packages\django\bin" is
> set to my system path settings, and django-admin.py is in bin.
>
> What am I doing wrong?
>
> Also, I haven't been able to cd. I've tried os.chdir(), but it says
> 'os' is not defined. In the Python docs it says that's supposed to
> work on Windows machines, so is that not the right function for what
> I'm trying to do?
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/xfaJGZITKWIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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/
>> https://docs.djangoproject.com/en/1.3/intro/tutorial02/

>>   https://docs.djangoproject.com/en/1.3/ref/models/relations/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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
> Type "copyright", "credits" or "license()" for more information.>>> import 
> django
> >>> django-admin.py startproject mysite
>
>                                                ^
> SyntaxError: invalid syntax

that's fine;  the django-admin.py  "command" is run from the command
line, not python shell.  :-)


> What am I doing wrong?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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] =
{
roll_no: {{content[x].roll_no}},
cell_no: {{content[x].cell_no}},
nationality:{{content[x].nationality}},
e_mail:{{content[x].e_mail}}

};
{% endfor %}


grid = new Slick.Grid("#myGrid", data, columns, options);

$("#myGrid").show();
})

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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] =
>                 {
>                     roll_no: {{content[x].roll_no}},
>                     cell_no: {{content[x].cell_no}},
>                     nationality:{{content[x].nationality}},
>                     e_mail:{{content[x].e_mail}}
>
>                 };
>                 {% endfor %}
>
>             grid = new Slick.Grid("#myGrid", data, columns, options);
>
>             $("#myGrid").show();
>         })

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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" which I eventually managed.
When I went to tackle a "manytomany" formfield for an 'inline' the
"admin" doco says "use 'formfield_for_manytomany' as usual, so I
created the approriate method in the 'inline' Class but it was never
invoked.
Numerous clever workarounds are given in the forums but I decided to
try using "formfield_for_manytomany" in the inline class. This works
brilliantly.
I guess the principle is that within the "through" model, the fields
are actually "foreignkey" fields, and the 'db_field.name' values
correspond to that model.

Here is a fragment of code where I cache the queryset for multiple
fields in the session dictionary.

#-
# use inline feature in Route for Points and Tracks
class PointsInline(TabularInline):
model = Route.points.through
extra = 0

class TracksInline(TabularInline):
def formfield_for_foreignkey( self,db_field, request, **kwargs):
if db_field.name == "track_id" or db_field.name == "point_id":
url_split = request.path.split('/')
route_id = url_split[-2]
try:
previous_id = request.session.get("RouteId")
except:
previous_id = None
if route_id <> previous_id :
print db_field.name, request.path, "\n"
request.session["RouteId"] = route_id
q_line =
Route.objects.get(id=route_id).from_signal.location.line
tq_set = Track.objects.filter(location__line=q_line)
request.session["TrackList"] = tq_set
pq_set = Point.objects.filter(location__line=q_line)
request.session["PointList"] = pq_set
print q_line, tq_set.count(), pq_set.count()
if db_field.name == "track_id":
q_set = request.session["TrackList"]
else:
q_set = request.session["PointList"]
kwargs["queryset"] = q_set
return super(TracksInline,
self).formfield_for_foreignkey(db_field, request, **kwargs )
else:
return None
model = Route.tracks.through
extra = 0

class RouteAdmin(ModelAdmin):
inlines = [ PointsInline, TracksInline ]
list_per_page = 48
list_display =
('__unicode__','from_signal','to_signal','direction')
list_filter= ('to_signal__location__line',)
exclude = ('tracks','points',)
search_fields =
('to_signal__location__vcode','from_signal__location__vcode',)
#-

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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}},
nationality:{{content[x].nationality}},
e_mail:{{content[x].e_mail}}

};
{% endfor %}
grid = new Slick.Grid("#myGrid", data, columns, options);
$("#myGrid").show();
})

and the error i get is

Exception Type: TemplateSyntaxError
Exception Value: Could not parse the remainder: '(len(content))' from
'range(len(content))'


Template error

In template d:\django-1.3\django\bin\onlinedemo\dbdemo\templates\db.html,
error at line 34
Could not parse the remainder: '(len(content))' from 'range(len(content))'

--


On Tue, Aug 16, 2011 at 4:50 AM, Konstantin Sushenko wrote:

> 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 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] =
> > {
> > roll_no: {{content[x].roll_no}},
> > cell_no: {{content[x].cell_no}},
> > nationality:{{content[x].nationality}},
> > e_mail:{{content[x].e_mail}}
> >
> > };
> > {% endfor %}
> >
> > grid = new Slick.Grid("#myGrid", data, columns, options);
> >
> > $("#myGrid").show();
> > })
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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)) %}

.. is not allowed --no python in django templates.

Do you have a sample (2 or 3 elements) showing how content is defined?
If content came from a query, this should work:

>{% for x in content %}
>                 data[i] =
>                 {
>                     roll_no: {{x.roll_no}},
>                     cell_no: {{x.cell_no}},
>                     nationality:{{x.nationality}},
>                     e_mail:{{x.e_mail}}
>                 };
>                 {% endfor %}

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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}},
nationality:{{content[0].nationality}},
e_mail:{{content[0].e_mail}}
};
grid = new Slick.Grid("#myGrid", data, columns, options);
$("#myGrid").show();
})


The final return in the view which calls the above templates is
return render_to_response("db.html",{'content':list})

and now i am getting the exception
Exception Value:
Could not parse the remainder: '[0].roll_no' from 'content[0].roll_no'

any ideas???

On Tue, Aug 16, 2011 at 4:58 AM, Landy Chapman wrote:

>
>
> 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)) %}
>
> .. is not allowed --no python in django templates.
>
> Do you have a sample (2 or 3 elements) showing how content is defined?
> If content came from a query, this should work:
>
> >{% for x in content %}
> > data[i] =
> > {
> > roll_no: {{x.roll_no}},
> > cell_no: {{x.cell_no}},
> > nationality:{{x.nationality}},
> > e_mail:{{x.e_mail}}
> > };
> > {% endfor %}
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 data = [];
>                 {% for x in content %}
>                 data[i] =
>                 {
>                     roll_no: {{x.roll_no}},
>                     cell_no: {{x.cell_no}},
>                     nationality:{{x.nationality}},
>                     e_mail:{{x.e_mail}}
>                 };
i +=1;
>                 {% endfor %}
>             grid = new Slick.Grid("#myGrid", data, columns, options);
>             $("#myGrid").show();
>         })
>
> and the error i get is
>
> Exception Type:     TemplateSyntaxError
> Exception Value:     Could not parse the remainder: '(len(content))' from
> 'range(len(content))'
>
> Template error
>
> In template d:\django-1.3\django\bin\onlinedemo\dbdemo\templates\db.html,
> error at line 34
> Could not parse the remainder: '(len(content))' from 'range(len(content))'
>
> --
>
> On Tue, Aug 16, 2011 at 4:50 AM, Konstantin Sushenko wrote:
>
>
>
>
>
>
>
> > 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 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] =
> > >                 {
> > >                     roll_no: {{content[x].roll_no}},
> > >                     cell_no: {{content[x].cell_no}},
> > >                     nationality:{{content[x].nationality}},
> > >                     e_mail:{{content[x].e_mail}}
>
> > >                 };
> > >                 {% endfor %}
>
> > >             grid = new Slick.Grid("#myGrid", data, columns, options);
>
> > >             $("#myGrid").show();
> > >         })
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 all model
> instances that the current model instance relates to.
>
> {'field_a': 'value',
>  'field_b': 'value',
>  'field_c': {             <-- Nest Foreign Keys
>    'field_d': 'value',
>    'field_e': 'value',
>  },
>  'field_f': [             <-- Nest M2M
>    {'field_g': 'value'},
>    {'field_h': 'value'}
>  ]
> }
>
> I found https://code.djangoproject.com/ticket/4656 that discusses this
> problem, but, from what I understood, is not offering a clean solution yet.
>
> So I actually have 2 questions:
>
> 1) Is there an "common way" how people do that? I'm sure other people
> were doing thesame thing already. I found
> http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers that
> seems to do exactly this, but if possible I prefer not to use another
> 3rd party dependency.

There isn't any way that I'd call sufficiently common to say that
everyone does it.

If you search the django-developers archives around July, there was a
proposal to improve Django's serializers [1]. I worked with Tom during
DjangoCon Europe to develop this API, and I think it's getting close
to being suitable for trunk. This effort covers a multitude of
requirements, including nested m2m relationships.

[1] 
http://groups.google.com/group/django-developers/browse_thread/thread/1f610a641b119456

> 2) I found 'a way' where I iterate through each field of the model and
> test the field in the following way:
>
>  if type(a._meta.get_field('field_c')) == models.ForeignKey:
>     # follow relation and serialize it
>
> Now is it a smart idea to access the model option with _meta, or can I
> expect this not to work anymore with the next django release?

The _meta block has a weird sort of "unofficially stable" status.
Technically, it isn't covered by our backwards compatibility
guarantee. However, there is so much code out there using it that if
we were to make any changes, it would cause a major upheaval in the
Django world, so in practice, it's not likely to change very much.
Formalizing the _meta API is something that is on the todo list.

As a rough rule of thumb, the more "obvious" API points, the more
likely it is to be baked in as official when we get around to
formalizing. Calls like "get_field" are almost guaranteed to be stable
*

* Not a guarantee :-)

Yours,
Russ Magee %-)

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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   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 data = [];
> > {% for x in content %}
> > data[i] =
> > {
> > roll_no: {{x.roll_no}},
> > cell_no: {{x.cell_no}},
> > nationality:{{x.nationality}},
> > e_mail:{{x.e_mail}}
> > };
> i +=1;
> > {% endfor %}
> > grid = new Slick.Grid("#myGrid", data, columns, options);
> > $("#myGrid").show();
> > })
> >
> > and the error i get is
> >
> > Exception Type: TemplateSyntaxError
> > Exception Value: Could not parse the remainder: '(len(content))' from
> > 'range(len(content))'
> >
> > Template error
> >
> > In template d:\django-1.3\django\bin\onlinedemo\dbdemo\templates\db.html,
> > error at line 34
> > Could not parse the remainder: '(len(content))' from
> 'range(len(content))'
> >
> > --
> >
> > On Tue, Aug 16, 2011 at 4:50 AM, Konstantin Sushenko  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > 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 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] =
> > > > {
> > > > roll_no: {{content[x].roll_no}},
> > > > cell_no: {{content[x].cell_no}},
> > > > nationality:{{content[x].nationality}},
> > > > e_mail:{{content[x].e_mail}}
> >
> > > > };
> > > > {% endfor %}
> >
> > > > grid = new Slick.Grid("#myGrid", data, columns, options);
> >
> > > > $("#myGrid").show();
> > > > })
> >
> > > --
> > > 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
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 the object in the
database; the Python instance will still be around, and will still have data
in its fields.

but when i run this command
i get
[]
[]

so the python instance looses it's data. Is there another way to delete the
data from SQL while still being about to use it in Python?
because after i delete it, i need to serialize the data to JSON

Thanks
Kevin Anthony

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 template renderer will turn this (note quotes around
nationality and email):
> > $(function() {
>   i = 0;
> > var data = [];
> > {% for x in content %}
> > data[i] =
> > {
> > roll_no: {{x.roll_no}},
> > cell_no: {{x.cell_no}},
> > nationality: '{{x.nationality}}',
> > e_mail: '{{x.e_mail}}'
> > };
> i +=1;
> > {% endfor %}

into this:
 $(function() {
   i = 0;
 var data = [];

 data[i] =
 {
 roll_no: 1,
 cell_no: 1,
 nationality: 'nation 1',
 e_mail: 'email1'
 };
   i +=1;
 data[i] =
 {
 roll_no: 2,
 cell_no: 2,
 nationality: 'nation2',
 e_mail: 'email2'
 };
   i +=1;
 data[i] =
 {
 roll_no: 3,
 cell_no: 3,
 nationality: 'nation3',
 e_mail: 'email3'
 };
 i +=1;

My JS guy has left for the day... maybe someone else can help out.
Also the 'autoescaping' should be on, in case some nationality
contains a (')  Ex: "G'ermany"

HTH

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, since according to the
> documentation:
> Issues a SQL DELETE for the object. This only deletes the object in the
> database; the Python instance will still be around, and will still have data
> in its fields.
> but when i run this command
> i get
> []
> []
> so the python instance looses it's data. Is there another way to delete the
> data from SQL while still being about to use it in Python?
> because after i delete it, i need to serialize the data to JSON
> Thanks
> Kevin Anthony
>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

Hi Kevin,

It looks like you're calling delete on a queryset rather than
individual objects.  I think [i.delete() for i in object] would do
what you want, although I haven't tested it.

Colin

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 template renderer will turn this (note quotes around
> nationality and email):
>
> > > $(function() {
> >               i = 0;
> > >             var data = [];
> > >                 {% for x in content %}
> > >                 data[i] =
> > >                 {
> > >                     roll_no: {{x.roll_no}},
> > >                     cell_no: {{x.cell_no}},
> > >                     nationality: '{{x.nationality}}',
> > >                     e_mail: '{{x.e_mail}}'
> > >                 };
> >                     i +=1;
> > >                 {% endfor %}
>
> into this:
>  $(function() {
>                i = 0;
>              var data = [];
>
>                  data[i] =
>                  {
>                      roll_no: 1,
>                      cell_no: 1,
>                      nationality: 'nation 1',
>                      e_mail: 'email1'
>                  };
>                    i +=1;
>                  data[i] =
>                  {
>                      roll_no: 2,
>                      cell_no: 2,
>                      nationality: 'nation2',
>                      e_mail: 'email2'
>                  };
>                    i +=1;
>                  data[i] =
>                  {
>                      roll_no: 3,
>                      cell_no: 3,
>                      nationality: 'nation3',
>                      e_mail: 'email3'
>                  };
>                  i +=1;
>
> My JS guy has left for the day... maybe someone else can help out.
> Also the 'autoescaping' should be on, in case some nationality
> contains a (')  Ex: "G'ermany"
>
> HTH

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 example, I get something akin to the following:
>
> [snip]
> Note that the form itself has the same identifier (id_1_MembershipForm-
> membership_level_0) as the first RadioSelect option.
>

I found your post confusing; I think you have used the word "form" in
several places where you really mean "field". Yes, the rendering of a form
field with choices as a radio input, by default, sets the overall label for
the field to be "for" the first choice in the list. A set of radio buttons
is not a single input, rather it is one html input for each choice. Each
radio input has an individual label with text equal to the choice. In
addition the Django form field has a label with text that defaults to the
name of the field. There is no way in HTML to say a label is "for" a set of
inputs, so this overall field label is set to be for the first input element
in the list of choices


>  This breaks
> accessibility for us (viewable at wave.webaim.org), and html
> validation (at validator.w3.org).
>

Breaks accessibility how? Clicking on the overall field label is the same as
clicking on the label for the first choice...is that breaking accessibility?
I can see how that behavior might be non-obvious but I don't see that it is
"broken".

What HTML validation errors are you getting, and what HTML doctype are you
using? In a brief test of HTML from a page that uses a Django radio select
field rendered in this way I am not getting any validation errors from
validator.w3.org.

I am well aware that I can take
> care of this by writing my own html in the template, and that as_p,
> as_ul, and as_table are really just for simple forms and/or
> prototyping.  However, what I'm wondering is if there is a
> "better" (read: solution that doesn't require me writing the html)
> solution or a specific class/method to override that will correct this
> behavior.  Or am I missing something else about this entirely?
>

You haven't said what you would like to see instead. If you want no label at
all for the overall field you can pass an empty string as label on the form
field definition. If you do want the text of the label, but you don't want
it to be wrapped in the html label tag, then maybe you want a custom
RadioFieldRenderer. This is possible but not currently documented, ticket
#15244 has a patch with some how-to doc that you may find useful.

Karen
-- 
http://tracey.org/kmt/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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"
> type="text/css" media="screen" charset="utf-8" />
>          href="file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css"
> type="text/css" media="screen" charset="utf-8" />
>          href="file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css"
> type="text/css" media="screen" charset="utf-8" />
>
>          src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js";>
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js">
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js">
>
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js">
>          src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js">
>
>         
>         var grid;
>         var columns = [
>             {id:"title", name:"Title", field:"title"},
>             {id:"duration", name:"Duration", field:"duration"},
>             {id:"%", name:"% Complete", field:"percentComplete"},
>             {id:"start", name:"Start", field:"start"},
>             {id:"finish", name:"Finish", field:"finish"},
>             {id:"effort-driven", name:"Effort Driven", field:"effortDriven"}
>         ];
>
>         var options = {
>             enableCellNavigation: true,
>             enableColumnReorder: false
>         };
>
>         $(function() {
>             var data = [];
>             for (var i = 0; i < 500; i++) {
>                 data[i] = {
>                     title: "Task " + i,
>                     duration: "5 days",
>                     percentComplete: Math.round(Math.random() * 100),
>                     start: "01/01/2009",
>                     finish: "01/05/2009",
>                     effortDriven: (i % 5 == 0)
>                 };
>             }
>
>             grid = new Slick.Grid("#myGrid", data, columns, options);
>
>             $("#myGrid").show();
>         })
>
>         
>
>     
>
>     
>
>          
>         
>             
>                  style="width:600px;height:500px;display:none;">
>             
>         
>         
>
>     
> 
>
> however when i run it the proper way i.e run the server "manage.py
> runserver" and enter the url i just get a blank screen ?? Does anyone know
> why this happens??

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 form was made up of one
field, and I made the mistake when writing the post, mixing up the
two.

> Yes, the rendering of a form
> field with choices as a radio input, by default, sets the overall label for
> the field to be "for" the first choice in the list.

This is what I would like to be able to set dynamically.  I know I can
pass the auto_id or the prefix, but those seem to affect the label and
all the  options.

>
> >  This breaks
> > accessibility for us (viewable at wave.webaim.org), and html
> > validation (at validator.w3.org).
>
> Breaks accessibility how? Clicking on the overall field label is the same as
> clicking on the label for the first choice...is that breaking accessibility?
> I can see how that behavior might be non-obvious but I don't see that it is
> "broken".
>
> What HTML validation errors are you getting, and what HTML doctype are you
> using? In a brief test of HTML from a page that uses a Django radio select
> field rendered in this way I am not getting any validation errors from
> validator.w3.org.
>

The doctype is XHTML Transitional, and the validation error I am
getting on each of the options for the field is: "document type does
not allow element "ul" here; missing one of "object", "applet", "map",
"iframe", "button", "ins", "del" start-tag"

That error might have something to do with what I am doing, although
it appears to be entirely contained in the outputted code from
form.as_ul.  The more pressing and pertinent question (for me) is the
accessibility error from wave.webaim.org:

"ERROR: Multiple form labels.  A form element has two labels
associated with it."

> You haven't said what you would like to see instead. If you want no label at
> all for the overall field you can pass an empty string as label on the form
> field definition. If you do want the text of the label, but you don't want
> it to be wrapped in the html label tag, then maybe you want a custom
> RadioFieldRenderer. This is possible but not currently documented, ticket
> #15244 has a patch with some how-to doc that you may find useful.

What I would like the ability to set the field label to a value of my
choosing, as that is what allows the validator at webaim to "pass" my
html.  If this is not something that seems to affect anyone else, it
might be the best for me to write a custom renderer.  I appreciate the
response and the pointer to the ticket with some info, as I was poking
around this morning trying to see what piece of code (field, widget,
etc.?) to do on my own in order to enable this functionality.  I still
would appreciate it if you could try the validator at webaim and see
if you can replicate the error I see there (multiple lables for an
input; the default as you describe it), as I am most interested in
learning if this is a real problem, and I trust the community to
educate me ;)

Thanks,

Wayne

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 = RequestContext(request)" when you render the
template.  And you have to do this even if you don't need the
RequestContext for CSRF protection or any other reason.  In effect,
that means you have to include the RequestContext *every* time you
render a template (assuming every template contains a link to some
static file such as a CSS style sheet, a JavaScript file, an
about.html file, or whatever.  But requiring "context_instance =
RequestContext(request)" *every* time you render a template seems to
violate the DRY principle.  Is there some standard way to avoid this
repetition?  (I suppose I could write my own shortcut function
render_to_response_with_request_context that provides a thin wrapper
around render_to_response, but I'm hoping some standard solution
already exists.)  Sorry to be so long winded.

Rodney

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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, 10:34 pm, Rodney Topor  wrote:
> 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 = RequestContext(request)" when you render the
> template.  And you have to do this even if you don't need the
> RequestContext for CSRF protection or any other reason.  In effect,
> that means you have to include the RequestContext *every* time you
> render a template (assuming every template contains a link to some
> static file such as a CSS style sheet, a JavaScript file, an
> about.html file, or whatever.  But requiring "context_instance =
> RequestContext(request)" *every* time you render a template seems to
> violate the DRY principle.  Is there some standard way to avoid this
> repetition?  (I suppose I could write my own shortcut function
> render_to_response_with_request_context that provides a thin wrapper
> around render_to_response, but I'm hoping some standard solution
> already exists.)  Sorry to be so long winded.
>
> Rodney

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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
>
> [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, 10:34 pm, Rodney Topor  wrote:
>
>
>
> > 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 = RequestContext(request)" when you render the
> > template.  And you have to do this even if you don't need the
> > RequestContext for CSRF protection or any other reason.  In effect,
> > that means you have to include the RequestContext *every* time you
> > render a template (assuming every template contains a link to some
> > static file such as a CSS style sheet, a JavaScript file, an
> > about.html file, or whatever.  But requiring "context_instance =
> > RequestContext(request)" *every* time you render a template seems to
> > violate the DRY principle.  Is there some standard way to avoid this
> > repetition?  (I suppose I could write my own shortcut function
> > render_to_response_with_request_context that provides a thin wrapper
> > around render_to_response, but I'm hoping some standard solution
> > already exists.)  Sorry to be so long winded.
>
> > Rodney

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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  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"
> > type="text/css" media="screen" charset="utf-8" />
> >          > href="file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css"
> > type="text/css" media="screen" charset="utf-8" />
> >          > href="file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css"
> > type="text/css" media="screen" charset="utf-8" />
>
> >          > src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js";>
> >          > src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js">
> >          > src="file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js">
>
> >          > src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js">
> >          > src="file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js">
>
> >         
> >         var grid;
> >         var columns = [
> >             {id:"title", name:"Title", field:"title"},
> >             {id:"duration", name:"Duration", field:"duration"},
> >             {id:"%", name:"% Complete", field:"percentComplete"},
> >             {id:"start", name:"Start", field:"start"},
> >             {id:"finish", name:"Finish", field:"finish"},
> >             {id:"effort-driven", name:"Effort Driven", field:"effortDriven"}
> >         ];
>
> >         var options = {
> >             enableCellNavigation: true,
> >             enableColumnReorder: false
> >         };
>
> >         $(function() {
> >             var data = [];
> >             for (var i = 0; i < 500; i++) {
> >                 data[i] = {
> >                     title: "Task " + i,
> >                     duration: "5 days",
> >                     percentComplete: Math.round(Math.random() * 100),
> >                     start: "01/01/2009",
> >                     finish: "01/05/2009",
> >                     effortDriven: (i % 5 == 0)
> >                 };
> >             }
>
> >             grid = new Slick.Grid("#myGrid", data, columns, options);
>
> >             $("#myGrid").show();
> >         })
>
> >         
>
> >     
>
> >     
>
> >          
> >         
> >             
> >                  > style="width:600px;height:500px;display:none;">
> >             
> >         
> >         
>
> >     
> > 
>
> > however when i run it the proper way i.e run the server "manage.py
> > runserver" and enter the url i just get a blank screen ?? Does anyone know
> > why this happens??
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 Aug 16, 7:39 am, Landy Chapman  wrote:
> 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 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 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 django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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 
> athttp://groups.google.com/group/django-users/browse_thread/thread/8a50...
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-08-15 Thread Landy Chapman
>From what I can tell it's not your fault. have a look at:
  http://code.google.com/p/slickgrid/issues/detail?id=19

fix might be here
   http://drupal.org/node/1094054#comment-4825024

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-08-15 Thread Jirka Vejrazka
>> > ... I'm hoping some standard solution
>> > already exists.)  Sorry to be so long winded.

 Hi there,

   in older Django versions, you can use direct_to_template from
generic views to automatically use RequestContext. I'm using it to
save a line or two per view. Not a magic solution, but might help you
:)

  Just my 2 cents

Jirka

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-08-15 Thread Adam Zedan
okay going to error ansole of firefox here is what i got

Error: Slick is not defined
Source File: http://127.0.0.1:8000/db/
Line: 37

which is : grid = new Slick.Grid("#myGrid", data, columns, options);

and the warnings are
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css.

I think it cant link to those files when rendered or something... not
sure though ?? what do u guys think??

On Aug 16, 11:01 am, Landy Chapman  wrote:
> From what I can tell it's not your fault. have a look at:
>  http://code.google.com/p/slickgrid/issues/detail?id=19
>
> fix might be here
>    http://drupal.org/node/1094054#comment-4825024

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-08-15 Thread Jani Tiainen

Hi,

You can't (and you shouldn't) use file urls in your original source but 
should let the Django handle urls to them for you.


There is dedicated part about static file serving in documentation [1][2].

And if you really think that you're deploying your project to somewhere 
you really expect everyone to have same directory structure on their 
machines as you do? And even more, you think people really would 
appreciate browser to load arbitrary files from a filesystem? :)



[1] https://docs.djangoproject.com/en/1.3/howto/static-files/
[2] https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/

--

Jani Tiainen

On 08/16/2011 09:23 AM, Adam Zedan wrote:

okay going to error ansole of firefox here is what i got

Error: Slick is not defined
Source File: http://127.0.0.1:8000/db/
Line: 37

which is : grid = new Slick.Grid("#myGrid", data, columns, options);

and the warnings are
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.grid.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/slick.core.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery.event.drag-2.0.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/lib/jquery-1.4.3.min.js.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to file:///D:/Django-1.3/django/bin/SlickGrid/examples/examples.css.
Security Error: Content at http://127.0.0.1:8000/db/ may not load or
link to 
file:///D:/Django-1.3/django/bin/SlickGrid/css/smoothness/jquery-ui-1.8.5.custom.css.

I think it cant link to those files when rendered or something... not
sure though ?? what do u guys think??

On Aug 16, 11:01 am, Landy Chapman  wrote:

 From what I can tell it's not your fault. have a look at:
  http://code.google.com/p/slickgrid/issues/detail?id=19

fix might be here
http://drupal.org/node/1094054#comment-4825024




--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-08-15 Thread Adam Zedan
Thanks.. that what i just came across.
It seems firefox doesnt let u load static files
http://rubenlaguna.com/wp/2007/04/20/firefox-and-file-windows-unc-paths/


On Tue, Aug 16, 2011 at 11:43 AM, Jani Tiainen  wrote:

> Hi,
>
> You can't (and you shouldn't) use file urls in your original source but
> should let the Django handle urls to them for you.
>
> There is dedicated part about static file serving in documentation [1][2].
>
> And if you really think that you're deploying your project to somewhere you
> really expect everyone to have same directory structure on their machines as
> you do? And even more, you think people really would appreciate browser to
> load arbitrary files from a filesystem? :)
>
>
> [1] 
> https://docs.djangoproject.**com/en/1.3/howto/static-files/
> [2] 
> https://docs.djangoproject.**com/en/1.3/ref/contrib/**staticfiles/
>
> --
>
> Jani Tiainen
>
>
> On 08/16/2011 09:23 AM, Adam Zedan wrote:
>
>> okay going to error ansole of firefox here is what i got
>>
>> Error: Slick is not defined
>> Source File: http://127.0.0.1:8000/db/
>> Line: 37
>>
>> which is : grid = new Slick.Grid("#myGrid", data, columns, options);
>>
>> and the warnings are
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.grid.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.core.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery.**
>> event.drag-2.0.min.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery-1.4.**
>> 3.min.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.grid.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/slick.core.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery.**
>> event.drag-2.0.min.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/lib/jquery-1.4.**
>> 3.min.js.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/examples/**
>> examples.css.
>> Security Error: Content at http://127.0.0.1:8000/db/ may not load or
>> link to file:///D:/Django-1.3/django/**bin/SlickGrid/css/smoothness/**
>> jquery-ui-1.8.5.custom.css.
>>
>> I think it cant link to those files when rendered or something... not
>> sure though ?? what do u guys think??
>>
>> On Aug 16, 11:01 am, Landy 
>> Chapman>
>>  wrote:
>>
>>>  From what I can tell it's not your fault. have a look at:
>>>  
>>> http://code.google.com/p/**slickgrid/issues/detail?id=19
>>>
>>> fix might be here
>>>
>>> http://drupal.org/node/**1094054#comment-4825024
>>>
>>
>>
> --
> 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 django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Weird hyperlink issue with Office and Django authentication

2011-08-15 Thread Michel30
I have made a CMS-like application to store and retrieve documents
using Django 1.3, mysql and Apache.

One requirement was that only authenticated users could use it and
that after closing the browser the session should be expired.
So, I implemented an LDAP authentication backend, set the
"SESSION_EXPIRE_AT_BROWSER_CLOSE" to True and added an @login_required
decorator to functions that need it.
And it is working great, just like it should.

Until using one feature that involves clicking on a hyperlink that is
supposed to open a document within the application in a browser.
This again works perfectly with every browser (firefix, chrome, IE) in
several flavors of versions.
With working I mean the document view opens, and this is important, as
long as the user was already logged in to the application he/she
doesn't have to log in again.

It is working until trying this from any office (2000/2003)
application. Then suddenly logging in is required every time
regardless if an session exists or not.
I did some investigating and found that clicking a hyperlink in an
Office application triggers three requests, and it looks like the
first one is missing the session cookie.
Apache log for a hyperlink in Open office:

172.16.3.51 - - [15/Aug/2011:11:27:29 +0200] "GET /cgi-bin/DocDB/
ShowDocument?docid=20916&version=8 HTTP/1.1" 200 3603 "-" "Mozilla/5.0
(Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0"

and the same document from Word:

172.16.3.51 - - [15/Aug/2011:11:26:09 +0200] "GET /cgi-bin/DocDB/
ShowDocument?docid=20916&version=8 HTTP/1.1" 302 496 "-" "Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR
2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; .NET4.0C; .NET4.0E)"

172.16.3.51 - - [15/Aug/2011:11:26:09 +0200] "GET /login/?next=/
cgi-bin/DocDB/ShowDocument%3Fdocid%3D20916%26version%3D8 HTTP/1.1" 200
3269 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/
4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; .NET4.0C; .NET4.0E)"

172.16.3.51 - - [15/Aug/2011:11:26:10 +0200] "GET /login/?next=/
cgi-bin/DocDB/ShowDocument%3Fdocid%3D20916%26version%3D8 HTTP/1.1" 200
3278 "-" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/
5.0"

Note the different status '200 = OK'  for OO and '302 Found' for Word.
Also the length of the first returned object differ: 496 vs 3603.

I am not sure where to point the finger to, or how to proceed and
resolve it... So I'd appreciate some help a lot.
Thanks,
Michel

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.