Re: Django Inline formset with jquery

2015-02-17 Thread aRkadeFR

Hello,

I got the same kind of probleme while working on the formset
couple days ago.

If this is related, the problem is the auto complete javascript that
doesn't go well with the jquery.formset.js.

You can add a function "added" in parameter of the formset function
for reloading the autocomplete widget.

something like:
```
|
$(function() {
$(".inline.{{ orderformset.prefix }}").formset({
prefix: "{{ orderformset.prefix }}",
added: function () { reload_auto_complete(); },
})
})
|
```

About the deletion, is it on the front end or the backend you're
talking about?

If this is front -> check your javascript
If this is backend -> check all the values dumping request.POST

Hope I was useful


On 02/17/2015 06:01 AM, Ajay Kumar wrote:
Here by choosing serial_no and the rest of the fields name and author 
should be auto populate. Auto populate works for first inline formset 
and able to save it but when I add another inline formset auto 
populate is not working plus I'm unable to delete it or save it.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E2FF5F.2070509%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Problem with submitting form in my django project! Urgent help required

2015-02-17 Thread Ketan Bhatt


I am facing a problem with my project, I posted about it on Stack Overflow, 
here is the link: 
http://stackoverflow.com/questions/28539441/reference-objects-using-foreign-keys-in-django-forms


Here is m code on github, I am currently working on the feature_forms 
branch: https://github.com/ketanbhatt/sketch-a-wish/tree/feature_forms


I will summarize my problem again, I am building a site in which users can 
login and make a wish. Other users can first a get a wish to sketch, and 
then submit the sketch they made for the assigned wish.

I have been able to create all the views and forms, except for the 
submitting sketch view. I want:

1. Only the wishes that has been assigned to the logged in user to be 
displayed in the Submit_sketch form

2. User selects the wish he wants to upload the sketch for, and submits.


Please help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ee013223-1beb-4a1b-80a7-3f72867724d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError

2015-02-17 Thread aRkadeFR

Hello :)

Can you dump us the layout of your files?
Where is your forms.py?

Thanks

On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
Hello all, I am trying to build and e_commerc django app, but I have 
encounter an confusing error.

Mine Error is:
|
Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.7.4
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'profiles')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Template error:
In template 
/home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html, error 
at line 15

 cannot import name contactForm
   5 :   data-toggle="collapse" data-target="#navbar" aria-expanded="false" 
aria-controls="navbar">



   6 : Toggle navigation


   7 : 


   8 : 


   9 : 


   10 :   


   11 :   Bootstrap theme


   12 : 


   13 : 


   14 :   


   15 : {% url 'home' as home %}


   16 :{% url 'about' as about %}


   17 :{% url 'contact' as contact %}


   18 : {%endif%}>Home



   19 : {%endif%}>About



   20 : class="active" {%endif%}>Contact



   21 : 


   22 :   data-toggle="dropdown" role="button" aria-expanded="false">Dropdown 




   23 :   


   24 : Action


   25 : Another action


Traceback:
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/core/handlers/base.py" 
in get_response
  111. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)
