Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-20 Thread b1-
+1
>
>
And use some services like twich with auto VOD writing.
I think it will be intresting not only for us

-- 
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/-/2Dkdxaxw3JoJ.
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: python/django

2012-07-20 Thread Trey Sullivan
Hey spanky,

I'm not sure if I'm misunderstanding you but it sounds like you are trying 
to 'import python'. 

What you want to do is run python from your command line:

$ python

which then brings you to the interpreter which looks something like 

Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  

from there you want to type 'import django' so it should looks like 

>>> import django

If it seems like nothing happened, then it worked. If you want to double 
check you can run 

>>> print django.get_version

 Hope this helps. 



On Thursday, July 19, 2012 11:34:40 PM UTC-5, spanky wrote:
>
> hi there, i can't seem to get my django working in my python promt.
> import python just renders an error not recognised, got a feeling i have 
> to change the site path so i can import django into idle or python prompt, 
> any suggesions would be grateful thanks. 
> I've tried running the install but obvioulsy get held up at this point.
>

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



Passing a dict to default page_not_found view

2012-07-20 Thread Masud Khokhar
Hi all,

I am using the default 404 view that Django uses. I have created a custom 
404.html page in my templates directory which automatically gets loaded. Is it 
possible for this page to load a python dictionary or do I need to raise 
http404 myself for that?

In essence, what I am trying to do is load a random message in the 404.html. 
There may be a simpler solution for that.

Many thanks in advance.

Best wishes,
Masud

-- 
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 create a app inside a app

2012-07-20 Thread Russell Keith-Magee
On Sat, Jul 21, 2012 at 3:32 AM, Nicolas Ardison  wrote:
> Hello, i was reading the Django documentation, and i have the following
> trouble that i'm not sure if django can solve it. I have a application
> called "userArea" and i want to extend that app with more app isolated from
> the "main" apps.
>
> [DjangoProject]
>
> [APP1]
>
> [subAPP1]
>
> [subAPP2]
>
> [APP2]
>
>
> Could i do something like this? anyone know where i can start reading about
> this.

A Django app is just a Python module. That means you can nest them
however you like. As long as you provide a fully qualified path the
the leaf node of your nesting tree, you can use an app wherever it
occurs in your Python module namespace.

However, you don't get any Django benefits out of nesting like this. A
Django app is a single module. Nesting a module inside another doesn't
mean that the Django app 'inherits' anything from its 'parent', or
anything like that. The only benefit would be organisational -- i.e.,
keeping all the code in a hierarchy so it's easier to find it later.

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: Ignore apostrophes using django-postgresql

2012-07-20 Thread Russell Keith-Magee
To clarify - is your problem removing apostrophes, or having a search
mechanism that can accommodate variations in punctuation?

If the answer is the former, then the answer Ian gave is on the right track.

However, if your actual problem is full-text search, then there are
some better options. If you set up a full text search index, you'll be
able to allow for punctuation, spelling errors, word stems (e.g., a
search for "teacher" finding "teachers") and much more.

django-haystack is the place to start looking; Haystack is a Django
wrapper around a bunch of search backends (Solr, ElasticSearch,
Whoosh, and Xapian). If this is your first look into search backends,
I'd suggest using Elastic Search -- it's really easy to get going, and
is pretty powerful too. Of course, if you're planning to put this into
production, you'd be well served to take a look at the other options,
too.

Yours,
Russ Magee %-)

On Sat, Jul 21, 2012 at 7:02 AM, Ada Pineda  wrote:
> Hello
>
> I'm asking for your help because I need to do a query on a table that has a
> field that contains apostrophes, but I need to ignore them (apostrophes)
> when I'm doing the query. I have to save the data as it is, so I can't just
> take away those apostrophes before saving to the database. I mean, if the
> database has "rock'n burger" and a user types "rockn burger", I need to get
> the value with apostrophe from the database.
>
> Can anyone help me?
>
> Thanks a lot!
>
> --
> 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/-/lxGzVjrwQgMJ.
> 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: Ignore apostrophes using django-postgresql

2012-07-20 Thread Ian Clelland
The queryset's extra() method can help you with that:

MyModel.objects.extra(where=["replace(db_column_name, , '') = %s"],
params=["rockn burger"])

(Be careful if you're typing that in manually -- there are lots of
single-quotes in it)

Ian

