Re: Append only tables/models

2012-10-25 Thread Mike Burr
On Oct 25, 3:44 pm, Christophe Pettus  wrote:
> On Oct 25, 2012, at 8:26 AM, Mike Burr wrote:
>
> > I know there are DBMS-specific ways of doing this. I know that there
> > are Django ways of making fields read-only. What I cannot find is a
> > way to make a table/model append-only.
>
> You can always override the .save() method to check to see if the pk field is 
> None, and refuse to save if it is not:

Good. I'll consider it.

>
>        
> https://docs.djangoproject.com/en/1.4/topics/db/models/#overriding-pr...
>
> That being said, this kind of thing is *much* better done at the DB level, so 
> that you can be certain that there are no other paths that allow data to be 
> updated.

I agree. Now that I think of it, I will probably wait until this goes
into production (MySQL) and implement it therehow.

Many thanks.

-Mike.

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



Re: a way to display a model formset in a ModelAdmin ?

2012-10-25 Thread Stephen Anto
Hi,

Create New adminmodel class and define fieldsets... For example
http://www.f2finterview.com/web/Django/22/ it is clearly explain you

On Thu, Oct 25, 2012 at 3:51 AM, Nicolas Emiliani  wrote:

> Hi,
>
> As the subject states, is there a way to display a model formset in a
> ModelForm?
>
> The thing is that I have a Verification model with its ModelAdmin, and
> then I have
> an ImageModel that has no ForeignKey to the Verification model (and I
> intend to keep
> it that way) so I can not inline it into the VerificationAdmin and I would
> like to show
> a list of Images in my VerificationAdmin based on a queryset performed (i
> assume) at
> __init__ method of VerificationAdminForm. How could this be accomplished?
>
> This is how it goes:
>
> class Image(models.Model):
>
>
> class Verification(models.Model):
>
>
> class VerificationAdminForm(forms.ModelForm):
>
>
> class VerificationAdmin(admin.ModelAdmin):
>form = VerificationAdminForm
>model = Verification
>fieldsets = [ ... ]
>
> Any ideas would be greatly appreciated.
>
> Thanks in advance.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



-- 
Thanks & Regards
Stephen S



Website: www.f2finterview.com
Blog:  blog.f2finterview.com
Tutorial:  tutorial.f2finterview.com
Group:www.charvigroups.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Populate database from views

2012-10-25 Thread Coulson Thabo Kgathi
is it possible to do this? 

i have data that i recieve into the view from my template and i want to 
save that data which is in an array in my view to a database

anybody help or link to where i can learn a way to do that

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/-/cXkin2Cr8XEJ.
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: Populate database from views

2012-10-25 Thread Stephen Anto
Hi,

if you have data in array list just use this

for list in array_list:
 modelObj = YourModel()
 modelObj.fieldname = list
 modelObj.save()

I believe it will help you... Thank you for visiting
http://www.f2finterview.com/web/Django/

On Thu, Oct 25, 2012 at 3:05 PM, Coulson Thabo Kgathi wrote:

> is it possible to do this?
>
> i have data that i recieve into the view from my template and i want to
> save that data which is in an array in my view to a database
>
> anybody help or link to where i can learn a way to do that
>
> 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/-/cXkin2Cr8XEJ.
> 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.
>



-- 
Thanks & Regards
Stephen S



Website: www.f2finterview.com
Blog:  blog.f2finterview.com
Tutorial:  tutorial.f2finterview.com
Group:www.charvigroups.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Best way to detect if a user has changed password

2012-10-25 Thread Roarster
Thanks for the answers, that was pretty much what I was expecting.  I 
haven't had a chance to test this yet but do you think it'll be as simple 
as just comparing the value with the previous value, seeing as the password 
field is (I assume) a bit different with it storing the hash rather than 
the plain text.

On Wednesday, 24 October 2012 22:23:15 UTC+1, Roarster wrote:
>
> I'm running a Django 1.4 site and I have some operations I want to perform 
> if a user changes their password.  I'm using the standard contrib.auth user 
> accounts with the normal password_change view and I'm not sure if I should 
> somehow hook into this view or if I should use a signal on post_save for 
> the user.  If I do use the signal, is it possible to tell when the password 
> has been changed?  I do feel that if I can use a signal this might be the 
> best approach since it would handle any other password change mechanisms 
> that I might add later without any extra work.
>
> Does anyone have any ideas on the best way to do this?
>

-- 
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/-/zuDV99Z715wJ.
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: Populate database from views

2012-10-25 Thread Coulson Thabo Kgathi
thanks will try that

-- 
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/-/EQbQ4UGctlsJ.
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: Best way to detect if a user has changed password

2012-10-25 Thread Tom Evans
On Wed, Oct 24, 2012 at 10:23 PM, Roarster  wrote:
> I'm running a Django 1.4 site and I have some operations I want to perform
> if a user changes their password.  I'm using the standard contrib.auth user
> accounts with the normal password_change view and I'm not sure if I should
> somehow hook into this view or if I should use a signal on post_save for the
> user.  If I do use the signal, is it possible to tell when the password has
> been changed?  I do feel that if I can use a signal this might be the best
> approach since it would handle any other password change mechanisms that I
> might add later without any extra work.
>
> Does anyone have any ideas on the best way to do this?
>

The password_change view takes additional arguments, one of which is
'password_change_form'. The form is responsible for changing the users
password, and by default is django.contrib.auth.forms.SetPasswordForm
(see docs):

https://docs.djangoproject.com/en/1.4/topics/auth/#django.contrib.auth.views.password_change

The form itself is responsible for changing the users password, so by
extending that class and specifying that class to be used, you can
hook directly in to the derived class's save() method and perform
whatever actions you need to when the password is changed.

Cheers

Tom

-- 
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: Internationalization: trans with object property

2012-10-25 Thread Tom Evans
On Wed, Oct 24, 2012 at 2:16 PM, Ma Ba  wrote:
> Hi,
> I have a question about the internationalization feature ...
>
> I have a country model:
>
> class Country(models.Model):
> nameKey = models.CharField(max_length=50)
> shortNameKey = models.CharField(max_length=30)
>
> The properties 'nameKey' and 'shortNameKey' contain resource keys like
> '_country_af' or '_country_af_short'. I need this to show the country names
> depending on the current locale.
>
> The problem was/is to add the resource keys to the .po file, so I found a
> solution in a forum:
> http://stackoverflow.com/questions/7625991/how-to-properly-add-entries-for-computed-values-to-the-django-internationalizati
>
> For example, I added the following to a model file:
>
> def dummy_for_makemessages():
> #countries
> pgettext('forecast type', '_country_af')
> pgettext('forecast type', '_country_af_short')
>
> Runing makemessages this generates the following entries in the .po file:
>
> msgctxt "forecast type"
> msgid "_country_af"
> msgstr "Afghanistan"
>
> msgctxt "forecast type"
> msgid "_country_af_short"
> msgstr "Afghanistan"
>
> For testing purposes I tried to iterate over all countries in my database in
> a template and to print out the translated names:
>
> {% for country in countries %}
> {% trans country.nameKey %}
> {% endfor %}
>
> Unfortunately, it only prints out the following (the resource keys instead
> of the translated names):
>
> _country_af
> _country_ai
> _country_qa
> _country_ke
> _country_kg
> _country_ki
> _country_cc
> _country_co
> ...
>
> I found out that the 'msgctxt' part in the .po file causes the missing
> translation. I removed it for testing purposes and this time it worked fine.
>
> So, my question is, how can I translate resource keys that are not defined
> in the template itself but in an object property instead? Is there a way to
> generate the resource keys without the 'msgctxt' part? I tried NONE or an
> empty string but this generates a commented out resource key in the .po file
> (please see the link to the other forum above).
> Does anybody have an idea how to solve this problem?
>
> Thanks for your help in advance!!
>