File 
"/home/petarp/Documents/Udemy/Learn_Django/source/profiles/views.py" 
in home

  7.   return render(request, tempalte, context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/shortcuts.py" 
in render

  50. return HttpResponse(loader.render_to_string(*args, **kwargs),
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader.py" 
in render_to_string

  178. return t.render(context_instance)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

  148. return self._render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in _render

  142. return self.nodelist.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

  844. bit = self.render_node(node, context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py" 
in render_node

  80. return node.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader_tags.py" 
in render

  126. return compiled_parent._render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in _render

  142. return self.nodelist.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

  844. bit = self.render_node(node, context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py" 
in render_node

  80. return node.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader_tags.py" 
in render

  150. return template.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

  148. return self._render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in _render

  142. return self.nodelist.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

  844. bit = self.render_node(node, context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py" 
in render_node

  80. return node.render(context)
File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/defaulttags.py" 
in render
  444.   

Re: ImportError

2015-02-17 Thread Petar Pilipovic
Hello, I can not do it wright now I am not at home.
As for mine forms.py, it is in mine contact app. I have two apps in mine
root project, one off them is contact.
I will send you more info as soon as posible.
Tank you.


On Tuesday, February 17, 2015, aRkadeFR  wrote:
> Hello :)
>
> Can you dump us the layout of your files?
> Where is your forms.py?
>
> Thanks
>
> On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
>
> Hello all, I am trying to build and e_commerc django app, but I have
encounter an confusing error.
> Mine Error is:
> Environment:
>
> Request Method: GET
> Request URL: http://127.0.0.1:8000/
> Django Version: 1.7.4
> Python Version: 2.7.6
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'profiles')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
> Template error:
> In template
/home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html,
error at line 15
>cannot import name contactForm
>5 :   
>
>6 : Toggle navigation
>
>7 : 
>
>8 : 
>
>9 : 
>
>10 :   
>
>11 :   Bootstrap theme
>
>12 : 
>
>13 : 
>
>14 :   
>
>15 : {% url 'home' as home %}
>
>16 :{% url 'about' as about %}
>
>17 :{% url 'contact' as contact %}
>
>18 : Home
>
>19 : About
>
>20 : Contact
>
>21 : 
>
>22 :   Dropdown 
>
>23 :   
>
>24 : Action
>
>25 : Another action
>
> Traceback:
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/core/handlers/base.py"
in get_response
>   111. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
> File "/home/petarp/Documents/Udemy/Learn_Django/source/profiles/views.py"
in home
>   7. return render(request, tempalte, context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/shortcuts.py"
in render
>   50. return HttpResponse(loader.render_to_string(*args, **kwargs),
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader.py"
in render_to_string
>   178. return t.render(context_instance)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>   148. return self._render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in _render
>   142. return self.nodelist.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>   844. bit = self.render_node(node, context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py"
in render_node
>   80. return node.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader_tags.py"
in render
>   126. return compiled_parent._render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in _render
>   142. return self.nodelist.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>   844. bit = self.render_node(node, context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py"
in render_node
>   80. return node.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader_tags.py"
in render
>   150. return template.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>   148. return self._render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in _render
>   142. return self.nodelist.render(context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>   844. bit = self.render_node(node, context)
> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py"
in ren

Re: ImportError

2015-02-17 Thread Petar Pilipovic
Maybea this can help you, a bref info :
I made a contact app, I have defined app url in mine url root project, then
i made a forms.py file, i have defined form in it, then i have made
contact.html where I have defined contact.html form which mine app will
render, I have then go to views.py an imported contactForm class.
Afther that I have defined connection between  contact.html page and
navbar.html, collected static, run server and bam error occur.
I just can not explain to mine self how come he can not import contactForm,
and how com he can not render havbar.html, error pop's out line 15.
On Tuesday, February 17, 2015, Petar Pilipovic  wrote:
> Hello, I can not do it wright now I am not at home.
> As for mine forms.py, it is in mine contact app. I have two apps in mine
root project, one off them is contact.
> I will send you more info as soon as posible.
> Tank you.
>
>
> On Tuesday, February 17, 2015, aRkadeFR  wrote:
>> Hello :)
>>
>> Can you dump us the layout of your files?
>> Where is your forms.py?
>>
>> Thanks
>>
>> On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
>>
>> Hello all, I am trying to build and e_commerc django app, but I have
encounter an confusing error.
>> Mine Error is:
>> Environment:
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/
>> Django Version: 1.7.4
>> Python Version: 2.7.6
>> Installed Applications:
>> ('django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'profiles')
>> Installed Middleware:
>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>
>> Template error:
>> In template
/home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html,
error at line 15
>>cannot import name contactForm
>>5 :   
>>
>>6 : Toggle navigation
>>
>>7 : 
>>
>>8 : 
>>
>>9 : 
>>
>>10 :   
>>
>>11 :   Bootstrap theme
>>
>>12 : 
>>
>>13 : 
>>
>>14 :   
>>
>>15 : {% url 'home' as home %}
>>
>>16 :{% url 'about' as about %}
>>
>>17 :{% url 'contact' as contact %}
>>
>>18 : Home
>>
>>19 : About
>>
>>20 : Contact
>>
>>21 : 
>>
>>22 :   Dropdown 
>>
>>23 :   
>>
>>24 : Action
>>
>>25 : Another action
>>
>> Traceback:
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/core/handlers/base.py"
in get_response
>>   111. response = wrapped_callback(request,
*callback_args, **callback_kwargs)
>> File
"/home/petarp/Documents/Udemy/Learn_Django/source/profiles/views.py" in home
>>   7. return render(request, tempalte, context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/shortcuts.py"
in render
>>   50. return HttpResponse(loader.render_to_string(*args, **kwargs),
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader.py"
in render_to_string
>>   178. return t.render(context_instance)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>>   148. return self._render(context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in _render
>>   142. return self.nodelist.render(context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>>   844. bit = self.render_node(node, context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py"
in render_node
>>   80. return node.render(context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader_tags.py"
in render
>>   126. return compiled_parent._render(context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in _render
>>   142. return self.nodelist.render(context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py"
in render
>>   844. bit = self.render_node(node, context)
>> File
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py"
in render_node
>>   80. return node.render(context)
>> File
"/home/

Re: ImportError

2015-02-17 Thread aRkadeFR

Two different problems here.

For your import of contactForm, please try the relative import like:
from contact.forms import contactForm
> contact is your app name

try the (absolute_import)[1] too if you're python2.

[1] https://docs.python.org/2/library/__future__.html

Let us know if this works

On 02/17/2015 01:30 PM, Petar Pilipovic wrote:

Maybea this can help you, a bref info :
I made a contact app, I have defined app url in mine url root project, 
then i made a forms.py file, i have defined form in it, then i have 
made contact.html where I have defined contact.html form which mine 
app will render, I have then go to views.py an imported contactForm class.
Afther that I have defined connection between  contact.html page and 
navbar.html, collected static, run server and bam error occur.
I just can not explain to mine self how come he can not import 
contactForm, and how com he can not render havbar.html, error pop's 
out line 15.
On Tuesday, February 17, 2015, Petar Pilipovic > wrote:

> Hello, I can not do it wright now I am not at home.
> As for mine forms.py, it is in mine contact app. I have two apps in 
mine root project, one off them is contact.

> I will send you more info as soon as posible.
> Tank you.
>
>
> On Tuesday, February 17, 2015, aRkadeFR > wrote:

>> Hello :)
>>
>> Can you dump us the layout of your files?
>> Where is your forms.py?
>>
>> Thanks
>>
>> On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
>>
>> Hello all, I am trying to build and e_commerc django app, but I 
have encounter an confusing error.

>> Mine Error is:
>> Environment:
>>
>> Request Method: GET
>> Request URL: http://127.0.0.1:8000/
>> Django Version: 1.7.4
>> Python Version: 2.7.6
>> Installed Applications:
>> ('django.contrib.admin',
>>  'django.contrib.auth',
>>  'django.contrib.contenttypes',
>>  'django.contrib.sessions',
>>  'django.contrib.messages',
>>  'django.contrib.staticfiles',
>>  'profiles')
>> Installed Middleware:
>> ('django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.common.CommonMiddleware',
>>  'django.middleware.csrf.CsrfViewMiddleware',
>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>>  'django.contrib.messages.middleware.MessageMiddleware',
>>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>>
>> Template error:
>> In template 
/home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html, error 
at line 15

>>cannot import name contactForm
>>5 :   aria-expanded="false" aria-controls="navbar">

>>
>>6 : Toggle navigation
>>
>>7 : 
>>
>>8 : 
>>
>>9 : 
>>
>>10 :   
>>
>>11 :   Bootstrap theme
>>
>>12 : 
>>
>>13 : 
>>
>>14 :   
>>
>>15 : {% url 'home' as home %}
>>
>>16 :{% url 'about' as about %}
>>
>>17 :{% url 'contact' as contact %}
>>
>>18 : class="active" {%endif%}>Home

>>
>>19 : class="active" {%endif%}>About

>>
>>20 : class="active" {%endif%}>Contact

>>
>>21 : 
>>
>>22 :   data-toggle="dropdown" role="button" aria-expanded="false">Dropdown 


>>
>>23 :   
>>
>>24 : Action
>>
>>25 : Another action
>>
>> Traceback:
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/core/handlers/base.py" 
in get_response
>>   111. response = wrapped_callback(request, 
*callback_args, **callback_kwargs)
>> File 
"/home/petarp/Documents/Udemy/Learn_Django/source/profiles/views.py" 
in home

>>   7. return render(request, tempalte, context)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/shortcuts.py" 
in render

>>   50. return HttpResponse(loader.render_to_string(*args, **kwargs),
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader.py" 
in render_to_string

>>   178. return t.render(context_instance)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

>>   148. return self._render(context)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in _render

>>   142. return self.nodelist.render(context)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/base.py" 
in render

>>   844. bit = self.render_node(node, context)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/debug.py" 
in render_node

>>   80. return node.render(context)
>> File 
"/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packa

Installare versioni successive

2015-02-17 Thread Paola Di Tomasso
Ciao a tutti sono nuova  del gruppo,
io ho django 1.6.x e ho l'esigenza  di passare alle 1.7, devo fare qualcosa 
 di preciso o semplicemente istallando la 1.7 effettua  l'aggiornamento 
alla versione successiva.

Grazie  mille 
Paola.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7283738-af94-4971-82b9-5b6c965bdb2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installare versioni successive

2015-02-17 Thread aRkadeFR

Hello there,

I think this is an English mailing list. From google translate, I
understood you want to upgrade Django 1.6 to 1.7.

Please read the following releases notes:
https://docs.djangoproject.com/en/1.7/releases/1.7/
more specifically:
https://docs.djangoproject.com/en/1.7/releases/1.7/#backwards-incompatible-changes-in-1-7

Check that nothing breaks, and then you can just upgrade
your version :)


On 02/17/2015 04:32 PM, Paola Di Tomasso wrote:

Ciao a tutti sono nuova  del gruppo,
io ho django 1.6.x e ho l'esigenza  di passare alle 1.7, devo fare 
qualcosa  di preciso o semplicemente istallando la 1.7 effettua 
 l'aggiornamento alla versione successiva.


Grazie  mille
Paola.
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e7283738-af94-4971-82b9-5b6c965bdb2f%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E361D7.708%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Necesito ayuda para poner a funcionar django el tutorial no lo entiendo

2015-02-17 Thread Anibal Manuel Solorzano Nuñez
alguieme puede colaborar sobre como iniciar a trabajar con django apenas lo 
tengo instalado
y no que archivo ejecutar y no entiendo como es que hay que trabajar con 
python

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97683752-e920-4b4a-a203-85432bbbe9a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: drop-in replacement for admin module foreign key relation UI

2015-02-17 Thread Jani Kajala
That's perfect, thanks

On Tuesday, February 17, 2015 at 1:20:22 AM UTC-6, Jani Tiainen wrote:
>
> On Mon, 16 Feb 2015 15:03:05 -0800 (PST) 
> Jani Kajala > wrote: 
>
> > Hi all, 
> > 
> > I have tons of objects referenced by ForeignKey in Django Admin module 
> UI, 
> > and I would like to replace it with something more optimal, e.g. 
> auto-fill 
> > input box or something. 
> > 
> > My model looks something like this: 
> > 
> > class SoapCall(models.Model): 
> > customer = models.ForeignKey(Customer, null=True, blank=True) 
> > created = models.DateTimeField(default=now) 
> > wsdl = models.CharField(max_length=255) 
> > func = models.CharField(max_length=63) 
> > request = models.TextField() 
> > response = models.TextField() 
> > 
> > Now, this works great, but if I have 10 Customer objects it's not 
> very 
> > nice to generate one huge ... element for every page 
> load. 
> > 
> > There seems to be many possible plugins/implementations for this, but I 
> was 
> > just wondering if anyone would have up-to-date recommendations in this 
> > mailing list. I'm on Python 3.4.2 and Django 1.7.4. 
>
> I would start with built-in implementation, a.k.a. rawid_id_fields <
> https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields>
>  
>
>
>
> -- 
> Jani Tiainen 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7c7abc82-1766-4141-ab1e-706a6165604f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Necesito ayuda para poner a funcionar django el tutorial no lo entiendo

2015-02-17 Thread Charly Román
este grupo es de habla inglesa, te recomiendo:
https://groups.google.com/forum/#!forum/django-es Y definitivamente debes
proveer más información.

2015-02-17 9:41 GMT-06:00 Anibal Manuel Solorzano Nuñez <
solorzanoanibalman...@gmail.com>:

> alguieme puede colaborar sobre como iniciar a trabajar con django apenas
> lo tengo instalado
> y no que archivo ejecutar y no entiendo como es que hay que trabajar con
> python
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/97683752-e920-4b4a-a203-85432bbbe9a9%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Charly Román
Software Developer
http://croman.mx

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABeWMUYHvBEtAGEeKOHckOEMNE1ZywU%2BDp8d6_aLCV0cP%2BjwqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Trouble changing from sqlite3 to postgres

2015-02-17 Thread tony . guil35
I have written a simple Django app (my first) that works with sqlite3 
database.
I want to change to postgres, but when I run the Django 1.7 migration 
utility  with the command
"python manage.py migrate"

I get the error:
psycopg2.ProgrammingError: column "date" cannot be cast automatically 
to type integer

Which is occuring in:
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params

I am not sure how to track down the problem.
I am running Slackware Linux.

My models.py file is as follows:


from django.db import models
import datetime

# Create your models here.

class Location(models.Model):

   class Meta:
  unique_together = ("lat", "lng")

   lat  = models.DecimalField(max_digits=8, decimal_places=5)
   lng  = models.DecimalField(max_digits=8, decimal_places=5)
   name = models.CharField(max_length=200,  unique=True)

   def __str__(self):
  return "%s: %d %d" % (self.name, self.lat, self.lng)

class Observation(models.Model):

   date = models.DateField()
   location = models.ForeignKey(Location)
   observer = models.CharField(max_length=50)
   temperature = models.FloatField(default=0.0)
   photo= models.ImageField(default="tower.jpg", 
upload_to="uploaded_photos")

   def __str__(self):
  return self.observer
=

The DATABASE part of my settings.py file is as follows
where I have commented-out the old sqlite3 part:

-
DATABASES = {

#   'default': {
#   # sqllite3
#   'ENGINE': 'django.db.backends.sqlite3',
#   'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#   }

   # For postgres:
#'django.db.backends.postgresql_psycopg2', 
# USER, PASSWORD, HOST also needed
# Inside postgres, "CREATE DATABASE database_name"

 'default': {
 'ENGINE': 'django.db.backends.postgresql_psycopg2',
 'NAME': 'app_1_db',
 'USER': 'bill',
 'PASSWORD': 'bill',
 'HOST': '127.0.0.1',
 'PORT': '5432',
 }

}


Please let me know if you have ideas.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b905e0f0-898b-4c6e-9141-a33987270476%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


confirm_login_allowed in subclassed authentication returns wrong error message

2015-02-17 Thread Tomáš Sekanina
Hello, 

I have a custom user model and I need to extend the user authentication 
during login and found this solution: http://bit.ly/1u705o9  It would work 
great for me and I ended up implementing this  . 
It works in a manner that it does not let such user log in, but raises a 
different error message which is: 'Sorry, that's not a valid username or 
password.'.  I tried posting this question on different forums but got no 
answer :(. It seems really simple so I do not see there a place for an 
error unless there is some problem with the custom user model. I will be 
glad for your opinion at least :).

Thank you in advance for any effort to solve this. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/49e6d5be-4a4c-411d-8476-e851ea8f3f2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can migrated apps depend on unmigrated apps?

2015-02-17 Thread Carsten Fuchs

Hi all,

Am 04.02.2015 um 18:26 schrieb Carsten Fuchs:

can apps that use migrations depend on unmigrated apps?


Anyone please?

It seems like this works in practice, but this still looks like a 
contradiction to me, and I would still be interested in some feedback 
for a firmer foundation for ongoing work…


Best regards,
Carsten

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E3A4B9.7040009%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


RE: Necesito ayuda para poner a funcionar django el tutorial no loentiendo

2015-02-17 Thread Ricardo Daniel Quiroga
Primero creas un proyecto en un directorio con el comando (abri la consola 
seleciona el directorio donde trabajar y) ejecuta django-admin startproject 
miproyecto se crea una carpeta con lo necesario para tu proyecto django en la 
carpeta ejecutas python manage.py runserver y abres el navegador en 
127.0.0.1:8000 veras un felicidades django esta corriendo luego es crear una 
aplicación, defines los modelos escribes los controladores y diseñas las 
vistas, por ultimo haces deploy, en el tutorial de django esta bastante 
explicado como se trabaja no entiendo que parte te pierdes. 

-Mensaje original-
De: Charly Román
Enviado: 17/02/2015 14:47
Para: django-users@googlegroups.com
Asunto: Re: Necesito ayuda para poner a funcionar django el tutorial no 
loentiendo

este grupo es de habla inglesa, te recomiendo: 
https://groups.google.com/forum/#!forum/django-es Y definitivamente debes 
proveer más información.



2015-02-17 9:41 GMT-06:00 Anibal Manuel Solorzano Nuñez 
:


alguieme puede colaborar sobre como iniciar a trabajar con django apenas lo 
tengo instalado
y no que archivo ejecutar y no entiendo como es que hay que trabajar con python




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/97683752-e920-4b4a-a203-85432bbbe9a9%40googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.
 




-- 


Charly Román
Software Developer
http://croman.mx
 
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/django-users.
 To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABeWMUYHvBEtAGEeKOHckOEMNE1ZywU%2BDp8d6_aLCV0cP%2BjwqA%40mail.gmail.com.
 For more options, visit https://groups.google.com/d/optout.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54e3acf7.0858e00a.17ff.a8de%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: confirm_login_allowed in subclassed authentication returns wrong error message

2015-02-17 Thread James Schneider
You should raise the error in your custom user login form when attempting
to authenticate the user, not directly from the custom user model or
authentication backend.

-James
On Feb 17, 2015 12:20 PM, "Tomáš Sekanina"  wrote:

> Hello,
>
> I have a custom user model and I need to extend the user authentication
> during login and found this solution: http://bit.ly/1u705o9  It would
> work great for me and I ended up implementing this
>  . It works in a manner that it does not
> let such user log in, but raises a different error message which is: 'Sorry,
> that's not a valid username or password.'.  I tried posting this question
> on different forums but got no answer :(. It seems really simple so I do
> not see there a place for an error unless there is some problem with the
> custom user model. I will be glad for your opinion at least :).
>
> Thank you in advance for any effort to solve this.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/49e6d5be-4a4c-411d-8476-e851ea8f3f2a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVteeLtedShe1EJZJo%3D-LZnu7F8DMExaHqk6nnF4XmpFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can migrated apps depend on unmigrated apps?

2015-02-17 Thread Michael Pöhn
On 17.02.2015 21:29, Carsten Fuchs wrote:
> Hi all,
>
> Am 04.02.2015 um 18:26 schrieb Carsten Fuchs:
>> can apps that use migrations depend on unmigrated apps?
>
> Anyone please?
>
> It seems like this works in practice, but this still looks like a
> contradiction to me, and I would still be interested in some feedback
> for a firmer foundation for ongoing work…
>

This is all covered in Djangos documentation...
https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies

Let me paste the relevant parts for you:

»Be aware, however, that unmigrated apps cannot depend on migrated apps,
by the very nature of not having migrations. This means that it is not
generally possible to have an unmigrated app have a ForeignKey or
ManyToManyField to a migrated app; some cases may work, but it will
eventually fail.

Warning: Even if things appear to work with unmigrated apps depending on
migrated apps, Django may not generate all the necessary foreign key
constraints.«

br.
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E3B622.80103%40fsfe.org.
For more options, visit https://groups.google.com/d/optout.


Re: Can migrated apps depend on unmigrated apps?

2015-02-17 Thread Carsten Fuchs

Hi Michael,

Am 17.02.2015 um 22:44 schrieb Michael Pöhn:

This is all covered in Djangos documentation...
https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies


Well, no... please see below.


Let me paste the relevant parts for you:

»Be aware, however, that unmigrated apps cannot depend on migrated apps, [...]«


This explains that unmigrated apps cannot depend on migrated apps.

My question is about the opposite case: Can migrated apps depend on 
unmigrated apps? I've explained the apparent problem in greater detail 
in my original post.


Best regards,
Carsten

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E3B94A.9050307%40cafu.de.
For more options, visit https://groups.google.com/d/optout.


How to make a list-view sortable in frontend?

2015-02-17 Thread ThomasTheDjangoFan
Hi 'ya,

I am new to Django and would like to create a *sortable ListView* (just 
like the Lists in Django Admin) for an array of object-instances. The 
objects themself are *non Django-Models* and are pre-populated in an array 
before showing the view.

I've got a basic ListView working 
(https://docs.djangoproject.com/en/1.7/topics/class-based-views/), 
but the important question remains: *How do I make it sortable? *

Can you give me to some examples to check out how to implement a sortable 
ListView?

Kind regards and thanks a lot for your support
Thomas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9676838b-9df9-46c0-8b57-b1e4aa43ecce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make a list-view sortable in frontend?

2015-02-17 Thread James Schneider
Are you displaying the data in a table? If so, I've always used
django-tables2, which includes the ability to have sorting in each of the
columns via a generated link in the header row of any or all columns
(up/down arrow, etc.).

-James
On Feb 17, 2015 2:43 PM, "ThomasTheDjangoFan" <
stefan.eichholz.ber...@googlemail.com> wrote:

> Hi 'ya,
>
> I am new to Django and would like to create a *sortable ListView* (just
> like the Lists in Django Admin) for an array of object-instances. The
> objects themself are *non Django-Models* and are pre-populated in an
> array before showing the view.
>
> I've got a basic ListView working (
> https://docs.djangoproject.com/en/1.7/topics/class-based-views/),
> but the important question remains: *How do I make it sortable? *
>
> Can you give me to some examples to check out how to implement a sortable
> ListView?
>
> Kind regards and thanks a lot for your support
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9676838b-9df9-46c0-8b57-b1e4aa43ecce%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUBE%2B-s1aX7G%3D-QM82HpHr8NpgLZKpbi6D-PFAoHnLSgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble changing from sqlite3 to postgres

2015-02-17 Thread Joel Burton
The error is probably in code you wrote that uses the date field. Can you 
post the full traceback? That will let us see where the caller was that 
created the problem.

On Tuesday, February 17, 2015 at 3:13:30 PM UTC-5, tony@gmail.com wrote:
>
> I have written a simple Django app (my first) that works with sqlite3 
> database.
> I want to change to postgres, but when I run the Django 1.7 migration 
> utility  with the command
> "python manage.py migrate"
>
> I get the error:
> psycopg2.ProgrammingError: column "date" cannot be cast automatically 
> to type integer
>
> Which is occuring in:
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
> return self.cursor.execute(sql, params
>
> I am not sure how to track down the problem.
> I am running Slackware Linux.
>
> My models.py file is as follows:
>
> 
> from django.db import models
> import datetime
>
> # Create your models here.
>
> class Location(models.Model):
>
>class Meta:
>   unique_together = ("lat", "lng")
>
>lat  = models.DecimalField(max_digits=8, decimal_places=5)
>lng  = models.DecimalField(max_digits=8, decimal_places=5)
>name = models.CharField(max_length=200,  unique=True)
>
>def __str__(self):
>   return "%s: %d %d" % (self.name, self.lat, self.lng)
>
> class Observation(models.Model):
>
>date = models.DateField()
>location = models.ForeignKey(Location)
>observer = models.CharField(max_length=50)
>temperature = models.FloatField(default=0.0)
>photo= models.ImageField(default="tower.jpg", 
> upload_to="uploaded_photos")
>
>def __str__(self):
>   return self.observer
> =
>
> The DATABASE part of my settings.py file is as follows
> where I have commented-out the old sqlite3 part:
>
> -
> DATABASES = {
>
> #   'default': {
> #   # sqllite3
> #   'ENGINE': 'django.db.backends.sqlite3',
> #   'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> #   }
>
># For postgres:
> #'django.db.backends.postgresql_psycopg2', 
> # USER, PASSWORD, HOST also needed
> # Inside postgres, "CREATE DATABASE database_name"
>
>  'default': {
>  'ENGINE': 'django.db.backends.postgresql_psycopg2',
>  'NAME': 'app_1_db',
>  'USER': 'bill',
>  'PASSWORD': 'bill',
>  'HOST': '127.0.0.1',
>  'PORT': '5432',
>  }
>
> }
>
> 
>
> Please let me know if you have ideas.
>
> Thanks.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df155cf9-9ba7-42fd-b9b2-2a78f433ca21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Form Wizard: how to send instance_dict based on the request

2015-02-17 Thread Karim
Hello mates!

I have some problems to understand how to set the view for
the NamedUrlSessionWizardView creating a instance_dict based on the user in
the request.

in my urls.py

url(r'wizard/new/(?P.+)/$',
ServiceCUWizard.as_view(
   FORMS,   # the list of ['form_name', form_object]
   url_name='service:new_wizard_step',
   done_step_name='finished',
), name='new_wizard_step'),

It works, I got all the forms as expected.

The forms are modelforms and I would like to bound the instance if is
possible, but I can populate it only using the request. I think I could do
that subclassing def __init__, but the instance_dict is a class attribute,
how I can populate it?

Thnak you



-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACeuRGVpYubs4vekD3ynEP9oAMeF8NcZXVV2PmBOT%2BaukGL8qQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble changing from sqlite3 to postgres

2015-02-17 Thread tony . guil35
The error occurs during migration.
The following shows the complete traceback.
Thanks.

% python manage migrate
WFK: BASE_DIR= /home/bill/django/wfkprojs/proj1
WFK: STATIC_PATH= /home/bill/django/wfkprojs/proj1/app_1/static/
WFK: MEDIA_ROOT= /home/bill/django/wfkprojs/proj1/app_1/media_root/
WFK: MEDIA_URL= /media_root/
Operations to perform:
  Apply all migrations: contenttypes, app_1, sessions, auth, admin
Running migrations:
  Applying app_1.0003_auto_20141126_2333...Traceback (most recent call 
last):
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "date" cannot be cast automatically to 
type integer
HINT:  Specify a USING expression to perform the conversion.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 385, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 288, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 338, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/commands/migrate.py",
 
line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
line 63, in migrate
self.apply_migration(migration, fake=fake)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
line 97, in apply_migration
migration.apply(project_state, schema_editor)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/migration.py", 
line 107, in apply
operation.database_forwards(self.app_label, schema_editor, 
project_state, new_state)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/operations/fields.py",
 
line 139, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
473, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type, 
old_db_params, new_db_params, strict)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
626, in _alter_field
params,
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
99, in execute
cursor.execute(sql, params)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.3/site-packages/django/db/utils.py", line 
94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.3/site-packages/django/utils/six.py", line 
549, in reraise
raise value.with_traceback(tb)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "date" cannot be cast 
automatically to type integer
HINT:  Specify a USING expression to perform the conversion.


On Tuesday, February 17, 2015 at 4:39:27 PM UTC-8, Joel Burton wrote:
>
> The error is probably in code you wrote that uses the date field. Can you 
> post the full traceback? That will let us see where the caller was that 
> created the problem.
>
> On Tuesday, February 17, 2015 at 3:13:30 PM UTC-5, tony@gmail.com 
> wrote:
>>
>> I have written a simple Django app (my first) that works with sqlite3 
>> database.
>> I want to change to postgres, but when I run the Django 1.7 migration 
>> utility  with the command
>> "python manage.py migrate"
>>
>> I get the error:
>> psycopg2.ProgrammingError: column "date" cannot be cast automatically 
>> to type integer
>>
>> Which is occuring in:
>>   File 
>> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
>> 65, in execute
>> return self.cursor.execute(sql, params
>>
>> I am not sure how to track down the problem.
>> I am running Slackware Linux.
>>
>> My models.py file is as follows:
>>
>> 
>> from django.db import models
>> import datetime
>>
>> # Create your models here.
>>
>> class Location(models.Model):
>>
>>

how to handle race conditions?

2015-02-17 Thread Abraham Varricatt
Hello,

I'm trying to make an app where folks can order X quantity of an item. The 
condition is that the order should only be made if inventory exists. Assume 
that we have stock of Y items. This means that only if Y >= X should we 
allow the sale to go through. And once we accept an order, the inventory 
should be updated so that Y = Y - X. 

The way I've currently implemented this is with a pair of getter/setter 
methods. I have a model 'ShopItem' which has two fields called 'quantity' 
and 'name' (this is unique). I've made a utility class (outside model 
source file) where I've made the following 2 functions;

def get_quantity(name):
  stuff_left = 0
  try:
item = ShopItem.objects.get(name=name)
stuff_left = item.quantity
  except ShopItem.DoesNotExist:
pass # return zero
  return stuff_left

def set_quantity(name, stuff_left):
  item = ShopItem.objects.get(name=name)
  item.quantity = stuff_left
  item.save()


Elsewhere in my project, if I need to display the remaining quantity of an 
item in a view, I'll pass the result from get_quantity(). At sale time here 
is how I update things;

def customer_buy(name, number):
  temp = get_quantity(name)
  if (temp >= number):
temp = temp - number
set_quantity(name, temp)
// do other things
  else:
// sale failed, do something else

I tested this on my system and things appear to work. But I'm concerned 
about race conditions. What if two different customers came in to buy the 
same item? As in; if I only have 7 items in stock, but one customer came to 
buy 6nos and another 5nos. There is a chance (as per my understanding) that 
both orders will be accepted - even worse, my inventory will not accurately 
reflect the updated situation. 

Any ideas on how this issue can be resolved? I've come across this 
- 
https://docs.djangoproject.com/en/1.6/ref/models/instances/#updating-attributes-based-on-existing-fields
 
, but not sure how to apply it to the current scenario. 

Learning django,
Abraham V.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7552759e-81d6-4cfb-a0ce-4fed95eef5bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ImportError

2015-02-17 Thread Petar Pilipovic
Hello aRkadeFR.
I have solved mine problem, I was working whit Python 2.X here, and like 
you recommended I have done some  absolute import.
from forms import contactForm ,  and that solved it.
There was one other error, mine base.html did not render mine block 
content, because I did not defined it, I did that and now mine form is 
working.
Tank you.
Best.
Petar...;-)



On Tuesday, 17 February 2015 14:57:46 UTC+1, aRkadeFR wrote:
>
>  Two different problems here.
>
> For your import of contactForm, please try the relative import like:
> from contact.forms import contactForm
> > contact is your app name
>
> try the (absolute_import)[1] too if you're python2.
>
> [1] https://docs.python.org/2/library/__future__.html
>
> Let us know if this works
>
> On 02/17/2015 01:30 PM, Petar Pilipovic wrote:
>  
> Maybea this can help you, a bref info : 
> I made a contact app, I have defined app url in mine url root project, 
> then i made a forms.py file, i have defined form in it, then i have made 
> contact.html where I have defined contact.html form which mine app will 
> render, I have then go to views.py an imported contactForm class.
> Afther that I have defined connection between  contact.html page and 
> navbar.html, collected static, run server and bam error occur.
> I just can not explain to mine self how come he can not import 
> contactForm, and how com he can not render havbar.html, error pop's out 
> line 15.
> On Tuesday, February 17, 2015, Petar Pilipovic  > wrote:
> > Hello, I can not do it wright now I am not at home.
> > As for mine forms.py, it is in mine contact app. I have two apps in mine 
> root project, one off them is contact.
> > I will send you more info as soon as posible.
> > Tank you.
> >
> >
> > On Tuesday, February 17, 2015, aRkadeFR  > wrote:
> >> Hello :)
> >>
> >> Can you dump us the layout of your files?
> >> Where is your forms.py?
> >>
> >> Thanks
> >>
> >> On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
> >>
> >> Hello all, I am trying to build and e_commerc django app, but I have 
> encounter an confusing error.
> >> Mine Error is:
> >> Environment:
> >>
> >> Request Method: GET
> >> Request URL: http://127.0.0.1:8000/
> >> Django Version: 1.7.4
> >> Python Version: 2.7.6
> >> Installed Applications:
> >> ('django.contrib.admin',
> >>  'django.contrib.auth',
> >>  'django.contrib.contenttypes',
> >>  'django.contrib.sessions',
> >>  'django.contrib.messages',
> >>  'django.contrib.staticfiles',
> >>  'profiles')
> >> Installed Middleware:
> >> ('django.contrib.sessions.middleware.SessionMiddleware',
> >>  'django.middleware.common.CommonMiddleware',
> >>  'django.middleware.csrf.CsrfViewMiddleware',
> >>  'django.contrib.auth.middleware.AuthenticationMiddleware',
> >>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
> >>  'django.contrib.messages.middleware.MessageMiddleware',
> >>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
> >>
> >> Template error:
> >> In template 
> /home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html, 
> error at line 15
> >>cannot import name contactForm
> >>5 :data-toggle="collapse" data-target="#navbar" aria-expanded="false" 
> aria-controls="navbar">
> >>
> >>6 : Toggle navigation
> >>
> >>7 : 
> >>
> >>8 : 
> >>
> >>9 : 
> >>
> >>10 :   
> >>
> >>11 :   Bootstrap theme
> >>
> >>12 : 
> >>
> >>13 : 
> >>
> >>14 :   
> >>
> >>15 : {% url 'home' as home %} 
> >>
> >>16 :{% url 'about' as about %}
> >>
> >>17 :{% url 'contact' as contact %}
> >>
> >>18 :  {%endif%}>Home
> >>
> >>19 :  {%endif%}>About
> >>
> >>20 :  {%endif%}>Contact
> >>
> >>21 : 
> >>
> >>22 :data-toggle="dropdown" role="button" aria-expanded="false">Dropdown  class="caret">
> >>
> >>23 :   
> >>
> >>24 : Action
> >>
> >>25 : Another action
> >>
> >> Traceback:
> >> File 
> "/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/core/handlers/base.py"
>  
> in get_response
> >>   111. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
> >> File 
> "/home/petarp/Documents/Udemy/Learn_Django/source/profiles/views.py" in home
> >>   7. return render(request, tempalte, context)
> >> File 
> "/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/shortcuts.py"
>  
> in render
> >>   50. return HttpResponse(loader.render_to_string(*args, **kwargs),
> >> File 
> "/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/template/loader.py"
>  
> in render_to_string
> >>   178. return t.render(context_instance)
> >> File 
> "/home/petarp/.virtualenvs/e_udemy/local/lib/python2.7/site-packages/django/templa

Re: ImportError

2015-02-17 Thread Petar Pilipovic
aRkadeFR I have one other question regarding urls.py. I got this error when 
I am trying to go from contact or about to home page.


Using the URLconf defined in tryDjango.urls, Django tried these URL 
patterns, in this order:

   1. ^$ [name='home']
   2. ^about/$ [name='about']
   3. ^contact/$ [name='contact']
   4. ^admin/
   5. ^static\/(?P.*)$
   6. ^media\/(?P.*)$

The current URL, contact/{% url 'home' %}, didn't match any of these.

Now mine root/urls.py , and this is mine navbar.html 
, every other thing is connected properly, and I can 
go from home page to contact, about, but I can not go reverse.
Can you explain to me where is the error?
Tank you.

On Wednesday, 18 February 2015 06:02:54 UTC+1, Petar Pilipovic wrote:
>
> Hello aRkadeFR.
> I have solved mine problem, I was working whit Python 2.X here, and like 
> you recommended I have done some  absolute import.
> from forms import contactForm ,  and that solved it.
> There was one other error, mine base.html did not render mine block 
> content, because I did not defined it, I did that and now mine form is 
> working.
> Tank you.
> Best.
> Petar...;-)
>
>
>
> On Tuesday, 17 February 2015 14:57:46 UTC+1, aRkadeFR wrote:
>>
>>  Two different problems here.
>>
>> For your import of contactForm, please try the relative import like:
>> from contact.forms import contactForm
>> > contact is your app name
>>
>> try the (absolute_import)[1] too if you're python2.
>>
>> [1] https://docs.python.org/2/library/__future__.html
>>
>> Let us know if this works
>>
>> On 02/17/2015 01:30 PM, Petar Pilipovic wrote:
>>  
>> Maybea this can help you, a bref info : 
>> I made a contact app, I have defined app url in mine url root project, 
>> then i made a forms.py file, i have defined form in it, then i have made 
>> contact.html where I have defined contact.html form which mine app will 
>> render, I have then go to views.py an imported contactForm class.
>> Afther that I have defined connection between  contact.html page and 
>> navbar.html, collected static, run server and bam error occur.
>> I just can not explain to mine self how come he can not import 
>> contactForm, and how com he can not render havbar.html, error pop's out 
>> line 15.
>> On Tuesday, February 17, 2015, Petar Pilipovic  wrote:
>> > Hello, I can not do it wright now I am not at home.
>> > As for mine forms.py, it is in mine contact app. I have two apps in 
>> mine root project, one off them is contact.
>> > I will send you more info as soon as posible.
>> > Tank you.
>> >
>> >
>> > On Tuesday, February 17, 2015, aRkadeFR  wrote:
>> >> Hello :)
>> >>
>> >> Can you dump us the layout of your files?
>> >> Where is your forms.py?
>> >>
>> >> Thanks
>> >>
>> >> On 02/17/2015 06:36 AM, Petar Pilipovic wrote:
>> >>
>> >> Hello all, I am trying to build and e_commerc django app, but I have 
>> encounter an confusing error.
>> >> Mine Error is:
>> >> Environment:
>> >>
>> >> Request Method: GET
>> >> Request URL: http://127.0.0.1:8000/
>> >> Django Version: 1.7.4
>> >> Python Version: 2.7.6
>> >> Installed Applications:
>> >> ('django.contrib.admin',
>> >>  'django.contrib.auth',
>> >>  'django.contrib.contenttypes',
>> >>  'django.contrib.sessions',
>> >>  'django.contrib.messages',
>> >>  'django.contrib.staticfiles',
>> >>  'profiles')
>> >> Installed Middleware:
>> >> ('django.contrib.sessions.middleware.SessionMiddleware',
>> >>  'django.middleware.common.CommonMiddleware',
>> >>  'django.middleware.csrf.CsrfViewMiddleware',
>> >>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>> >>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>> >>  'django.contrib.messages.middleware.MessageMiddleware',
>> >>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>> >>
>> >> Template error:
>> >> In template 
>> /home/petarp/Documents/Udemy/Learn_Django/static/templates/navbar.html, 
>> error at line 15
>> >>cannot import name contactForm
>> >>5 :   > data-toggle="collapse" data-target="#navbar" aria-expanded="false" 
>> aria-controls="navbar">
>> >>
>> >>6 : Toggle navigation
>> >>
>> >>7 : 
>> >>
>> >>8 : 
>> >>
>> >>9 : 
>> >>
>> >>10 :   
>> >>
>> >>11 :   Bootstrap theme
>> >>
>> >>12 : 
>> >>
>> >>13 : 
>> >>
>> >>14 :   
>> >>
>> >>15 : {% url 'home' as home %} 
>> >>
>> >>16 :{% url 'about' as about %}
>> >>
>> >>17 :{% url 'contact' as contact %}
>> >>
>> >>18 : > {%endif%}>Home
>> >>
>> >>19 : > {%endif%}>About
>> >>
>> >>20 : > class="active" {%endif%}>Contact
>> >>
>> >>21 : 
>> >>
>> >>22 :   > data-toggle="dropdown" role="button" aria-expanded="false">Dropdown > class="caret">
>> >>
>> >>23 :   
>> >>
>> >>24 : Acti