Sunday, September 30, 2012

Re: Add your own template library

Hi,

Yes it do have __init__.py

I have created a simple project of template tags and have installed it as a python package with setup.py.

After which I am referring it into my website.

- Thanks for reply

On Monday, 1 October 2012 09:45:46 UTC+5:30, Laxmikant Gurnalkar wrote:
Hi Ashish,
Is there __init__.py in your templatetags directory ?

cheers
Laxmikant


On Mon, Oct 1, 2012 at 9:36 AM, Ashish Jain <ashishj...@gmail.com> wrote:
Hi,

I have created a custom template tags library which I would like to use across my application.
I referred this code snippet, http://djangosnippets.org/snippets/342/

but still when I refer the tag in my code as: {% load repeat %}.

It says 'repeat' is not a valid tag library, tried django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat

Any help would be appreciated.

- Thanks
Ashish

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



--
GlxGuru

--
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/-/I1f8NTaWQM4J.
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.

Tools - Slow in python django fw

Hi ,

We have converted our tools from php to django framework but tool performance is very slow compare to php .

Please let us what are things we have to do ...

Thanks,
Siva

--
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/-/7s9SZXW-TYUJ.
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.

How to force django.views.i18n.set_language to use cookies

Hi All.
Is there anyway to force django.views.i18n.set_language view to use
cookies rather than session (I need that enabled but just for the
admin not for my main app)?

Thanks in advance.

Ezequiel
http://flickrock.com/mikelpierre

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

Re: Add your own template library

Hi Ashish,
Is there __init__.py in your templatetags directory ?

cheers
Laxmikant


On Mon, Oct 1, 2012 at 9:36 AM, Ashish Jain <ashishjain.ash@gmail.com> wrote:
Hi,

I have created a custom template tags library which I would like to use across my application.
I referred this code snippet, http://djangosnippets.org/snippets/342/

but still when I refer the tag in my code as: {% load repeat %}.

It says 'repeat' is not a valid tag library, tried django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat

Any help would be appreciated.

- Thanks
Ashish

--
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/-/4AqRRolTYK0J.
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.



--
GlxGuru

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

Add your own template library

Hi,

I have created a custom template tags library which I would like to use across my application.
I referred this code snippet, http://djangosnippets.org/snippets/342/

but still when I refer the tag in my code as: {% load repeat %}.

It says 'repeat' is not a valid tag library, tried django.templatetags.repeat,django.contrib.staticfiles.templatetags.repeat

Any help would be appreciated.

- Thanks
Ashish

--
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/-/4AqRRolTYK0J.
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.

Re: django and mysql versions

On Sun, Sep 30, 2012 at 12:38 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> The main features that have been added to MySQL are views, triggers,
> stored procedures... And "prepared statements".

I beg to differ:

http://dev.mysql.com/doc/refman/5.0/en/create-view.html
http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html
http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html

all these features were already implemented in MySQL 5.0

As far as I can tell, none of these is used by MySQLdb, so it doesn't
make any difference. It would certainly be odd if it worked with 5.1
and not with 5.5

Note that recent Ubuntu distros install MySQL 5.5 by default. I guess
that if there was any problem with that, we would be innundated by bug
reports.

--
Javier

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

Re: model field not null

null=True is the opposite of what you are asking for anyway. You can
use null=False, and the column will be created with the database's
version of:

NOT NULL

Which is the postgres spelling.

This will prevent the database from allowing a database NULL from
being stored there.

But it will NOT prevent storing an empty string.

Assuming that your database supports it, you could write a "trigger"
or "constraint" that checks for non blank and fails the transaction
otherwise. But, in so far as I know, Django provides no help in
creating this constraint.

Bill

On Wed, Sep 26, 2012 at 4:47 PM, Jonas Geiregat <jonas@geiregat.org> wrote:
> Hello,
>
> While setting up a new model I'm trying to have a strong data model.
>
> One of the requirements is that a certain field cannot be null.
>
> lastname = models.CharField(
> blank=False,
> default=None,
> ..)
>
> I'm accomplishing this by the above code. This ensure that even on a database level lastname will not be NULL, by setting default to None.
>
> I'm aware that I can just use blank=False to ensure that on a form level it will never be allowed to be empty. But I want a strong, fully tested, business model from the beginning.
>
> As this is a CharField, according to the docs, I cannot use null=True since empty string will get stored as empty strings and not as NULL.
>
> Is this an appropriate way of modeling my models, or are there other solutions ?
>
> Regards,
>
> Jonas.
>
>
> --
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Making form label a href

> Is there some way to have the form label be a href?

you'll have to change the forms templates to something like

{% for field in form %}
<p>
<label for="{{ field.id_for_label }}"><a href="/your/path/">{{
field.label }}</a></label>
{{ field }}
</p>
{% endfor %}


--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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

Re: django and mysql versions

On Sun, 30 Sep 2012 13:14:08 -0700 (PDT), Elizabeth Rachel Lemon
<elemon3@gmail.com> declaimed the following in
gmane.comp.python.django.user:

>
> In this case, my reasons for asking about using MySQL 5.5 aren't really
> about wanting any features that are available only in 5.5, but more about a
> situation where the choice of MySQL version isn't entirely up to me. I'm
> hoping to avoid spending time configuring a development environment with
> this version only to find out that this actually doesn't work at all. So
> from your response I get that probably it would work.
>
And as I mention, UNLESS MySQL DELETED an API -- which is highly
unlikely -- you should not have any problem.