On Fri, Jul 20, 2012 at 4:02 PM, Ada Pineda  wrote:

> Hello
>
> I'm asking for your help because I need to do a query on a table that has
> a field that contains apostrophes, but I need to ignore them (apostrophes)
> when I'm doing the query. I have to save the data as it is, so I can't just
> take away those apostrophes before saving to the database. I mean, if the
> database has "rock'n burger" and a user types "rockn burger", I need to get
> the value with apostrophe from the database.
>
> Can anyone help me?
>
> Thanks a lot!
>
> --
> 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/-/lxGzVjrwQgMJ.
> 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.
>



-- 
Regards,
Ian Clelland


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



Ignore apostrophes using django-postgresql

2012-07-20 Thread Ada Pineda
Hello

I'm asking for your help because I need to do a query on a table that has a 
field that contains apostrophes, but I need to ignore them (apostrophes) 
when I'm doing the query. I have to save the data as it is, so I can't just 
take away those apostrophes before saving to the database. I mean, if the 
database has "rock'n burger" and a user types "rockn burger", I need to get 
the value with apostrophe from the database. 

Can anyone help me?

Thanks a lot!

-- 
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/-/lxGzVjrwQgMJ.
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 create a app inside a app

2012-07-20 Thread Melvyn Sopacua
On 20-7-2012 21:32, Nicolas Ardison wrote:

> [APP1]
> 
> [subAPP1]
> 
> [subAPP2]

> Could i do something like this? anyone know where i can start reading about 
> this.

Yes and no. You can, but within a project the last part of the python
module path must be unique. So you cannot do:
app1.newsapp
app1.commentsapp
app2.newsapp < same name

Actually, you can do it, but you can't enable both in INSTALLED_APPS.
I'm doing exactly this with an app that has geo support and doesn't.
They provide identical models but only one can be enabled.
-- 
Melvyn Sopacua


-- 
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: Android app that can post to a django server

2012-07-20 Thread Bill Freeman
On 7/17/12, gavin lyons  wrote:
> I have built the Django server as shown here
> http://stackoverflow.com/questions/5871730/need-a-minimal-django-file-upload-example
>
> I have been trying to build an android app that will allow me to select
> files on my phone and post them to the the server.  All the examples i am
> finding are for posting data to a php server which i have tried to adapt
> with little success.
>
> If anyone has an ideas how this can be achieved that would be greatly
> appreciated

It's hard to know what's actually not working from this description.
I'll guess that the APP is actually performing an HTTP request using
the POST method, targeting some specific URL.

You should be able to design a view to deal with whatever the APP is
posting.  But modern Django has CSRF protection by default, and I'll
bet the APP isn't dealing with that correctly.  There are two ways out
of this: 1. explicitly disable CSRF protection for the view in
question (there is a decorator for that); or 2. assuming that you have
the source code of the APP, you understand it, and you have a build
system on which to re-make it, you can modify the app to do a GET
first, have the response include the CSRF token, and return it
suitably (you probably have to deal with session and other cookies for
this).

I also presume that you require a log in in order to be allowed to
post to this django site.  Does the APP do that, and exchange the
corresponding cookies?

If the APP isn't doing simple HTTP, then, as the other gentleman
suggested, some purpose built API, like a REST scheme (tastypie,
djangorestframework, or the ;pmg om the tooth and apparently no longer
supported piston), or even SOAP (not for the faint of heart) would
make the APP useful with multiple disparate servers.

Bill

-- 
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 create a app inside a app

2012-07-20 Thread Nicolas Ardison
Hello, i was reading the Django documentation, and i have the following 
trouble that i'm not sure if django can solve it. I have a application 
called "userArea" and i want to extend that app with more app isolated from 
the "main" apps. 

[DjangoProject]

[APP1]

[subAPP1]

[subAPP2]

[APP2]


Could i do something like this? anyone know where i can start reading about 
this.

Thanks guys

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



sqlite to mysql loaddata not working (using natural keys)

2012-07-20 Thread dack
I'm trying to move django data from an sqlite database to a mysql database. 
I know I need to use natural keys, but it's still failing. Any ideas?

Here's my procedure. The default database is sqlite, the mysql database is 
called "mysql" in settings.py.

$*./manage.py dumpdata -a -n > data.json*
$*./manage.py flush --database=mysql*
You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the 'django' database,
and return each table to the state it was in after syncdb.
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes

You just installed Django's auth system, which means you don't have any 
superusers defined.
Would you like to create one now? (yes/no): no
Installed 0 object(s) from 0 fixture(s)
*Note - if I examine the mysql database at this point, the tables all exist 
and contain 0 rows (as I expected)*
$*./manage.py loaddata --database=mysql ./data.json*
Problem installing fixture './data.json': Traceback (most recent call last):
  File 
"/usr/local/lib/python2.6/site-packages/django/core/management/commands/loaddata.py",
 
line 196, in handle
obj.save(using=using)
  File 
"/usr/local/lib/python2.6/site-packages/django/core/serializers/base.py", 
line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
  File "/usr/local/lib/python2.6/site-packages/django/db/models/base.py", 
line 565, in save_base
created=(not record_exists), raw=raw, using=using)
  File 
"/usr/local/lib/python2.6/site-packages/django/dispatch/dispatcher.py", 
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File "/genpool0/db/foo/intranet/../intranet/userprofile/models.py", line 
22, in create_user_profile
UserProfile.objects.create(user=instance)
  File 
"/usr/local/lib/python2.6/site-packages/django/db/models/manager.py", line 
137, in create
return self.get_query_set().create(**kwargs)
  File "/usr/local/lib/python2.6/site-packages/django/db/models/query.py", 
line 377, in create
obj.save(force_insert=True, using=self.db)
  File "/usr/local/lib/python2.6/site-packages/django/db/models/base.py", 
line 463, in save
self.save_base(using=using, force_insert=force_insert, 
force_update=force_update)
  File "/usr/local/lib/python2.6/site-packages/django/db/models/base.py", 
line 551, in save_base
result = manager._insert([self], fields=fields, return_id=update_pk, 
using=using, raw=raw)
  File 
"/usr/local/lib/python2.6/site-packages/django/db/models/manager.py", line 
203, in _insert
return insert_query(self.model, objs, fields, **kwargs)
  File "/usr/local/lib/python2.6/site-packages/django/db/models/query.py", 
line 1576, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
  File 
"/usr/local/lib/python2.6/site-packages/django/db/models/sql/compiler.py", 
line 910, in execute_sql
cursor.execute(sql, params)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/util.py", 
line 40, in execute
return self.cursor.execute(sql, params)
  File 
"/usr/local/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", 
line 337, in execute
return Database.Cursor.execute(self, query, params)
IntegrityError: Could not load auth.User(pk=1): column user_id is not unique

-- 
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/-/t0RMEEtwXacJ.
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 is the label_tag's attrs parameter supposed to specified?

2012-07-20 Thread Tomas Neme
{% for field in form %}
{{ field.label
}}{{ field }}
{% endfor %}

although I think the custom form class is not such a bad solution



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



Extending a app with other app

2012-07-20 Thread Nicolas Ardison
Hello, i'm realtive new in django framework, and i can not find how to do 
the following thing:

Does anybody knows how to create a "app" inside a "app"? I have read that i 
must create an other settings and url file inside the first "app" but i 
don't look crear how ? 

Anyone knows some open source project that implement this to see the code? 
or some doc/tutorial/blog entry to read?

Thanks guys =)

Nicolas Ardison

-- 
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/-/7NVnB99iHrIJ.
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 is the label_tag's attrs parameter supposed to specified?

2012-07-20 Thread doogster
For me, the BoundField.label_tag method's attrs parameter is one of those 
"what were the designers of Django thinking when they put it in" things. 
Rather than wondering, I'll ask here.

The way to add HTML attributes to a label is to call label_tag with its 
attrs parameter set. label_tag is usually called by templates. Templates 
cannot pass parameters to the methods that they call. Do you see the 
problem?