You did compile the po file catalogues to mo files, right? Otherwise,
gettext will simply return the msgid. msgctxt should be irrelevant.

Cheers

Tom

-- 
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: a way to display a model formset in a ModelAdmin ?

2012-10-25 Thread Nicolas Emiliani
>
>
> Create New adminmodel class and define fieldsets... For example
> http://www.f2finterview.com/web/Django/22/ it is clearly explain you
>
>
Hi Stephen, thanks for the reply, but it doesn't solve it since every field
specified
in the fieldset at the Model admin needs to either exist in Model or in the
ModelForm,
and since the number of Images that I want to display is variable (let's
say between 1 and N)
I can't have N Image fields at the form, what I need is somewhat of a field
that spawns
into multiple fields based on the amount of images that I want to display.
I'm starting
to think that maybe using a many-to-many field with a custom widget might
do the job.


> On Thu, Oct 25, 2012 at 3:51 AM, Nicolas Emiliani wrote:
>
>> Hi,
>>
>> As the subject states, is there a way to display a model formset in a
>> ModelForm?
>>
>> The thing is that I have a Verification model with its ModelAdmin, and
>> then I have
>> an ImageModel that has no ForeignKey to the Verification model (and I
>> intend to keep
>> it that way) so I can not inline it into the VerificationAdmin and I
>> would like to show
>> a list of Images in my VerificationAdmin based on a queryset performed (i
>> assume) at
>> __init__ method of VerificationAdminForm. How could this be accomplished?
>>
>> This is how it goes:
>>
>> class Image(models.Model):
>>
>>
>> class Verification(models.Model):
>>
>>
>> class VerificationAdminForm(forms.ModelForm):
>>
>>
>> class VerificationAdmin(admin.ModelAdmin):
>>form = VerificationAdminForm
>>model = Verification
>>fieldsets = [ ... ]
>>
>> Any ideas would be greatly appreciated.
>>
>> Thanks in advance.
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Thanks & Regards
> Stephen S
>
>
>
> Website: www.f2finterview.com
> Blog:  blog.f2finterview.com
> Tutorial:  tutorial.f2finterview.com
> Group:www.charvigroups.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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



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



Re: implement of view

2012-10-25 Thread Markus Christen
 Hmm ok, i can use 
 
 return render_to_response("sql.html", { 'row': row })
 
and when i call now http://127.0.0.1:8000/sql/, i can see the correct data. 
But i will call http://127.0.0.1:8000/portal/ and try to implements the sql 
code in this page.
 
I have by base.html in addition now " {% include "sql.html" %} ", the sql 
looks like:
 sql.html---
{% block content %}Kundendaten {{ row }}.{% endblock %}
--
 
my output by portal call is:
-
PortalAusgabe Kundendaten

Zeit der Aktualisierung Oct. 25, 2012, 8:16 a.m..

Kundendaten .
--

Danke fuer die Benutzung meiner Seite.

-

the data output is not there, but it must look like:

Kundendaten [('Niederer Hansruedi (THA) ', 'hansruedi.bl...@blobb.ch ')].

i hope my problem is now better descibed...

maybe i find a way, but i hope for input. :)

-- 
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/-/_bOenlD205AJ.
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: implement of view

2012-10-25 Thread Markus Christen
Ok, when i use now  http://127.0.0.1:8000/sql/, the output is
Kundendaten [('bla Hansruedi (THA) ', 'hansruedi@blubb.ch ')].
 
i have in base.html now " {% include "sql.html" %}" in addition.
when i use now http://127.0.0.1:8000/portal/, my output is just:
Kundendaten .
 
how can i fix this problem?

-- 
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/-/iaebQXum0yMJ.
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: Reverse for 'app_list' with arguments '()' and keyword arguments '{'app_label': ''}' not found.

2012-10-25 Thread Nick Doyle
Had the same problem.
Seems the top-level problem is with extending the django admin template 
"change_form.html".
It has a tag in there referring to "app_list" which isn't set when we 
extend.
More than that I couldn't fix right now.

So worked around it by, for the form, change to extend *base_site.html*instead 
of change_form.html.
Means you have to specify a bit more stuff - submit button etc - but least 
it works.
HTH Nick