Heck, as an example of the significance of the API... MySQL was
forked when Oracle bought up Sun... The fork is called MariaDB -- and is
supposed to be a drop in replacement for MySQL. That means that
applications built against the MySQL client library are supposed to be
able to use MariaDB without changes (that includes MySQLdb). MariaDB
does not have the InnoDB back-end as Oracle also bought up Inno -- but
it has a licensed work-alike for InnoDB, along with a few other
back-ends that MySQL doesn't support. Back-ends aren't a concern of the
API (you specify them as text qualifiers in the SQL that gets sent to
MySQL/MariaDB when creating a table).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

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

Making form label a href

In an app I've inherited, there are forms generated with {{ form.as_p
}} in the template. This generates HTML like this, for example:

<div class="generated">
<p><label for="id_group">Group</label> <select name="group"
id="id_group" tabindex="1">
<option value="" selected="selected"></option>
<option value="1">12S</option>
<option value="2">13S</option>
<option value="3">22SOI</option>
</select></p>
</div>

Is there some way to have the form label be a href?

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

Re: django and mysql versions

Thanks for the response -- this is really useful information about what MySQL features new to version 5.5 are not handled by MySQLdb. 

In this case, my reasons for asking about using MySQL 5.5 aren't really about wanting any features that are available only in 5.5, but more about a situation where the choice of MySQL version isn't entirely up to me.  I'm hoping to avoid spending time configuring a development environment with this version only to find out that this actually doesn't work at all.  So from your response I get that probably it would work. 

Is there anyone out there who's actually tried it and knows from experience what will happen?  If not, I'll try it and update this thread with how it comes out. 



On Sunday, September 30, 2012 1:38:45 PM UTC-4, Dennis Lee Bieber wrote:
On Sun, 30 Sep 2012 09:18:49 -0700 (PDT), Elizabeth Rachel Lemon
<ele...@gmail.com> declaimed the following in
gmane.comp.python.django.user:

> Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and
> higher" seems to me to imply that this would work, but if MySQLdb is
> required for Django and MySQLdb only supports up to 5.1, then that implies
> that it is at least not supported. Anyone tried it?

        The main features that have been added to MySQL are views, triggers,
stored procedures... And "prepared statements".

        So far as I know, the only thing MySQLdb doesn't handle is the
"prepared statements" aspect -- it uses the query interface that is
common to all versions: it sends complete text queries. The main place
where the difference would be visible is if one does an .executemany().

        The common-to-all versions would issue multiple complete statements,
which need to be parsed and compiled by MySQL /each time/:

insert into thetable (f1, f2, f3) values (v11, v12, v13)
insert into thetable (f1, f2, f3) values (v21, v22, v23)
insert into thetable (f1, f2, f3) values (v31, v32, v33)

        Prepared statements would send a parameterized statement to MySQL to
be "compiled"

insert into thetable (f1, f2, f3) values (?1, ?2, ?3)

and then send the values separately, telling MySQL to use the already
compiled statement

stmtref, v11, v12, v13
stmtref, v21, v22, v23
stmtref, v31, v32, v33

        I'd find it highly unlikely that MySQL would have /removed/ some
portion of the API that would invalidate pre-existing application code.

--
        Wulfraed                 Dennis Lee Bieber         AF6VN
        wlf...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

--
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/-/qmkYEYLqjc4J.
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.

app for kickstarter-like goals

I'm developing a website for a non-profit organization.

They want something similar to kickstarter, only based on people instead of money.

Let's say there's an event. A birthday.

If 5 people preorder the ticket there will be a clown*
If 10 people preorder the ticket there will be a clown orchestra (in a small car)
il 100 people preorder the ticket there will be a golden statue of a clown.

I have no problem with the "buying tickets thing", but I couldn't find in django-packages anything related to milestones or goals.

Do you know if there is already something I can use? Or should I create it?

Thanks!

* if you hate clowns you can replace them with cookies

--
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/-/2y9biFnbiIUJ.
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.

Re: django and mysql versions

On Sun, 30 Sep 2012 09:18:49 -0700 (PDT), Elizabeth Rachel Lemon
<elemon3@gmail.com> declaimed the following in
gmane.comp.python.django.user:

> Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and
> higher" seems to me to imply that this would work, but if MySQLdb is
> required for Django and MySQLdb only supports up to 5.1, then that implies
> that it is at least not supported. Anyone tried it?

The main features that have been added to MySQL are views, triggers,
stored procedures... And "prepared statements".

So far as I know, the only thing MySQLdb doesn't handle is the
"prepared statements" aspect -- it uses the query interface that is
common to all versions: it sends complete text queries. The main place
where the difference would be visible is if one does an .executemany().

The common-to-all versions would issue multiple complete statements,
which need to be parsed and compiled by MySQL /each time/:

insert into thetable (f1, f2, f3) values (v11, v12, v13)
insert into thetable (f1, f2, f3) values (v21, v22, v23)
insert into thetable (f1, f2, f3) values (v31, v32, v33)

Prepared statements would send a parameterized statement to MySQL to
be "compiled"

insert into thetable (f1, f2, f3) values (?1, ?2, ?3)

and then send the values separately, telling MySQL to use the already
compiled statement

stmtref, v11, v12, v13
stmtref, v21, v22, v23
stmtref, v31, v32, v33

I'd find it highly unlikely that MySQL would have /removed/ some
portion of the API that would invalidate pre-existing application code.

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/

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

django and mysql versions

According to this page:
"Django supports MySQL 5.0.3 and higher."

But the next section says that MySQLdb is required, and when you click the link to MySQLdb from that page, it goes to this page:

which states that the supported versions are:
"MySQL versions from 3.23 to 5.1"

Is anyone using Django with MySQL 5.5? The page that says "5.0.3 and higher" seems to me to imply that this would work, but if MySQLdb is required for Django and MySQLdb only supports up to 5.1, then that implies that it is at least not supported. Anyone tried it?

--
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/-/gM8MX-Q3T9UJ.
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.

display thousand separator.

Hi list!

I'm having a localization issue. The thing is that I have an AdminForms that contains
a value field (wich is a model.BigInteger at the model ) and when the value is displayed
at the admin form I would like it to show the THOUSAND_SEPARATOR as configured
in setting.py. So this is what I've done

USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = True
THOUSAND_SEPARATOR = '.'
DECIMAL_SEPARATOR = ','

and then at the init method of my admin form I did this :

self.fields['value'].localize = True
self.fields['value'].is_localized = True

So now I can input for example:
5.000.000
but after saving it it shows
5000000

Any solutions besides doing some javascript tampering?

Thanks!


--
Nicolas Emiliani

Lo unico instantaneo en la vida es el cafe, y es bien feo.

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

non-root SCRIPT_NAME, mod_wsgi and RewriteRule

I have my Django website and my static files deployed under the same
directory (i.e. no separate 'static' directory), according to the
following Apache RewriteRule:

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^.*$ /django/$1 [QSA,PT,L]

WSGIScriptAlias /django/ /var/www/domain.com/django/site/wsgi.py

My site-wide urlconf looks like this:

urlpatterns = patterns('',
url(r'^blog/', include('blog.urls')),
url(r'', include('home.urls')),
)

With my app-specific urlconf ('home.urls') is simply this:

urlpatterns = patterns('home.views',
url(r'^(?P<uri>[a-z0-9-]+)/?$', 'page_by_uri'),
url(r'^$', 'index'),
)

So when I visit my site domain.com I should see the index view (which it
does), and when I visit domain.com/foo I should see the
page_by_uri('foo') view, *which it doesn't*. Instead, it shows the index
view. (And I thought it should give an error!)

Having surfed around a little bit, I reckon it's got something to do
with Django's handling of SCRIPT_NAME (which should be equal to the
mount point, in my case '/dj'). Various solutions are proposed,
generally involving adding the mount point to my urlconf (bad!) until I
tried it and it doesn't even work...

Basically, how in the name of all that is holy and sacred can I get this
to work?!

Thanks in advance

Saturday, September 29, 2012

Request for assistance from a Chinese Django user

Hi all,

I require some assistance from a Django user that lives in China.

For the last month, whenever someone posts to Django-users, they
receive a notification email from China Mobile.

These emails are caused by a django-users subscriber that is
forwarding their mail to another address. However, the address they're
forwarding to isn't able to accept mail.

If my research is correct, this number indicates that the individual
is a customer of China Mobile, and lives in Wuhan.

If you live in China, and would like to assist me in contacting this
user so we can unsubscribe them, please email me privately at
russell@keith-magee.com.

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

EntryAdmin.form does not inherit from BaseModelForm.

Hello,

I'm having a strange issue where I get the following exception on my production server, but have no issues on my dev machine:

Django Version:1.3.1
Exception Type:ImproperlyConfigured
Exception Value:
EntryAdmin.form does not inherit from BaseModelForm.
Exception Location:/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py in validate_base, line 292
Python Executable:/usr/local/bin/python
Python Version:2.7.3

I have narrowed the problem down to this area of the code:

class EntryAdminForm(forms.ModelForm):
class Meta:
model = Entry

latitude = CoordinateField()
longitude = CoordinateField()

class EntryAdmin(admin.ModelAdmin):
form = EntryAdminForm      ## COMMENT OUT THIS LINE MAKES THE PRODUCTION SERVER WORK ##
list_display = ('title', 'location', 'pub_date', 'type', 'blogger')
list_filter = ('blogger', 'pub_date', 'type')

I have hit a wall with this one and could use some inspiration. 
As mentioned above commenting out form = EntryAdminForm in EntryAdmin makes everything work fine

Below is more details on the error:
Environment:


Request Method: GET
Request URL: http://URL/admin/sail_blog/entry/120/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'sail_blog',
 'blog_redirect']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in resolve
  250.             for pattern in self.url_patterns:
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in _get_url_patterns
  279.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/cjfox/webapps/django_1_3_1/starship/django/core/urlresolvers.py" in _get_urlconf_module
  274.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/urls.py" in <module>
  5. admin.autodiscover()
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/__init__.py" in autodiscover
  26.             import_module('%s.admin' % app)
File "/home/cjfox/webapps/django_1_3_1/starship/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/cjfox/webapps/django_1_3_1/starship/sail_blog/admin.py" in <module>
  45. admin.site.register(Entry, EntryAdmin)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/sites.py" in register
  97.             validate(admin_class, model)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" in validate
  24.     validate_base(cls, model)
File "/home/cjfox/webapps/django_1_3_1/starship/django/contrib/admin/validation.py" in validate_base
  292.                 "BaseModelForm." % cls.__name__)

Exception Type: ImproperlyConfigured at /admin/sail_blog/entry/120/
Exception Value: EntryAdmin.form does not inherit from BaseModelForm.


--
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/-/GYzuwIcFQZsJ.
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.

Re: splitting up image loads from rest of page