When this gets discussed on forums, solutions tend to range from building 
custom template tags to monkeypatching BoundField.label_tag. (I went with 
the latter solution here: 
http://duganchen.ca/rendering-django-forms-for-the-twitter-bootstrap/). 
None of these solutions are really great, and I am very, very curious as to 
how it's actually supposed to be done.

-- 
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/-/U0bnhswEic4J.
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: Cant override change_form.html in Django..Why??

2012-07-20 Thread cabrazil
Hayyan, I´m following the same book and got the same problem, how did you 
solve it?

Thanks.


Em quinta-feira, 4 de agosto de 2011 07h29min37s UTC-3, Hayyan Rafiq 
escreveu:
>
>  Hi i read that
> "By default, the admin application will look for a template in several 
> places, using the first 
> one it finds. The template names it looks for are as follows, in this 
> order:
> 1. admin/flatpages/flatpage/change_form.html
> 2. admin/flatpages/change_form.html
> 3. admin/change_form.html"
>
> In my template Dir in settings.py I have added the following
>
>
> TEMPLATE_DIRS = (
> "D:/Django-1.3/django/bin/cms/Templates",
> # 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.
> )
>
>
>
> So why isnt the page change_form.html which i placed in
> D:\Django-1.3\django\bin\cms\Templates\admin\flatpages\flatpage
> gets displayed.
> Instead the page in
> D:\Django-1.3\django\bin\cms\Templates\flatpages\default.html gets 
> displayed
> any ideas or suggestions??
>  

-- 
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/-/JQtPCPQxqbkJ.
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: Can a method call inside save() display its return on template?

2012-07-20 Thread Andy McKay
>   cursor.execute("SELECT
> GetDirectionDescr("+str(nod_id1)+","+str(nod_id2)+") from sys.dual")

Please note that code means that you might be open to SQL injection.
You should be using the parameters for SQL, see:

https://docs.djangoproject.com/en/dev/topics/db/sql/#passing-parameters-into-raw

-- 
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: Boolean always returns False?

2012-07-20 Thread Sithembewena Lloyd Dube
Hi Tomas,

Some guy created a user model instead of inheriting the base one. Yes, I'm
importing the right one :)

Seems I found the problem. The user seemed to be modified before it got to
my check.

Thanks.

On Fri, Jul 20, 2012 at 5:44 PM, Tomas Neme  wrote:

> why do you have your own User model? Are you sure you're logging in
> the right user and loading the right user instance?
>
> On Fri, Jul 20, 2012 at 12:37 PM, Sithembewena Lloyd Dube
>  wrote:
> > Hi everyone,
> >
> > I have a user model in which i have a newsletter boolean field. When the
> > user subscribes to a newsletter, this is checked.
> > I am then instantiating that user and checking the property, so that if
> it
> > is False (i.e. unchecked) = I can display a subscription box.
> >
> > In the model:
> > newsletter = models.BooleanField(verbose_name=u'Sign up to the
> newsletter',
> > default=False)
> >
> > .. and in the view:
> > print registered_user.newsletter
> >
> > The print outputs False even though this same user's 'newsletter' field
> > appears checked in the admin. What am I missing?
> >
> > Thanks.
> >
> > --
> > Regards,
> > Sithembewena Lloyd Dube
> >
> > --
> > 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.
>
>
>
> --
> "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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: Boolean always returns False?

2012-07-20 Thread Tomas Neme
why do you have your own User model? Are you sure you're logging in
the right user and loading the right user instance?

On Fri, Jul 20, 2012 at 12:37 PM, Sithembewena Lloyd Dube
 wrote:
> Hi everyone,
>
> I have a user model in which i have a newsletter boolean field. When the
> user subscribes to a newsletter, this is checked.
> I am then instantiating that user and checking the property, so that if it
> is False (i.e. unchecked) = I can display a subscription box.
>
> In the model:
> newsletter = models.BooleanField(verbose_name=u'Sign up to the newsletter',
> default=False)
>
> .. and in the view:
> print registered_user.newsletter
>
> The print outputs False even though this same user's 'newsletter' field
> appears checked in the admin. What am I missing?
>
> Thanks.
>
> --
> Regards,
> Sithembewena Lloyd Dube
>
> --
> 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.



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



Boolean always returns False?

2012-07-20 Thread Sithembewena Lloyd Dube
Hi everyone,

I have a user model in which i have a newsletter boolean field. When the
user subscribes to a newsletter, this is checked.
I am then instantiating that user and checking the property, so that if it
is False (i.e. unchecked) = I can display a subscription box.

In the model:
newsletter = models.BooleanField(verbose_name=u'Sign up to the newsletter',
default=False)

.. and in the view:
print registered_user.newsletter

The print outputs False even though this same user's 'newsletter' field
appears checked in the admin. What am I missing?

Thanks.

-- 
Regards,
Sithembewena Lloyd Dube

-- 
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: Can a method call inside save() display its return on template?

2012-07-20 Thread Tomas Neme
You can still do self.something = foobar even if "something" is not a
database Field.

What I mean is, doing self.vdr_code = get_vdr_code() will save it for
THIS INSTANCE and then you can use it in your template.

If you really need this to be only at .save() (instead of, say, at
__init__, because it feels like once the object's been saved this
could be get in object initialization), you just have to make sure
this is the same instance you pass to the template context.

Something like:

myobject.save()
.
render_to_response(template, { 'object': myobject })

then in your template you can do {{ object.vdr_code }}

Although all in all, I *really* hope you have a good reason to use db
backend-specific SQL instead of making a django model of those
DirectionDescr whatever they are

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



phpBB3 to DjangoBB migration...

2012-07-20 Thread jens
Hi...

Anyone who interest the migration from phpBB3 to DjangoBB should take
a look at
my project:

https://github.com/jedie/django-phpBB3

There i worked on a migration script.



What is django-phpBB3 ?
---

"""
Django-phpBB3 provides the database models of a existing phpBB3
installation for
easy migration into a other forum software. It's not a phpBB clone or
a forum!

Warning: In the current state, it's not guaranteed that changes trough
the
django admin will work with phpBB3! So in the current state, access
'read-only'
to the data

Patches are welcome! Please send pull requests.
"""


-- Mfg. Jens Diemer

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



Django 1.4 debug_toolbar and htmltidy with checking html5 syntax

2012-07-20 Thread b1-


Hi to all!

htmltidy check html 4 syntax errors and it shows me boring messages like

Current page have following errors:

PositionError or Warning
line 5 column 5 
Warning:  proprietary attribute "charset" 
line 5 column 5 
Warning:  lacks "content" attribute

because I'm use html5.

How to say htmltidy check syntax as html5 validator?

Django 1.4 debug_toolbar 0.9.4 debug_toolbar_htmltidy 0.1.1

http://stackoverflow.com/questions/11554517/django-1-4-debug-toolbar-and-htmltidy-with-checking-html5-syntax

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



python/django

2012-07-20 Thread spanky
hi there, i can't seem to get my django working in my python promt.
import python just renders an error not recognised, got a feeling i have to 
change the site path so i can import django into idle or python prompt, any 
suggesions would be grateful thanks. 
I've tried running the install but obvioulsy get held up at this point.

-- 
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/-/YC2q4qg0a-gJ.
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/python

2012-07-20 Thread spanky
Hi there peeps, I can't seem to get my python command to import django, 
i've gotta feeling i have to change the command line path in windows to 
python and somehow sync django and pyhon up.
Any suggestions, i've tried what the site says but somethings off

-- 
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/-/AB4CYRKzDOEJ.
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: Variable # of fields in a form

2012-07-20 Thread Daniel Roseman
On Friday, 20 July 2012 00:41:04 UTC-7, Alex Strickland wrote:
>
> Hi 
>
> I am generating a page with a variable list of categories (shown in a 
> Bootstrap accordion control) displayed as checkboxes. So a user may 
> select any or all of the checkboxes to categorise an article. 
>
> I did that just as a wireframe/demo. Trouble is I didn't think how that 
> might work with Django's form processing, as I now have a variable list 
> of form fields to deal with. 
>
> Can it work with Django forms? Or should I go on my own way and analyse 
> the POST data to try and capture the selections and save them. 
>
> I'm new at this so normal excuses for idiocy... 
> -- 
> Regards 
> Alex 
>

You don't want a variable number of fields, you just want a single 
MultipleChoiceField field using a CheckboxSelectMultiple widget. 

https://docs.djangoproject.com/en/1.4/ref/forms/fields/#multiplechoicefield
https://docs.djangoproject.com/en/1.4/ref/forms/widgets/#checkboxselectmultiple
--
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/-/zH1WoiVSf7oJ.
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.



Variable # of fields in a form

2012-07-20 Thread Alex Strickland

Hi

I am generating a page with a variable list of categories (shown in a 
Bootstrap accordion control) displayed as checkboxes. So a user may 
select any or all of the checkboxes to categorise an article.


I did that just as a wireframe/demo. Trouble is I didn't think how that 
might work with Django's form processing, as I now have a variable list 
of form fields to deal with.


Can it work with Django forms? Or should I go on my own way and analyse 
the POST data to try and capture the selections and save them.


I'm new at this so normal excuses for idiocy...
--
Regards
Alex

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