On Sunday, 9 September 2012 08:33:36 UTC+10, vijay shanker wrote:
>
> hi
> i have this model called charity
> ___
> from django.db import models
> from settings import DEFAULT_CHARITY_NAME as deafult_charity_name
>
>
> class GetDefaultInstance(models.Manager):
> def get_default_instance(self):
> return 
> super(Charity,self).get_query_set().filter(charity_name=default_charity_name)
>
> 
> class Charity(models.Model):
> class Meta:
> verbose_name_plural = 'Charities'
> app_label = 'charities'
> charity_name= models.CharField(max_length=50)
> in_percentage   = models.IntegerField(help_text='default value is 0,\
>   leave blank if you will enter 
> fixed amount.', default=0, blank=True,null=True)
> fixed_amount= models.IntegerField(help_text='default value is 0,\
>   leave blank if you entered 
> amount in percentage.',default=0, blank=True, null=True  )
> 
> objects = models.Manager()
> default_instance = GetDefaultInstance()
> 
> def __unicode__(self):
> return '%s'%self.charity_name
>
> ___-
>
> in urls:
> (r'^admin/charity_report/(?P[-\w]+)/$', 
> 'charities.admin_views.report'),
> __
>
> and another model called ItemDetails which have forignkey relation with 
> above model, with  default instance of charity attached to each Itemdetail 
> object .
> I wanted to add admin button alongside history button so user can see 
> amount charged as charity and stuff like percentage deduction,amount 
> deducted etc.
>
> i managed to show the button but when clicked at it gives this trace:
> http://pastebin.com/03wscYLX
>
> the settings is at: 
> http://pastebin.com/7FYY189D
>
> the other regular info are in:
> http://pastebin.com/QmAdEeP9
>
> its been 2-3 days trying to run it on apache server.. it works ok on local 
> machine.
>
> i override form_change template and provide the button, write urls for 
> admin 
>

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



CachedStaticFilesStorage headache

2012-10-25 Thread florian
Hi,

i try to use CachedStaticFilesStorage and, for now, it only gives me a 
headache!

Whay i've done : 
 1 - put STATICFILES_STORAGE = 
'django.contrib.staticfiles.storage.CachedStaticFilesStorage' in setting
 2 - DEBUG = False
 3 - add  'staticfiles': {
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
'LOCATION': os.path.join(ROOT_DIR, 'staticcache'),
}
   to CACHES in settings
 4 - collectstatic
 5 - replace each occurrence of {{STATIC_URL}}/* by {% static "blabla" %}, 
with the correct {% load static from staticfiles %}

So, i've read and followed the doc

Now, the css are well modified by collectstatic. The items are well tagged 
with their md5. However, each time i access a page, i get a 500 error. In 
the logs, i have the following message :

ValueError: The file 'img/favicon.png' could not be found with 


I've search if there is more doc/howto, but didn't find anything. So i 
think i'm doing something wrong, but don't know what.

Last thing : if y use the md5-tagged version in the template, it works. 
Hence, i think that CachedStaticFilesStorage can't manage to find my assets.

any idea?

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/-/ei_OZzoffWQJ.
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: implement of view

2012-10-25 Thread Markus Christen

>
> How can i create 2 views on one page?
>> def sql(request): and def portal(request): 
>>
>  

-- 
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/-/xneUlf_fSGAJ.
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: CachedStaticFilesStorage headache

2012-10-25 Thread florian
ok, just needed to post to find the answer myself!

my STATIC_ROOT was "static/" , don't know why i haven't changed it!
now, it is os.path.join(ROOT, "static/")

and it works perfectly

I leave the post in case it would help someone

-- 
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/-/PLYg0c1ShtsJ.
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: implement of view

2012-10-25 Thread Tomas Neme
>>> How can i create 2 views on one page?
>>> def sql(request): and def portal(request):

You can't. A View *is* a page. Do the tutorial.

You could use class-based views and have a view that inherits from
both, and combines the contexts (this is _not_ in the tuto)

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



Re: Puzzled about WSGI vs. FastCGI

2012-10-25 Thread Fred
Thanks Nik. I'll experiment.

On Thursday, October 25, 2012 12:23:57 AM UTC+2, Nikolas Stevenson-Molnar 
wrote:
>
>  Correct. I've found proxying to an HTTP WSGI server to be eaisier as you 
> don't need to configure passing of FastCGI params. I use Gunicorn with 
> nginx, and it requires very little all around configuration. I would expect 
> Gunicorn with lighttpd to be similar.
>
> _Nik
>
> On 10/24/2012 3:11 PM, Fred wrote:
>  
> Thanks guys for the infos. It makes a lot more sense now. 
>
>  So it looks like Lighttpd does not support the equivalent of mod_wsgi, 
> so requires a second server that speaks either FastCGI or HTTP/WSGI.
>
> On Wednesday, October 24, 2012 5:58:21 PM UTC+2, Fred wrote: 
>>
>> Hello 
>>
>>  I'm trying to find how to install Python on a Lighttpd server that 
>> currently runs PHP scripts.
>>
>>  This 
>> articlesays:
>>
>>> Although WSGI is the preferred deployment platform for Django, many 
>>> people use shared hosting, on which protocols such as FastCGI, SCGI or AJP 
>>> are the only viable options.
>>
>>
>>  I'm puzzled, because I seemed to understand that WSGI is an API that 
>> relies on a lower-level transport solution like FastCGI, SCGI, or AJP.
>>
>>  Could it be that the article actually opposed mod_wsgi, which can run 
>> within Apache à la mod_php *?
>>
>>  And if someone knows of a good way to run Python through FastCGI (with 
>> or without WSGI) on Lighttpd, I'm interested: "Python FastCGI on lighty 
>> with flup" at the very 
>> bottomonly
>>  seems to run a specific script.
>>
>>  Thank you.
>>
>>  * altough it can also run in its own process, just like FastCGI 
>>  
>  -- 
> 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/-/n62KPozSRhcJ.
> 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.
>
>
> 

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



Modernizing the Tutorial

2012-10-25 Thread Tomas Neme
Now that function-based views are being deprecated, or at least that
class-based views are being favored, there should be a tutorial with
them in the docs, shouldn't it?

I don't mean replacing the current one, because that'd raise the entry
point a lot, but cloning the original tutorial, but implementing it
with class-based views, possibly placing a link to it in the generic
views docs page, would go a long way towards generating "good" habits
amongst new users, I think.

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



Re: Strange behaviour after pressing on button

2012-10-25 Thread Stone
Over Firefox and Firebug I have received that CSRF Validation failed.
My server is running on apache2-2.2.22 and there are two proxy's
All template file and forms includes csrf_token tag.

On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar 
wrote:
> It's possible that the CSRF token isn't being sent correctly. As a test,
> try adding the @csrf_exempt decorator to your view. If you no longer get
> the 403, then it's a CSRF problem.
>
> _Nik
>
> On 10/24/2012 6:31 AM, Stone wrote:
>
>
>
>
>
>
>
> > My Django application is running on real server (apache2-2.2.22).
> > In urls.py is mentioned:
> >     (r'^configSave/$', configSave),
>
> > My HTML is bellow. After pressing on configSave I am receiving HTTP
> > 403 error page.
>
> > In view.py is mentioned:
> > def configSave(request):
> >    configFile={}
> >    if os.path.isfile(SSO_CONF) != False:
> >            f = open(SSO_CONF,"r")
> >            for line in f:
> >                    line = line.strip()
> >                    if re.search('^#',line) != None:
> >                            '''print 'This is the commentary'''
> >                    else:
> >                            '''print line'''
> >                            try:
> >                                    name, value = line.split('=',2)
> >                                    configFile[name]=value
> >                                    print '<%s>%s' % (name, value, name)
> >                            except ValueError, err:
> >                                    ''' print 'This is empty row'''
> >    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>
> > configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >    configFile={}
> >    if os.path.isfile(SSO_CONF) != False:
> >            f = open(SSO_CONF,"r")
> >            for line in f:
> >                    line = line.strip()
> >                    if re.search('^#',line) != None:
> >                            '''print 'This is the commentary'''
> >                    else:
> >                            '''print line'''
> >                            try:
> >                                    name, value = line.split('=',2)
> >                                    configFile[name]=value
> >                                    print '<%s>%s' % (name, value, name)
> >                            except ValueError, err:
> >                                    ''' print 'This is empty row'''
> >    configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>
> > configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
> >    c = {}
> >    c = Context({
> >            'config':configFile,
> >            'item':2,
> >    })
> >    c.update(csrf(request))
> >    return
> > render_to_response('config.html',c,context_instance=RequestContext(request))
>
> > By the way how to really fast define logging mechanism which can be
> > use for debugging.
>
> > Is this my programmer approach corrector is there any other way how to
> > react on the pressing of button?
>
> >  >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > {% extends "index.html" %}
> > {% block content %}
> > http://www.w3.org/1999/
> > xhtml">
> > 
> >   top.helpID="SSO_config";
> >   $(document).ready(function () {
>
> >    function sendAjax()
> >    {
> >        $(document).ajaxSend(function(event, xhr, settings) {
> >            function getCookie(name) {
> >                var cookieValue = null;
> >                if (document.cookie && document.cookie != '') {
> >                    var cookies = document.cookie.split(';');
> >                    for (var i = 0; i < cookies.length; i++) {
> >                        var cookie = jQuery.trim(cookies[i]);
> >                        if (cookie.substring(0, name.length + 1) == (name
> > + '=')) {
> >                            cookieValue =
> > decodeURIComponent(cookie.substring(name.length + 1));
> >                            break;
> >                        }
> >                    }
> >                }
> >                return cookieValue;
> >            }
> >            function sameOrigin(url) {
> >                var host = document.location.host; // host + port
> >                var protocol = document.location.protocol;
> >                var sr_origin = '//' + host;
> >                var origin = protocol + sr_origin;
> >                // Allow absolute or scheme relative URLs to same origin
> >                return (url == origin || url.slice(0, origin.length + 1)
> > == origin + '/') ||
> >                    (url == sr_origin || url.slice(0, sr_origin.length +
> > 1) == sr_origin + '/') ||
> >                    !(/^(\/\/|http:|https:).*/.test(url));
> >            }
> >            function safeMethod(method) {
> >                return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> >            }
> >            if (!safeMethod(settings.type) && sameOrigin(settings.url)) {
> >                xhr.setRequestHeader("X-CSRFToken",
> > getCookie

pub_date timezone

2012-10-25 Thread Brendan Carroll
Hi all
I am new to Django and I'm having an issue with some code. I am trying to 
get through the first tutorial from the Django site.
I have a file called polls/models.py and have created a class that contains 
the following code
class Poll(models.Model):
 question = models.CharField(max_length=200)
 pub_date = models.DateTimeField('date published')
 
The problem occurs when I go into the command prompt and enter the 
following line
p = Poll(question = "Whats new? ", pub_date=timezone.now())
The error is as follows: name Poll is not defined.
Appreciate any help guidance
 
 

-- 
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/-/dBbvVPL8BicJ.
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: pub_date timezone

2012-10-25 Thread Emrah Atalay
Hi brendan,

You have the import class before using, so

from polls.models import Poll

2012/10/25 Brendan Carroll 

> Hi all
> I am new to Django and I'm having an issue with some code. I am trying to
> get through the first tutorial from the Django site.
> I have a file called polls/models.py and have created a class that
> contains the following code
> class Poll(models.Model):
>  question = models.CharField(max_length=200)
>  pub_date = models.DateTimeField('date published')
>
> The problem occurs when I go into the command prompt and enter the
> following line
> p = Poll(question = "Whats new? ", pub_date=timezone.now())
> The error is as follows: name Poll is not defined.
> Appreciate any help guidance
>
>
>
> --
> 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/-/dBbvVPL8BicJ.
> 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.



Translation: DjangoUnicodeDecodeError

2012-10-25 Thread Sandro Dutra
Hi, I'm having a little problems with translations...

I've various {% trans "anything" %}, everything is correctly configured, I
do the makemessages and compilemesages with sucess, and everything works
correctly, but I've a problem, when I insert special characters in *.po
files, I get DjangoUnicodeDecodeError:

*DjangoUnicodeDecodeError at /

'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in
range(128). You passed in  ()*
*
*
Anyone can point a solution?
Thanks in advance.

-- 
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: Translation: DjangoUnicodeDecodeError

2012-10-25 Thread Tom Evans
On Thu, Oct 25, 2012 at 2:31 PM, Sandro Dutra  wrote:
> Hi, I'm having a little problems with translations...
>
> I've various {% trans "anything" %}, everything is correctly configured, I
> do the makemessages and compilemesages with sucess, and everything works
> correctly, but I've a problem, when I insert special characters in *.po
> files, I get DjangoUnicodeDecodeError:
>
> DjangoUnicodeDecodeError at /
>
> 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in
> range(128). You passed in  0x02BBEEF0> ()
>
> Anyone can point a solution?
> Thanks in advance.

I think you have put characters into your po file that are not in the
correct encoding. Can you describe how you are creating these "special
characters"?

Also, the full traceback may be illuminating instead of just the exception.

Cheers

Tom

-- 
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: Date widget not HTML5

2012-10-25 Thread Victor Rocha
You need to roll out your own widget.

I assume django will have html5 support in the near future.


On Wednesday, October 24, 2012 1:04:07 PM UTC-4, Juan Pablo Tamayo wrote:
>
>
>
> Is there any reason not to have the date widget input tag have the 
> attribute type="date" instead of just type="text"?
>
> I mean, most browser do not treat it differently, but it tells them that 
> they should; besides it would mean that Django tries to support the full 
> range of HTML5.
>
>
> Is there a way to change this particular behavior?
>
> Thanks in advance fellow Django-mates!!!
>

-- 
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/-/sCLLhz7VluIJ.
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: Documentation helpers in the admindocs (django 1.4)

2012-10-25 Thread Robert Bergs
This looks like it is a known issue. See ticket 
5405. 


On Monday, 10 September 2012 21:57:49 UTC+1, craig wrote:
>
> It could be I'm doing something wrong, but I have the admin documentation 
> working, and read about the helpers ( :model:`app.model`, :view:, etc) but 
> when I use them the docs render the actual text and not the link:
>
> class Calendar(models.Model):
>> """
>> Contains a collection of :model:`events.Event` objects.
>> 
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>> """
>
>
> Renders to the admin docs site as
>
> Contains a collection of :model:`events.Event` objects. 
>
>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model. 
>
>
> I have admin and admindocs apps installed, my tests all pass, so I'm not 
> sure whether I'm missing something or not.
>

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



queryset-didn't show result.

2012-10-25 Thread DjgoNy
I have a project where i have to extract data from database whenever i 
click on it.
It should be shown in a table and it will be shown individually but 
whenever i use queryset in my view it didn't show anything
and when i commented the queryset then it will be shown all the listed data 
but not individually. in other word not the right data but there is a 
result.
what went wrong with my program. 

view.py 

class SolutionView(ListView):
template_name="Solution_list.html"
model = Solution
form_class = SolutionForm
context_object_name = "solutions"

def get_context_data(self, **kwargs):
context = super(SolutionView, self).get_context_data(**kwargs)
context['person_NOID']=self.kwargs['person_NOID']
tilstande =Solution.objects.filter( NOID= 
self.kwargs['person_NOID'])
return context

def get_queryset(self, **kwargs):
queryset =Solution.objects.filter(CPR = self.kwargs['person_NOID'])
return queryset

def form_valid(self, queryset):
queryset.save()
return HttpResponseRedirect(reverse("index"))

Solution_list.html




Solution


{% if solutions%}


{% csrf_token %}



NOID {{ person_NOID }}
SMOKING
WEIGHT
BP
 
   

{% for solution in solutions %}
 
{{ solution.NEW_DATE }}





{% endfor %} 




{% else %}
No Data.
{% endif %}




I want it to look something like this.

NOID - 123456789SMOKINGWEIGHTBPDATEDATENEW DATE

whereby everytime they came a new date it will be shown in DATE-first date 
DATE-next date DATE-and so on. 
And when user click on NEW DATE then the result will be shown on the 
appropriate table ei: smoking , weight, BP.

Thank you so much.

-- 
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/-/BjwwjV1ZS4YJ.
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: Strange behaviour after pressing on button

2012-10-25 Thread Nikolas Stevenson-Molnar
It looks like you're submitting your request via AJAX and using the
X-CSRFToken header. It's very possible that one of your proxies isn't
forwarding that header correctly. You might try submitting it as an
actual form parameter instead.

_Nik

On 10/25/2012 6:01 AM, Stone wrote:
> Over Firefox and Firebug I have received that CSRF Validation failed.
> My server is running on apache2-2.2.22 and there are two proxy's
> All template file and forms includes csrf_token tag.
>
> On Oct 24, 6:54 pm, Nikolas Stevenson-Molnar 
> wrote:
>> It's possible that the CSRF token isn't being sent correctly. As a test,
>> try adding the @csrf_exempt decorator to your view. If you no longer get
>> the 403, then it's a CSRF problem.
>>
>> _Nik
>>
>> On 10/24/2012 6:31 AM, Stone wrote:
>>
>>
>>
>>
>>
>>
>>
>>> My Django application is running on real server (apache2-2.2.22).
>>> In urls.py is mentioned:
>>> (r'^configSave/$', configSave),
>>> My HTML is bellow. After pressing on configSave I am receiving HTTP
>>> 403 error page.
>>> In view.py is mentioned:
>>> def configSave(request):
>>>configFile={}
>>>if os.path.isfile(SSO_CONF) != False:
>>>f = open(SSO_CONF,"r")
>>>for line in f:
>>>line = line.strip()
>>>if re.search('^#',line) != None:
>>>'''print 'This is the commentary'''
>>>else:
>>>'''print line'''
>>>try:
>>>name, value = line.split('=',2)
>>>configFile[name]=value
>>>print '<%s>%s' % (name, value, name)
>>>except ValueError, err:
>>>''' print 'This is empty row'''
>>>configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>>> configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
>>>configFile={}
>>>if os.path.isfile(SSO_CONF) != False:
>>>f = open(SSO_CONF,"r")
>>>for line in f:
>>>line = line.strip()
>>>if re.search('^#',line) != None:
>>>'''print 'This is the commentary'''
>>>else:
>>>'''print line'''
>>>try:
>>>name, value = line.split('=',2)
>>>configFile[name]=value
>>>print '<%s>%s' % (name, value, name)
>>>except ValueError, err:
>>>''' print 'This is empty row'''
>>>configFile['SlaveDeactAppl']=configFile['SlaveDeactAppl'].split(',');
>>> configFile['SlaveDeactScripts']=configFile['SlaveDeactScripts'].split(',');
>>>c = {}
>>>c = Context({
>>>'config':configFile,
>>>'item':2,
>>>})
>>>c.update(csrf(request))
>>>return
>>> render_to_response('config.html',c,context_instance=RequestContext(request))
>>> By the way how to really fast define logging mechanism which can be
>>> use for debugging.
>>> Is this my programmer approach corrector is there any other way how to
>>> react on the pressing of button?
>>> >> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>> {% extends "index.html" %}
>>> {% block content %}
>>> http://www.w3.org/1999/
>>> xhtml">
>>> 
>>>   top.helpID="SSO_config";
>>>   $(document).ready(function () {
>>>function sendAjax()
>>>{
>>>$(document).ajaxSend(function(event, xhr, settings) {
>>>function getCookie(name) {
>>>var cookieValue = null;
>>>if (document.cookie && document.cookie != '') {
>>>var cookies = document.cookie.split(';');
>>>for (var i = 0; i < cookies.length; i++) {
>>>var cookie = jQuery.trim(cookies[i]);
>>>if (cookie.substring(0, name.length + 1) == (name
>>> + '=')) {
>>>cookieValue =
>>> decodeURIComponent(cookie.substring(name.length + 1));
>>>break;
>>>}
>>>}
>>>}
>>>return cookieValue;
>>>}
>>>function sameOrigin(url) {
>>>var host = document.location.host; // host + port
>>>var protocol = document.location.protocol;
>>>var sr_origin = '//' + host;
>>>var origin = protocol + sr_origin;
>>>// Allow absolute or scheme relative URLs to same origin
>>>return (url == origin || url.slice(0, origin.length + 1)
>>> == origin + '/') ||
>>>(url == sr_origin || url.slice(0, sr_origin.length +
>>> 1) == sr_origin + '/') ||
>>>!(/^(\/\/|http:|https:).*/.test(url));
>>>  

Re: pub_date timezone

2012-10-25 Thread BrendanC
Hi erm
 
Went back over your comment and realised what you commented. 
After python manage.py I gget the python prompt>>> and then typed
from polls.models import Poll, Choice
 
then I typed: Poll.objects.all() and got the array brace [] returned.
then I typed from django.utils import timezone
 
then typed: p = Poll(question="Whats new?", pub_date=timezone.now())
This line will not run and tells me pub_date is an invalid argument.
 
Thanks again in advance 
 

On Thursday, October 25, 2012 2:28:42 PM UTC+1, emr wrote:

> Hi brendan, 
>
> You have the import class before using, so 
>
> from polls.models import Poll
>
> 2012/10/25 Brendan Carroll >
>
>> Hi all
>> I am new to Django and I'm having an issue with some code. I am trying to 
>> get through the first tutorial from the Django site.
>> I have a file called polls/models.py and have created a class that 
>> contains the following code
>> class Poll(models.Model):
>>  question = models.CharField(max_length=200)
>>  pub_date = models.DateTimeField('date published')
>>  
>> The problem occurs when I go into the command prompt and enter the 
>> following line
>> p = Poll(question = "Whats new? ", pub_date=timezone.now())
>> The error is as follows: name Poll is not defined.
>> Appreciate any help guidance
>>  
>>  
>>
>> -- 
>> 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/-/dBbvVPL8BicJ.
>> 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.
>>
>
>

-- 
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/-/vZ3ZKc9753QJ.
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: pub_date timezone

2012-10-25 Thread BrendanC
Hi erm
 
I put that line in and still won't work. In my models.py file I have the 
following:
 
from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
put_date = models.DateTimeField ('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes =models.IntegerField()
 
After I entered import Poll the following would not run
python manage.py shell
When I removed it as seen above, the shell ran but the timezone issue still 
existed.
 
Thanks again for your help
 
Thanks for this advice. I did import 
On Thursday, October 25, 2012 1:36:39 PM UTC+1, Brendan Carroll wrote:

> Hi all
> I am new to Django and I'm having an issue with some code. I am trying to 
> get through the first tutorial from the Django site.
> I have a file called polls/models.py and have created a class that 
> contains the following code
> class Poll(models.Model):
>  question = models.CharField(max_length=200)
>  pub_date = models.DateTimeField('date published')
>  
> The problem occurs when I go into the command prompt and enter the 
> following line
> p = Poll(question = "Whats new? ", pub_date=timezone.now())
> The error is as follows: name Poll is not defined.
> Appreciate any help guidance
>  
>  
>

-- 
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/-/vqONpt4ZL6cJ.
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: pub_date timezone

2012-10-25 Thread Emrah Atalay
Hi again,

Remove 'date published' string from pub_date=models.DateTimeField

from django.db import models

class Poll(models.Model):
question = models.CharField(max_length=200)
put_date = models.DateTimeField()

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes =models.IntegerField()

After that if you not run yet, syncdb

./manage.py

When you open shell import Poll class

from polls.models import Poll



2012/10/25 BrendanC 

> Hi erm
>
> Went back over your comment and realised what you commented.
> After python manage.py I gget the python prompt>>> and then typed
> from polls.models import Poll, Choice
>
> then I typed: Poll.objects.all() and got the array brace [] returned.
> then I typed from django.utils import timezone
>
> then typed: p = Poll(question="Whats new?", pub_date=timezone.now())
> This line will not run and tells me pub_date is an invalid argument.
>
> Thanks again in advance
>
>
> On Thursday, October 25, 2012 2:28:42 PM UTC+1, emr wrote:
>
>> Hi brendan,
>>
>> You have the import class before using, so
>>
>> from polls.models import Poll
>>
>> 2012/10/25 Brendan Carroll 
>>
>>> Hi all
>>> I am new to Django and I'm having an issue with some code. I am trying
>>> to get through the first tutorial from the Django site.
>>> I have a file called polls/models.py and have created a class that
>>> contains the following code
>>> class Poll(models.Model):
>>>  question = models.CharField(max_length=**200)
>>>  pub_date = models.DateTimeField('date published')
>>>
>>> The problem occurs when I go into the command prompt and enter the
>>> following line
>>> p = Poll(question = "Whats new? ", pub_date=timezone.now())
>>> The error is as follows: name Poll is not defined.
>>> Appreciate any help guidance
>>>
>>>
>>>
>>> --
>>> 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/-/**dBbvVPL8BicJ
>>> .
>>> 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
>>> .
>>>
>>
>>  --
> 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/-/vZ3ZKc9753QJ.
>
> 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: pub_date timezone

2012-10-25 Thread Brendan Carroll
Thank Emrah

Appreciate your help. Will try that later as I have an online lecture until
2100hrs.

Brendan

On 25 October 2012 18:10, Emrah Atalay  wrote:

> Hi again,
>
> Remove 'date published' string from pub_date=models.DateTimeField
>
> from django.db import models
>
> class Poll(models.Model):
> question = models.CharField(max_length=200)
> put_date = models.DateTimeField()
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes =models.IntegerField()
>
> After that if you not run yet, syncdb
>
> ./manage.py
>
> When you open shell import Poll class
>
> from polls.models import Poll
>
>
>
>
> 2012/10/25 BrendanC 
>
>> Hi erm
>>
>> Went back over your comment and realised what you commented.
>> After python manage.py I gget the python prompt>>> and then typed
>> from polls.models import Poll, Choice
>>
>> then I typed: Poll.objects.all() and got the array brace [] returned.
>> then I typed from django.utils import timezone
>>
>> then typed: p = Poll(question="Whats new?", pub_date=timezone.now())
>> This line will not run and tells me pub_date is an invalid argument.
>>
>> Thanks again in advance
>>
>>
>> On Thursday, October 25, 2012 2:28:42 PM UTC+1, emr wrote:
>>
>>> Hi brendan,
>>>
>>> You have the import class before using, so
>>>
>>> from polls.models import Poll
>>>
>>> 2012/10/25 Brendan Carroll 
>>>
 Hi all
 I am new to Django and I'm having an issue with some code. I am trying
 to get through the first tutorial from the Django site.
 I have a file called polls/models.py and have created a class that
 contains the following code
 class Poll(models.Model):
  question = models.CharField(max_length=**200)
  pub_date = models.DateTimeField('date published')

 The problem occurs when I go into the command prompt and enter the
 following line
 p = Poll(question = "Whats new? ", pub_date=timezone.now())
 The error is as follows: name Poll is not defined.
 Appreciate any help guidance



 --
 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/-/**dBbvVPL8BicJ
 .
 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
 .

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

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



should Django groups and permissions be hard-coded or bootstrapped?

2012-10-25 Thread Tony Schmidt


I'm building an app that assumes the existence of certain groups and 
permissions for its workflow. For example, a "member" can log into the app 
and view and edit their personal data, but cannot see notes that would 
typically be displayed on the same screen. An "employee" can see those 
notes and create or edit their own, but only a "member manager" can delete 
or edit anyone's notes.

My issue is with bootstrapping the data for this app. I can create JSON 
fixture data for the groups, but then I have to hard-code the PKs, which 
seems like bad practice (what if a third party app I wanted to use did the 
same thing and there was a conflict?) A bigger issue is the permissions - I 
would have to add PKs to the permissions which in turn would have PKs to 
their content types.

I've read about using the post_syncdb hook to add initial data in a more 
programmatic fashion which I'm hoping will help me resolve the hard-coded 
PK issue. But I'm wondering whether this is the best solution to this 
problem, or if I'm "abusing" the Django Group and Permission concepts, 
here, and should be doing something else, like creating new models or just 
putting flags (like "is_member_manager") on my user profile model, etc.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/lzhz-lJSPlcJ.
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.



[ANNOUNCE] Django 1.5 alpha 1 released

2012-10-25 Thread James Bennett
Our first milestone on the road to Django 1.5 came today, with the
release of the first alpha package.

Blog post about it is here:

https://www.djangoproject.com/weblog/2012/oct/25/15-alpha-1/

Release notes are here:

https://docs.djangoproject.com/en/dev/releases/1.5-alpha-1/

And you can get the alpha from the downloads page:

https://www.djangoproject.com/download/

-- 
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: Modernizing the Tutorial

2012-10-25 Thread Lachlan Musicman
On Fri, Oct 26, 2012 at 2:00 AM, Tomas Neme  wrote:
> Now that function-based views are being deprecated, or at least that
> class-based views are being favored, there should be a tutorial with
> them in the docs, shouldn't it?
>
> I don't mean replacing the current one, because that'd raise the entry
> point a lot, but cloning the original tutorial, but implementing it
> with class-based views, possibly placing a link to it in the generic
> views docs page, would go a long way towards generating "good" habits
> amongst new users, I think.

IIRC they are in the tutorial. Not in an in depth way, but nothing is
really - it's just enough to get one started. The views are well
documented in the rest of the docs, and it's easy enough to
understand. Also worth noting that they are referred to as "generic
views" in the tutorial, not class based views.

path/intro/tutorial04.html#use-generic-views-less-code-is-better

Cheers
L.



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



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



Re: Documentation helpers in the admindocs (django 1.4)

2012-10-25 Thread Craig Bateman
I think this is a bug in 1.4 that is probably addressed in the dev version.
The model docstring is not run through the markdown to HTML routine in the
django version I'm using. Was simple enough to patch locally.
On Sep 10, 2012 1:58 PM, "craig"  wrote:

> It could be I'm doing something wrong, but I have the admin documentation
> working, and read about the helpers ( :model:`app.model`, :view:, etc) but
> when I use them the docs render the actual text and not the link:
>
> class Calendar(models.Model):
>> """
>> Contains a collection of :model:`events.Event` objects.
>>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>> """
>
>
> Renders to the admin docs site as
>
> Contains a collection of :model:`events.Event` objects.
>
>
>> Events are mapped to calendars through the :model:`ScheduledEvent`
>> model.
>
>
> I have admin and admindocs apps installed, my tests all pass, so I'm not
> sure whether I'm missing something or not.
>
> --
> 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/-/OUFxqu5lQaoJ.
> 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.



create sql functions before tests

2012-10-25 Thread Zoltan Szalai

Hi,

Do you have any idea how could I run some custom sql that creates some C 
functions before tests start to run?

django: 1.3.4, postgres 9.1

thx
Zoli

--
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: Modernizing the Tutorial

2012-10-25 Thread Russell Keith-Magee
On Thu, Oct 25, 2012 at 9:00 PM, Tomas Neme  wrote:

> Now that function-based views are being deprecated, or at least that
> class-based views are being favored, there should be a tutorial with
> them in the docs, shouldn't it?
>
> I don't mean replacing the current one, because that'd raise the entry
> point a lot, but cloning the original tutorial, but implementing it
> with class-based views, possibly placing a link to it in the generic
> views docs page, would go a long way towards generating "good" habits
> amongst new users, I think.
>

So, as Lachlan pointed out, the current tutorial 4 *does* use class-based
generic views.

However, there is also scope for a focussed tutorial about class-based
views in general. IMHO one of the biggest uptake problems around
class-based views, and class-based generic views, is that there is a big
initial learning curve, and the reference docs are intimidating.

There is certainly room for improvement here -- either as a much improved
topic guide, or as a new tutorial. More docs and better docs is always a
good thing, and if someone wants to volunteer to write them, they get my
enthusiastic support.

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: Modernizing the Tutorial

2012-10-25 Thread Tomas Neme
> However, there is also scope for a focussed tutorial about class-based views
> in general. IMHO one of the biggest uptake problems around class-based

This is what I meant. Something that brings in, easy and clearly, the
concept of mixins, the different mixins,something that, for example,
take two mixins that alter the context, and combines them, stuff like
that, simple, but useful, and that gives you a glimpse of "real world"
usage and customization.

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



Re: Modernizing the Tutorial

2012-10-25 Thread Lachlan Musicman
On Fri, Oct 26, 2012 at 1:02 PM, Tomas Neme  wrote:
>> However, there is also scope for a focussed tutorial about class-based views
>> in general. IMHO one of the biggest uptake problems around class-based
>
> This is what I meant. Something that brings in, easy and clearly, the
> concept of mixins, the different mixins,something that, for example,
> take two mixins that alter the context, and combines them, stuff like
> that, simple, but useful, and that gives you a glimpse of "real world"
> usage and customization.

Couldn't agree more. If I understood class based views or Mixins
better, or had used them in a project, I'd do the docs. I still don't
understand a good use case for them. (All my projects have been small
enough to not need them...)

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



Intermittent mysql connection errors

2012-10-25 Thread Guy
I'm experiencing an annoying problem with a couple of django apps. Both 
apps are games built on Django that make regular calls to the db using 
python-db. We have error emails turned on, and every so often (the interval 
doesn't seem to follow a pattern but it's usually no more than once in a 
half-hour) we get an email with the following info (I've obscured/changed 
some identifying info, for the record):

OperationalError at /analytics/ 

(2003, "Can't connect to MySQL server on 'x.x.x.x' (111)")

 Request Method: POST  Request URL: 
http://hostname.domain/analytics
  Django 
Version: 1.3  Exception Type: OperationalError  Exception Value: 

(2003, "Can't connect to MySQL server on 'x.x.x.x' (111)")

 Exception Location: /usr/lib/pymodules/python2.6/MySQLdb/connections.py in 
__init__, line 170  Python Executable: /usr/sbin/uwsgi-1.2.3  Python 
Version: 2.6.5  Python Path: 

['app_path',
 '.',
 '',
 '/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/python2.6/dist-packages/PIL',
 '/usr/lib/pymodules/python2.6',
 '/usr/local/lib/python2.6/dist-packages',
 '/usr/local/lib/python2.6/dist-packages/newrelic-1.5.0.103',
 'app_path/src',
 'app_path/src/expedition',
 'app_path/src/expedition/settings']

 Server time: Thu, 25 Oct 2012 14:14:08 -0700  
Traceback 
   
   - /usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py in 
   get_response 
   1. 
  
  response = callback(request, *callback_args, 
**callback_kwargs)
  
   Local Vars 
 Variable Value   exceptions 
   
   
   
e 
   
   OperationalError(2003, "Can't connect to MySQL server on 'x.x.x.x' (111)")
   
callback_args 
   
   ()
   
receivers 
   
   [(, None)]
   
middleware_method 
   
   
   
self 
   
   
   
settings 
   
   
   
request 
   
   ,
   POST:,
   COOKIES:{},
   META:{'CONTENT_LENGTH': '275',
'CONTENT_TYPE': 'application/x-www-form-urlencoded',
'DOCUMENT_ROOT': '/opt/nginx-1.2.1/html',
'HTTP_ACCEPT': '*/*',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
'HTTP_ACCEPT_LANGUAGE': 'en-us',
'HTTP_CONTENT_LENGTH': '275',
'HTTP_CONTENT_TYPE': 'application/x-www-form-urlencoded',
'HTTP_HOST': 'hostname.domain',
'HTTP_USER_AGENT': 'HTTPagent/1.2 CFNetwork/609 Darwin/13.0.0',
'HTTP_VIA': 'HTTP/1.1 akrmspsrvz4ts212.wnsnet.attws.com',
'HTTP_X_FORWARDED_FOR': 'x.x.x.x, x.x.x.x',
'HTTP_X_REAL_IP': 'x.x.x.x',
'PATH_INFO': u'/analytics/',
'QUERY_STRING': '',
'REMOTE_ADDR': 'x.x.x.x',
'REMOTE_PORT': '49328',
'REQUEST_METHOD': 'POST',
'REQUEST_URI': '/analytics/',
'SCRIPT_NAME': u'',
'SERVER_NAME': 'hostname.domain',
'SERVER_PORT': '80',
'SERVER_PROTOCOL': 'HTTP/1.0',
'uwsgi.core': 15,
'uwsgi.node': 'hostname',
'uwsgi.version': '1.2.3',
'wsgi.errors': ,
'wsgi.file_wrapper': ,
'wsgi.input': ,
'wsgi.multiprocess': True,
'wsgi.multithread': True,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)}>
   
callback 
   
   
   
resolver 
   
   
   
urlresolvers 
   
   
   
callback_kwargs 
   
   {}
   
response 
   
   None
   
urlconf 
   
   'expedition.urls'
   
 - 
   
/usr/local/lib/python2.6/dist-packages/newrelic-1.5.0.103/newrelic/api/object_wrapper.pyin
 
   __call__ 
   1. 
  
  self._nr_instance, args, kwargs)
  
   
The db connection works fine most of the time, it just seems like 
intermittently it can't connect. I've done a couple of things, like enabled 
tcp_tw_reuse (it seems I usually have about 150-200 connections to mysql in 
TIME_WAIT on any one web server), checked the mysql server and web servers 
message logs for too many connections errors, and looked at the mysql log 
to see if there's any info there. I also wrote a script that connects to 
the db and sends an email to me if it doesn't get expected info, initially 
I ran it with a cron job and didn't get any emails from it, but obviously 
that was only every minute. I'm now running it every second using the watch 
command but haven't so far had any emails.

It's very strange, and I'm not sure why it's happening. As I said, we have 
another django app (on completely separate infrastructure) that has the 
same issue. I don't believe there's a network issue but I wouldn't rule it 
out, but I'm curious if anyone else on here has seen this behaviour before, 
and if so, I'd like to know how you fixed it. Any help would be appreciated.

Thanks,

Guy

-- 
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/-/QRBTXR2Kc5cJ.
To post to this group, send email to django-users

How can I compare the value of an aggregate with a list of results from a model

2012-10-25 Thread Érico Oliveira
my view:
def comprar(request):
if request.method == 'POST':
form = FormComprar(request.POST)
if form.is_valid():
form = form.save()
retorno = 'Intenção de compra computada.'
form = FormComprar()
else:
form = FormComprar()
total =
Compra.objects.all().aggregate(quantidade_total=Sum('quantidade'))
[ 1 ]
valores = Valor.objects.all().order_by('quantidade')  [ 2 ]
return render_to_response(
'form_compra.html',
locals(),
context_instance=RequestContext(request))


template - form_compra.html

Aggregate
{{ total.quantidade_total }} [ 1 ]

{% for valor in valores %}
{{ valor.quantidade }}
{% endfor %}
list os results [ 2 ]
e.g
1000
2000
3000

like a :

{% if total.quantidade_total >= {{ valor.quantidade }}

-- 
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 does threading and processes work in Django

2012-10-25 Thread dwang
Hi,

I'm new to Django and need some help understanding how threading works in 
Django. I have some data that I'd like to recompute periodically in the 
background and have it shared between requests. If I start a thread in one 
of the view functions (e.g. my_thread.start()), would Django kill this 
thread at some point? What if I start the thread in the main function 
before entering the server loop?
Does Django handle each request in a separate process with its own 
interpreter instance?
Where can I find a good explanation of how thread management works in 
Django?

Any pointers would be greatly appreciated!
Danyao


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



Installing Djando and tutor polls app

2012-10-25 Thread Rodrigo Morgado
Hi everybody,

I'm new in Django framework. I installed version 1.3.1 over Python 2.7.3 in 
Ubuntu.
I already did all steps but i have an error when i execute python manage.py 
sql polls to create my table's project in mysql.

Traceback (most recent call last):
  File "manage.py", line 14, in 
execute_manager(settings)
  File 
"/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 
438, in execute_manager
utility.execute()
  File 
"/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 
379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", 
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", 
line 219, in execute
self.validate()
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", 
line 249, in validate
num_errors = get_validation_errors(s, app)
  File 
"/usr/lib/python2.7/dist-packages/django/core/management/validation.py", 
line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 
146, in get_app_errors
self._populate()
  File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 
61, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 
78, in load_app
models = import_module('.models', app_name)
  File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 
35, in import_module
__import__(name)
  File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 9, in 

class Choice(models.Model):
  File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 10, in 
Choice
poll = models.ForeingKey(Poll)
AttributeError: 'module' object has no attribute 'ForeingKey'

I checked my module and everything seems ok: 

  1 from django.db import models
  2 
  3 # Create your models here.
  4 
  5 class Poll(models.Model):
  6 question = models.CharField(max_length=200)
  7 pub_date = models.DateTimeField('date published')
  8 
  9 class Choice(models.Model):
 10 poll = models.ForeingKey(Poll)
 11 choice = models.CharField(max_length=200)
 12 votes = models.IntegerField()
 13 

Thank you for helping me.

Cheers,

Rodrigo

-- 
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/-/RF82XBgPJ8QJ.
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: Installing Djando and tutor polls app

2012-10-25 Thread Lachlan Musicman
On Fri, Oct 26, 2012 at 10:39 AM, Rodrigo Morgado
 wrote:
> Hi everybody,
>
> I'm new in Django framework. I installed version 1.3.1 over Python 2.7.3 in
> Ubuntu.
> I already did all steps but i have an error when i execute python manage.py
> sql polls to create my table's project in mysql.
>
> Traceback (most recent call last):
>   File "manage.py", line 14, in 
> execute_manager(settings)
>   File
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line
> 438, in execute_manager
> utility.execute()
>   File
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line
> 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> line 219, in execute
> self.validate()
>   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> line 249, in validate
> num_errors = get_validation_errors(s, app)
>   File
> "/usr/lib/python2.7/dist-packages/django/core/management/validation.py",
> line 35, in get_validation_errors
> for (app_name, error) in get_app_errors().items():
>   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 146, in get_app_errors
> self._populate()
>   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 61, in _populate
> self.load_app(app_name, True)
>   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line
> 78, in load_app
> models = import_module('.models', app_name)
>   File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line
> 35, in import_module
> __import__(name)
>   File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 9, in
> 
> class Choice(models.Model):
>   File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 10, in
> Choice
> poll = models.ForeingKey(Poll)
> AttributeError: 'module' object has no attribute 'ForeingKey'
>
> I checked my module and everything seems ok:
>
>   1 from django.db import models
>   2
>   3 # Create your models here.
>   4
>   5 class Poll(models.Model):
>   6 question = models.CharField(max_length=200)
>   7 pub_date = models.DateTimeField('date published')
>   8
>   9 class Choice(models.Model):
>  10 poll = models.ForeingKey(Poll)
>  11 choice = models.CharField(max_length=200)
>  12 votes = models.IntegerField()


It's a subtle spelling error:
poll = models.ForeingKey(Poll)

should be

poll = models.ForeignKey(Poll)

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



Re: Installing Djando and tutor polls app

2012-10-25 Thread Stephen Anto
Hi,

as Lachian said, It is spelling mistake for ForeignKey. Just correct your
word.

On Fri, Oct 26, 2012 at 8:56 AM, Lachlan Musicman  wrote:

> On Fri, Oct 26, 2012 at 10:39 AM, Rodrigo Morgado
>  wrote:
> > Hi everybody,
> >
> > I'm new in Django framework. I installed version 1.3.1 over Python 2.7.3
> in
> > Ubuntu.
> > I already did all steps but i have an error when i execute python
> manage.py
> > sql polls to create my table's project in mysql.
> >
> > Traceback (most recent call last):
> >   File "manage.py", line 14, in 
> > execute_manager(settings)
> >   File
> > "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line
> > 438, in execute_manager
> > utility.execute()
> >   File
> > "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py",
> line
> > 379, in execute
> > self.fetch_command(subcommand).run_from_argv(self.argv)
> >   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> > line 191, in run_from_argv
> > self.execute(*args, **options.__dict__)
> >   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> > line 219, in execute
> > self.validate()
> >   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> > line 249, in validate
> > num_errors = get_validation_errors(s, app)
> >   File
> > "/usr/lib/python2.7/dist-packages/django/core/management/validation.py",
> > line 35, in get_validation_errors
> > for (app_name, error) in get_app_errors().items():
> >   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py",
> line
> > 146, in get_app_errors
> > self._populate()
> >   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py",
> line
> > 61, in _populate
> > self.load_app(app_name, True)
> >   File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py",
> line
> > 78, in load_app
> > models = import_module('.models', app_name)
> >   File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line
> > 35, in import_module
> > __import__(name)
> >   File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 9, in
> > 
> > class Choice(models.Model):
> >   File "/home/ewok/www/webapp_camposchilenos/polls/models.py", line 10,
> in
> > Choice
> > poll = models.ForeingKey(Poll)
> > AttributeError: 'module' object has no attribute 'ForeingKey'
> >
> > I checked my module and everything seems ok:
> >
> >   1 from django.db import models
> >   2
> >   3 # Create your models here.
> >   4
> >   5 class Poll(models.Model):
> >   6 question = models.CharField(max_length=200)
> >   7 pub_date = models.DateTimeField('date published')
> >   8
> >   9 class Choice(models.Model):
> >  10 poll = models.ForeingKey(Poll)
> >  11 choice = models.CharField(max_length=200)
> >  12 votes = models.IntegerField()
>
>
> It's a subtle spelling error:
> poll = models.ForeingKey(Poll)
>
> should be
>
> poll = models.ForeignKey(Poll)
>
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Thanks & Regards
Stephen S



Website: www.f2finterview.com
Blog:  blog.f2finterview.com
Tutorial:  tutorial.f2finterview.com
Group:www.charvigroups.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [ANNOUNCE] Django 1.5 alpha 1 released

2012-10-25 Thread Stephen Anto
Hi,

Nice to hear thank you so much for all who worked together for coming
up new version.

On Fri, Oct 26, 2012 at 1:28 AM, James Bennett wrote:

> Our first milestone on the road to Django 1.5 came today, with the
> release of the first alpha package.
>
> Blog post about it is here:
>
> https://www.djangoproject.com/weblog/2012/oct/25/15-alpha-1/
>
> Release notes are here:
>
> https://docs.djangoproject.com/en/dev/releases/1.5-alpha-1/
>
> And you can get the alpha from the downloads page:
>
> https://www.djangoproject.com/download/
>
> --
> 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.
>
>


-- 
Thanks & Regards
Stephen S



Website: www.f2finterview.com
Blog:  blog.f2finterview.com
Tutorial:  tutorial.f2finterview.com
Group:www.charvigroups.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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.