On Fri, Sep 28, 2012 at 1:48 PM, Larry Martell <larry.martell@gmail.com> wrote:
> I have a template that creates a table that has clickable links. It
> also loads a bunch of images associated with each row in the table.
> Through javascript events, when the user mouses over certain fields,
> the images are displayed or hidden. Initially, all the images are not
> displayed
>
> When the page loads, the table is produced quickly, but then there's a
> period of time before you can click on the links or mouse over and see
> the images. How long that period of time is seems directly related to
> how many rows there are in the table, so I'm assuming that time is
> being spent loading the images. Would that be a correct assumption?
>
> Assuming my assumption is correct, is there a way I can some how split
> this up, so the clickable links work as soon as the table is rendered,
> without waiting for the images? Also, the client is asking for me to
> display '... loading images' which goes away once they are all loaded.
> Can anyone tell me how I could do that?

For the archives:

What I did was to move the code that handles the clickable links into
a $(document).ready block (it was in a window.onload block). This
seems to be working fine for me - the links are active before the
images are loaded.

For the other part of this task (display '... loading images' which
goes away once all the images are loaded), I created the text with
display: none, then when the page is created I show() it, and in the
window.onload function I hide it. This also seems to be working fine.

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

AW: Announcing DjangoNYC Office Hours

Hi, which time you will Run the hangout

Von meinem Xperia™ smartphone gesendet




-------- Originalnachricht --------
Betreff: Announcing DjangoNYC Office Hours
Von: Sean O'Connor <Sean.B.OConnor@gmail.com>
An: django-users@googlegroups.com
Cc:

Hello Everybody,

Tomorrow I'll be running a bit of an experiment on Google+.  The basic idea is that I'll be available on a Google Hangout for an hour or two tomorrow afternoon answering any Django questions that you might have.

If your interested in asking questions, join the hangout and ask away.  Otherwise, it might be interesting to just watch the hang out and see what you can learn from other people's questions.

You can join the office hours over at http://bit.ly/SauDRO.

If you have any questions, have any feedback, or run into any problems, please feel free to let me know.

Thanks!

____________________________

Sean O'Connor
http://seanoc.com

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

Announcing DjangoNYC Office Hours

Hello Everybody,

Tomorrow I'll be running a bit of an experiment on Google+.  The basic idea is that I'll be available on a Google Hangout for an hour or two tomorrow afternoon answering any Django questions that you might have.

If your interested in asking questions, join the hangout and ask away.  Otherwise, it might be interesting to just watch the hang out and see what you can learn from other people's questions.

You can join the office hours over at http://bit.ly/SauDRO.

If you have any questions, have any feedback, or run into any problems, please feel free to let me know.

Thanks!

____________________________

Sean O'Connor
http://seanoc.com

--
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/-/FpF0cRXZtg8J.
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.

select_related and use_for_related_field

I have a custom manager class that has use_for_related_field set to true, and I set it to be the default manager in my model.  But when I make a query using select_related on the related field, I seem to get a plain queryset, not my custom one.  Here's a quick sketch of what I'm doing:

class MyQuerySet(models.query.QuerySet):
    @property
    def foo(self):
        return self.filter(foo=True)

class MyManager(models.Manager):
    use_for_related_field = True

    def get_query_set(self):
        return MyQuerySet(self.model)

class Widget(models.Model):
    thingies = models.ManyToManyField(Thingy, related_name='widgets')
    objects = MyManager()

When I run this query:

Thingy.objects.select_related('widgets').foo

Django tells me that

AttributeError: 'QuerySet' object has no attribute 'foo'

Is this something I should expect to work?  I seem to have reached the thin edge of both documentation and discussions.

John

--
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/-/Aw6O25M_gNgJ.
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.

Re: Duplicate entry in database on refreshing the submitted form

As Tim said use "redirect" instead of "render". Alternatively on form submit you can also have some kind of validation for ex: Query for one reference_no can take place only once in 24 hours and if it is being submitted twice return an error message. This way it will be more user friendly. Also, you can add a "unique" field in your models to achieve this.


On Sat, Sep 29, 2012 at 5:43 PM, Satinderpal Singh <satinder.goraya91@gmail.com> wrote:
On Sat, Sep 29, 2012 at 5:22 PM, Timster <timshaffer00@gmail.com> wrote:
> After saving the form, instead of doing a render_to_response, you should
> redirect the user to another page.
Thanks Timster, it works!
--
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.




--
Thanks & Regards
----------------------------

Amyth [Admin - Techstricks]
Email - aroras.official@gmail.com, admin@techstricks.com
Twitter - @mytharora
http://techstricks.com/

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

Re: Duplicate entry in database on refreshing the submitted form

On Sat, Sep 29, 2012 at 5:22 PM, Timster <timshaffer00@gmail.com> wrote:
> After saving the form, instead of doing a render_to_response, you should
> redirect the user to another page.
Thanks Timster, it works!

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

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

Re: Duplicate entry in database on refreshing the submitted form

After saving the form, instead of doing a render_to_response, you should redirect the user to another page.

--
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/-/MrViZERB2J4J.
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.

Duplicate entry in database on refreshing the submitted form

I am using mysql database with my project, and made a user input form
with submit button. After submitting the form, it produces an html
output, If i again reload the output page it fills a duplicate entry
in the database. And on every refresh, it continues to add entries in
the database.
How will i prevent these duplicate entries on refreshing.

Here is the views of my code related to that form:
def header(request):
if request.method=='POST':
form = headForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
form.save()
zee = head.objects.aggregate(Max('id'))
mee =zee['id__max']
Head = head.objects.filter(id = mee)
return render_to_response('report/header.html',
{'Head':Head,},context_instance=RequestContext(request))

else:
form = headForm()
return render_to_response('report/report.html', {"form":form},
context_instance=RequestContext(request))

And the models are described as:
class head(models.Model):
refrence_no = models.CharField(max_length=255) #college
reference letter no.
dispatch_report_date = models.CharField(max_length=255) #report
dispatch date, to the client
date_of_testing = models.CharField(max_length=255) #date on
which test is performed
subject = models.CharField(max_length=255)
reference = models.CharField(max_length=255) #client reference letter no.
column_1 = models.CharField(max_length=255,blank=True)
column_2 = models.CharField(max_length=255,blank=True)
column_3 = models.CharField(max_length=255,blank=True)

def __str__(self):
return self.subject

class headForm(ModelForm):
class Meta :
model = head

Thanks in advance.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

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

Friday, September 28, 2012

Re: Django on Bluehost

I hate to be that guy but...

I was on Bluehost for a while but I just ended up deciding the benefits of switching to WebFaction far outweighed the benefits of staying on Bluehost as a Django user.

If you're interested in joining WebFaction or hearing more about it feel free to send me an e-mail at JZthr33@gmail.com and I can tell you more about it.

If you feel that it suits what you want to do better I would be happy if you listed me as an affiliate! (Which I can explain if the time comes)

See ya later.

JJ

On 09/24/2012 12:21 AM, Zach wrote:
Hey everyone,
I have recently been setting up a Django 1.4.1 project with python 2.7.2 and MySQL. I am using fcgi to deploy my project in this environment because mod_wsgi is not available through bluehost. After much frustration I have gotten my site up to display the "it works" page. Now for some strange reason I can not get it away from this page. I have set up the urls.py file for the main project along with adding my app into the Installed_Apps section of the settings.py file. 
My .htaccess file is the following
AddHandler fcgid-script .fcgi
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(adminmedia/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(mysite.fcgi)
RewriteRule ^(.*)$ mysite.fcgi/$1 [L]

My mysite.fcgi is the following
#!/home1/propesn4/python27/bin/python
import sys, os
sys.path.insert(0, "/home1/propesn4/python27")
os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
sys.path.append("/home1/propesn4/project/")
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

When I make changes to my django project I preform a touch mysite.fcgi so that the fcgi agent knows there has been changes.
If anyone could lead me in the right direction I would really appreciate it!

--
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/-/Aqyku-yyimsJ.
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.

Re: i am getting ConfigParser.NoSectionError: No section: 'database' plz help

ohh sorry I didnt checked, I thought it was the part of settings itself.

On Fri, Sep 28, 2012 at 10:06 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
Laxmikant Gurnalkar <laxmikant.gurnalkar@gmail.com> wrote:

> Thats the same I'm saying to you.
> In your settings.conf. There is no section named 'database'

Look again: there *is* a [database] section at the very bottom:

    [database]
    engine    : django.db.backends.mysql
    name      : kasakoo
    user      : root
    password  : password
    host      : localhost
    port      : 3306

Nick

> create a section in that file to store your database info.
> >>>>Check the file located at :
> os.path.join(PROJECT_PATH, 'settings.conf')
>
> On Fri, Sep 28, 2012 at 9:50 AM, Navnath Gadakh <navnathgadakh@gmail.com> wrote:
>
>     my setting.py is
>      and a have also created a new setting.conf .may be there is problem of path,plz  help. thnks in
>     adv
>     # Django settings for kasakooproj project.
>
>     import os
>     import ast
>
>     from ConfigParser import RawConfigParser
>
>     config = RawConfigParser()
>     PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
>     config.read(os.path.join(PROJECT_PATH, 'settings.conf'))
>
>     DEBUG = True
>     TEMPLATE_DEBUG = DEBUG
>
>     MANAGERS = ADMINS
>
>     DATABASES = {
>         'default': {
>             'ENGINE'  : config.get('database','engine'),
>             'NAME'    : config.get('database','name'),
>             'USER'    : config.get('database','user'),
>             'PASSWORD': config.get('database','password'),
>             'HOST'    : config.get('database','host'),
>             'PORT'    : config.get('database','port'),                     }
>     }
>
>     # Local time zone for this installation. Choices can be found here:
>     # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
>     # although not all choices may be available on all operating systems.
>     # On Unix systems, a value of None will cause Django to use the same
>     # timezone as the operating system.
>     # If running in a Windows environment this must be set to the same as your
>     # system time zone.
>     TIME_ZONE = 'America/Chicago'
>
>     # Language code for this installation. All choices can be found here:
>     # http://www.i18nguy.com/unicode/language-identifiers.html
>     LANGUAGE_CODE = 'en-us'
>
>     SITE_ID = 1
>
>     # If you set this to False, Django will make some optimizations so as not
>     # to load the internationalization machinery.
>     USE_I18N = True
>
>     # If you set this to False, Django will not format dates, numbers and
>     # calendars according to the current locale
>     USE_L10N = True
>
>     # Absolute filesystem path to the directory that will hold user-uploaded files.
>     # Example: "/home/media/media.lawrence.com/media/"
>     MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
>
>     # URL that handles the media served from MEDIA_ROOT. Make sure to use a
>     # trailing slash.
>     # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
>     MEDIA_URL = config.get('media_url', 'value')
>
>     # Absolute path to the directory static files should be collected to.
>     # Don't put anything in this directory yourself; store your static files
>     # in apps' "static/" subdirectories and in STATICFILES_DIRS.
>     # Example: "/home/media/media.lawrence.com/static/"
>     STATIC_ROOT = os.path.join(PROJECT_PATH, 'static')
>
>     # URL prefix for static files.
>     # Example: "http://media.lawrence.com/static/"
>     STATIC_URL = config.get('static_url', 'value')
>
>     # URL prefix for admin static files -- CSS, JavaScript and images.
>     # Make sure to use a trailing slash.
>     # Examples: "http://foo.com/static/admin/", "/static/admin/".
>     ADMIN_MEDIA_PREFIX = '/static/admin/'
>
>     # Additional locations of static files
>     STATICFILES_DIRS = (
>         # Put strings here, like "/home/html/static" or "C:/www/django/static".
>         # Always use forward slashes, even on Windows.
>         # Don't forget to use absolute paths, not relative paths.
>     )
>
>     # List of finder classes that know how to find static files in
>     # various locations.
>     STATICFILES_FINDERS = (
>         'django.contrib.staticfiles.finders.FileSystemFinder',
>         'django.contrib.staticfiles.finders.AppDirectoriesFinder',
>     #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
>     )
>
>     # Make this unique, and don't share it with anybody.
>     SECRET_KEY = ''
>
>     # List of callables that know how to import templates from various sources.
>     TEMPLATE_LOADERS = (
>         'django.template.loaders.filesystem.Loader',
>         'django.template.loaders.app_directories.Loader',
>     #     'django.template.loaders.eggs.Loader',
>     )
>
>     MIDDLEWARE_CLASSES = (
>         'django.middleware.common.CommonMiddleware',
>         'django.contrib.sessions.middleware.SessionMiddleware',
>         'django.middleware.csrf.CsrfViewMiddleware',
>         'django.contrib.auth.middleware.AuthenticationMiddleware',
>         'django.contrib.messages.middleware.MessageMiddleware',
>     )
>
>     ROOT_URLCONF = 'urls'
>
>     WSGI_APPLICATION = 'wsgi.application'
>
>     TEMPLATE_DIRS = (
>         # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
>         # Always use forward slashes, even on Windows.
>         # Don't forget to use absolute paths, not relative paths.
>         os.path.join(PROJECT_PATH, 'templates'),
>
>     )
>
>     INSTALLED_APPS = (
>         'django.contrib.auth',
>         'django.contrib.contenttypes',
>         'django.contrib.sessions',
>         'django.contrib.sites',
>         'django.contrib.messages',
>         'django.contrib.staticfiles',
>         # Uncomment the next line to enable the admin:
>         'django.contrib.admin',
>         # Uncomment the next line to enable admin documentation:
>         'django.contrib.admindocs',
>         'south',
>         'Bids',
>         'BingoUsers',
>         'CricketGame',
>         'generator',
>         'QuestionBase',
>         'admin',
>         'Notification',
>         'Merchant',
>         'Deal',
>         )
>
>     # A sample logging configuration. The only tangible logging
>     # performed by this configuration is to send an email to
>     # the site admins on every HTTP 500 error.
>     # See http://docs.djangoproject.com/en/dev/topics/logging for
>     # more details on how to customize your logging configuration.
>     LOGGING = {
>         'version': 1,
>         'disable_existing_loggers': False,
>         'handlers': {
>             'mail_admins': {
>                 'level': 'ERROR',
>                 'class': 'django.utils.log.AdminEmailHandler'
>             }
>         },
>         'loggers': {
>             'django.request': {
>                 'handlers': ['mail_admins'],
>                 'level': 'ERROR',
>                 'propagate': True,
>             },
>         }
>     }
>
>     and my setting.conf is
>     [media_url]
>     value : http://kasakoo.com/media/
>
>     [static_url]
>     value : /static/
>
>     [debug]
>     value : True
>
>     [database]
>     engine    : django.db.backends.mysql
>     name      : kasakoo
>     user      : root
>     password  : password
>     host      : localhost
>     port      : 3306
>
>     --
>     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/-/
>     rMapEJk2LzEJ.
>
>     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.
>
> --
>
>             GlxGuru
>
> --
> 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.
>
>
> ----------------------------------------------------
> Alternatives:
>
> ----------------------------------------------------

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

Re: Pinterest like UI implementation

Thanks Peith.

I will try Masonry and infinite-scroll.

Regards
~Nirmal

On Friday, September 28, 2012 8:07:34 PM UTC-7, Peith wrote:
I use Masonry to get that Pinterest-like tile of images. Then I use Infinite-scroll to detect user scrolling event and load more images by sending an AJAX request to the server.

You can learn about Masonry and infinite-scroll here:
http://masonry.desandro.com/

--
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/-/yPhJYgKnyn8J.
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.

Re: Pinterest like UI implementation

I use Masonry to get that Pinterest-like tile of images. Then I use Infinite-scroll to detect user scrolling event and load more images by sending an AJAX request to the server.

You can learn about Masonry and infinite-scroll here:
http://masonry.desandro.com/

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

Re: Virtualenvs and editing contrib stuff manually

On Fri, Sep 28, 2012 at 10:04 PM, Chris Pagnutti
<chris.pagnutti@gmail.com> wrote:
> Right on. Thanks for your replies. Since my change to the
> contrib.auth.User class is so minor, I'll just make a note of it and wait
> for the official release of 1.5.
>
> So, with the official way of changing the User class, in order to make
> different "kinds" of users, would you just use groups and permissions?
>

It's entirely up to you and your needs. If your "kinds" are
group-like, and it's possible for people to be in different groups,
then using groups might be appropriate. If it's as simple as "this
person is type X OR Y OR Z, then adding a choice field to your user
model may be appropriate.

The point is that in 1.5, your user model is entirely under your own
control. If you want your user to be compatible with Django's login
forms, or more importantly, the admin, there are some requirements you
need to meet, but these aren't too onerous.

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

Re: conditional model validation

On Friday, September 28, 2012, Babatunde Akinyanmi wrote:
Let me try to assist. A forms is_valid method causes 3 types of
cleaning methods to be run. Based on that, I'm sure you really don't
need to override it.


Yes, I've just discoverde the ValidationError e part of the docs :|

 
I really don't understand what you mean by "I want the description
field to be not blank/not the empty string" so maybe I could have been
of more help but I'm sure a solution to your problem would be to
override either the form's clean_fieldname or clean methods.

ie, 
if e.mark = W, e.descr must be >"" # it can be anything from "a" to "pregnant" to "killed" to "this is not an empty string" or " this is not a blank string"
else e.descr == "" #this is a blank or empty string



 
Check: https://docs.djangoproject.com/en/dev/ref/forms/validation/
which is a link to the documentation on form validation


cheers - since I am using the admin forms, I was hoping I could add it to the model, but is ok if I need to rewrite the forms

cheers
L.
 
On 9/28/12, Lachlan Musicman <datakid@gmail.com> wrote:
> Hola,
>
> I'm searching without much luck and can't see the answer in the docs.
>
> Am wanting to override the is_valid() method on a model (I think
> that's what I want).
>
> Basically, I have a choices field, and if one of those choices is
> selected, then I want a description field to be not blank/not the
> empty string. If it's the other two choices, I want the description
> field to be blank/empty string.
>
> First, I override is_valid() as a model method?
>
> Second, how do I return a false from is_valid()?
>
> ie, this is a rough up of what I'm looking for - what goes in place of
> return FALSE/TRUE?
>
> def is_valid(self):
>
> if enrolment.mark == 'W': #student has withdrawn from course
> -if enrolment.withdrawal_reason == '': #must have reason
> --return FALSE
> elif enrolment.withdrawal.reason != "": #ie, since enrolment.mark
> isn't 'W', confirm that the enrolment.reason is ""
> -return FALSE
> else:
> -return TRUE
>
> Cheers
> L.
> --
> ...we look at the present day through a rear-view mirror. This is
> something Marshall McLuhan said back in the Sixties, when the world
> was in the grip of authentic-seeming future narratives. He said, "We
> look at the present through a rear-view mirror. We march backwards
> into the future."
>
> http://www.warrenellis.com/?p=14314
>
> --
> 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.
>
>

--
Sent from my mobile device

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



--
...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, "We look at the present through a rear-view mirror. We march backwards into the future."

http://www.warrenellis.com/?p=14314

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

Re: splitting up image loads from rest of page

Also, use pagination to split your content in several pages. Google "django pagination".

--
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/-/0jBDpzoiTmIJ.
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.

django 1.3 google3 statics files not found

Hi I am newbie to django in google3 app engine. I am currently working on a project and am using django 1.3 in appengine. Everytime I build the project, statics are not found. Please suggest any settings required for this.I have refferred following link to build the project. https://sites.google.com/a/google.com/django/home/hosting-platforms/app-engine

Thanks

--
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/-/LLoO3FHXntYJ.
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.

Re: splitting up image loads from rest of page

On Fri, Sep 28, 2012 at 1:52 PM, aziz.mansur@gmail.com
<aziz.mansur@gmail.com> wrote:
> Checkout the jquery lazy load plugin [http://www.appelsiini.net/projects/lazyload]. I'm sure you can use it to achieve what you want.

Thanks. I'll check it out.

> Minor advice, this doesnt exactly relate to django, may be SO or some other js forums / groups would be a better place to post this?
>
>
> -----Original message-----
> From: Larry Martell
> Sent: 29/09/2012, 1:18 AM
> To: django-users@googlegroups.com
> Subject: splitting up image loads from rest of page
>
>
> I have a template that creates a table that has clickable links. It
> also loads a bunch of images associated with each row in the table.
> Through javascript events, when the user mouses over certain fields,
> the images are displayed or hidden. Initially, all the images are not
> displayed
>
> When the page loads, the table is produced quickly, but then there's a
> period of time before you can click on the links or mouse over and see
> the images. How long that period of time is seems directly related to
> how many rows there are in the table, so I'm assuming that time is
> being spent loading the images. Would that be a correct assumption?
>
> Assuming my assumption is correct, is there a way I can some how split
> this up, so the clickable links work as soon as the table is rendered,
> without waiting for the images? Also, the client is asking for me to
> display '... loading images' which goes away once they are all loaded.
> Can anyone tell me how I could do that?
>
> Thanks!
> -larry
>
> --
> 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+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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

RE: splitting up image loads from rest of page

Checkout the jquery lazy load plugin [http://www.appelsiini.net/projects/lazyload]. I'm sure you can use it to achieve what you want.

Minor advice, this doesnt exactly relate to django, may be SO or some other js forums / groups would be a better place to post this?


-----Original message-----
From: Larry Martell
Sent: 29/09/2012, 1:18 AM
To: django-users@googlegroups.com
Subject: splitting up image loads from rest of page


I have a template that creates a table that has clickable links. It
also loads a bunch of images associated with each row in the table.
Through javascript events, when the user mouses over certain fields,
the images are displayed or hidden. Initially, all the images are not
displayed

When the page loads, the table is produced quickly, but then there's a
period of time before you can click on the links or mouse over and see
the images. How long that period of time is seems directly related to
how many rows there are in the table, so I'm assuming that time is
being spent loading the images. Would that be a correct assumption?

Assuming my assumption is correct, is there a way I can some how split
this up, so the clickable links work as soon as the table is rendered,
without waiting for the images? Also, the client is asking for me to
display '... loading images' which goes away once they are all loaded.
Can anyone tell me how I could do that?

Thanks!
-larry

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

splitting up image loads from rest of page

I have a template that creates a table that has clickable links. It
also loads a bunch of images associated with each row in the table.
Through javascript events, when the user mouses over certain fields,
the images are displayed or hidden. Initially, all the images are not
displayed

When the page loads, the table is produced quickly, but then there's a
period of time before you can click on the links or mouse over and see
the images. How long that period of time is seems directly related to
how many rows there are in the table, so I'm assuming that time is
being spent loading the images. Would that be a correct assumption?

Assuming my assumption is correct, is there a way I can some how split
this up, so the clickable links work as soon as the table is rendered,
without waiting for the images? Also, the client is asking for me to
display '... loading images' which goes away once they are all loaded.
Can anyone tell me how I could do that?

Thanks!
-larry

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

How to create a navbar and its related .current class setting

Hi, lastly, I needed to create a navbar for a project of mines compound by static and dynamic pages.
The problem I tried to solve was how to set a .current class to each item accordingly to the page visited.
Static objects were simple pages of which I knew URLs, dynamic one were simple "page" objects.

The template with which the navbar is built is the following: http://dpaste.com/hold/806276/

As you can see, I just made an `ifequal` check between `request.path` attribute and 
the hard coded href value for my static objects, while between the page path, passed by context,
and the `page.slug` value for my dynamic "page" objects.

To pass to all templaets the `request.path` value I added in settings.py into the `TEMPLATE_CONTEXT_PROCESSORS
the value `'django.core.context_processors.request',` while to pass the path value in the class based view of
the page object, I added to its context `context['path'] = self.request.path[1:]`
Horrible, I know.

Now, while a noob, I "feel" this is not the **right** solution.
Up to you now: how would you solve the problem? Is there a best practice to solve similar issues?

p.s.
Why when I tried to just add, in settings.py, `TEMPLATE_CONTEXT_PROCESSORS += ('django.core.context_processors.request',)
It didn't work? 
I needed to copy and paste the whole default context assignment, adding that to it, to avoid to get it emptied
when trying to just add that value in the above mentioned way.

Thanks you all for your help,
Giuseppe

--
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/-/Pd9w4041J1cJ.
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.

Re: How to separate data having the same model but belonging to different users?

Use unit tests so you DO NOT FORGET to user the userid filter.

You're going to walk a thousand miles to get something somewhat working and that it won't solve all your problems. At least, resolving the "forgetting the filter" issue is easy to solve.

When you database starts to creep with tables you are going to have a nightmare. Oh, imagine when you need to cross compare these tables...if they were only one table...it would be easy. Imagine reports.´You will need to query n tables instead of one. Thats n - 1 chances to construct the wrong sql.

But that's up to you.

On Fri, Sep 28, 2012 at 3:49 PM, Joel Goldstick <joel.goldstick@gmail.com> wrote:
On Sun, Sep 23, 2012 at 9:32 PM, Rohit Banga <iamrohitbanga@gmail.com> wrote:
> How about maintaining one database per department and then using "using"
> parameter to select the appropriate database?
> There are not too many departments. I know it may not scale or seem elegant
> but keeping data in separate tables or databases is a requirement.
> Using the following command I feel I can sync all models to a new database.
>
> ./manage.py syncdb --database=department1
>
> Do you foresee any problem with this solution?
> I am planning to have a default database with all users and groups and then
> based on the group select the appropriate database.
> I do not want to sync django-admin tables to all databases. Is there a way
> to restrict models to a specific database?
> Let say I have databases 0 ... n.
> Departments 1 to n have the same set of tables with different data and
> database i corresponds to department i.
> database 0 is used to store only admin database tables. Is there a
> reasonable way to restrict this within the same app or are there problems
> that I cannot foresee?
>
> Thanks
> Rohit Banga
> http://iamrohitbanga.com/
>
>
> On Sun, Sep 23, 2012 at 12:56 PM, Dennis Lee Bieber <wlfraed@ix.netcom.com>
> wrote:
>>
>> On Sat, 22 Sep 2012 22:04:41 -0700 (PDT), Bill Beal
>> <b.beal@eximflow.com> declaimed the following in
>> gmane.comp.python.django.user:
>>
>> >
>> > I should think that if you have a foreign key to the department in all
>> > tables that must be segregated by department, you could create a
>> > decorator
>> > that would apply a filter with the department key.  But I don't know how
>> > to
>> > do it.
>> >
>>         Which basically puts it back to what the OP insists they are not
>> permitted to do -- have a single set of tables with a selection based on
>> the logged in user's department.
>> --
>>         Wulfraed                 Dennis Lee Bieber         AF6VN
>>         wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>>
>> --
>> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


I just came across the Section on Managers in the Django book (p 197
in the second edition) here online:
http://www.djangobook.com/en/2.0/chapter10.html

Search for the section on Managers.  This would be an excellent way to
solve your problem.  Using one model you can use different managers
which filter on Department Name
--
Joel Goldstick

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




--
George R. C. Silva

Desenvolvimento em GIS
http://geoprocessamento.net
http://blog.geoprocessamento.net

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