Re: {{STATIC_URL }} or {% static "...." %} What`s the correct to use?

2015-03-20 Thread Néstor
Is it OK to have this syntax?
 href="{% static "public/css/bootstrap.min.css" %}">

Should you not do something like this:
href="{% static 'public/css/bootstrap.min.css' %}">



On Fri, Mar 20, 2015 at 7:13 AM, Fellipe Henrique 
wrote:

> So, answer the questions:
>
> - I in Debug mode: DEBUG = True
> - Here is my settings.py:
> https://gist.github.com/fellipeh/4eb8143f6ac362dff9e0
> - Yes, all my folder has the correct permission, I can edit any files
> there.
>
> - I  my HTML I have:
>
>%}">
>
> and in source code, in browser show these:
>
>  
>
>
> - When I try to go:  localhost:8000/static   show these:
>
> Page not found (404)  Request Method: GET  Request URL:
> http://localhost:8000/static/
>
> Directory indexes are not allowed here.
>
> You're seeing this error because you have DEBUG = True in your Django
> settings file. Change that to False, and Django will display a standard
> 404 page.
>
>
>
> Any thoughts?
>
> T.·.F.·.A.·. S+F
> *Fellipe Henrique P. Soares*
>
> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
> 's/(.)/chr(ord($1)-2*3)/ge'
> *Blog: http://fhbash.wordpress.com/ *
> *GitHub: https://github.com/fellipeh *
> *Twitter: @fh_bash*
>
> On Fri, Mar 20, 2015 at 9:36 AM, Ilya Kazakevich  > wrote:
>
>> This one "{% static "" %}" is MUCH better than {{STATIC_URL }}.
>> It is recommended way.
>>
>> You almost never need to use {{STATIC_URL }}.
>>
>>
>> On Friday, March 20, 2015 at 3:59:08 AM UTC+3, Fellipe Henrique wrote:
>>>
>>> Hi,
>>>
>>> In my template, when I made a reference to my Static folder.. what's the
>>> correct usage?
>>>
>>> {{STATIC_URL }} or {% static "" %}
>>>
>>> Django 1.7 and Python 3
>>>
>>> Thanks!
>>>
>>> T.·.F.·.A.·. S+F
>>> *Fellipe Henrique P. Soares*
>>>
>>> e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \
>>> 's/(.)/chr(ord($1)-2*3)/ge'
>>> *Blog: http://fhbash.wordpress.com/ *
>>> *GitHub: https://github.com/fellipeh *
>>> *Twitter: @fh_bash*
>>>
>>  --
>> 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/06ea6d9c-a224-49c9-93b5-4733ceab5111%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/CAF1jwZHfddQLPvxA%3D0thjDEP8Nb6OLD4yQPOR60feoDdR7Q67A%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/CAON-vCP%3Dsp%2BMt-F2w7sCp_5i5yFYeGJxTP9dTOiM4Sef7-wchQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python manage.py makemigrations polls

2015-07-13 Thread Néstor
try "python manage.py migrate"

On Mon, Jul 13, 2015 at 4:27 PM, Auj Snow  wrote:

> When I try to run "python manage.py makemigrations polls" in my terminal,
> I get an error "No changes detected in app 'polls' "
>
> I have saved the 'polls' in the INSTALLED_APPS but I just don't understand
> how to fix this.
>
> Any help would be appreciated.
>
> 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/77fefd1f-ad01-41bf-9d3c-5cd5b8f81baf%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/CAON-vCOLbYA_4JNbxO4iVBscic0ZujnqAstC33Cu6ZW2ACrZ5Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Playing with API- DjangoProject Part 1

2015-07-14 Thread Néstor
This worked for me in ubuntu:
python manage.py shell
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)

*>>> from polls.models import Question, Choice*
*>>> from django.utils import timezone*

*>>> q = Question(question_text="What's up?", pub_date=timezone.now())*

*>>> q.save()*
*>>> q.id *
1
*>>> q.question_text*
"What's up?"


I just did the above and I got a message
from this page url:*https://docs.djangoproject.com/en/1.8/intro/tutorial01/
*

I hope this helps, try it again


On Tue, Jul 14, 2015 at 1:47 PM, Auj Snow  wrote:

> When I run the shell, I keep getting errors. Also, I have created the
> question three times now so when I type q.id , I get a return value of 3.
> How can I delete them. Also when I ask the question text (q.question_text)
> I get "" instead of the "Whats up".
>
> Any help would be greatly appreciated.
>
> *The error when I run the shell:*
>
> q$ python manage.py shell
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.question' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py:309:
> RuntimeWarning: Model 'polls.choice' was already registered. Reloading
> models is not advised as it can lead to inconsistencies, most notably with
> related models.
>   new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
>
> Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>>
>
>  --
> 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/46c118d5-7b70-4575-b714-edf2d05334b3%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/CAON-vCPEDhVuEjc02_smiE8CATcbqN2FRHoAh9mQHN6wVLEuXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I install Python 3 in a virtualenv on a MAC ?

2015-07-16 Thread Néstor
Virtualenv -p python3  myfolder
On Jul 16, 2015 2:24 PM,  wrote:

> I'm new to Django and would like to install Python 3.x  in a virtualenv so
> I can follow the tutorial given on the Django website.
> How do I install Python 3.x (latest version) within a virtualenv on a Mac?
>
> Thank you,
>
> jon
>
> --
> 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/0073083f-12f8-44f5-a24c-a9b61feb5297%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/CAON-vCP2VoT8k2wj04c390q_tx9cT%3DZfVxrxR2apUJ35JzhHSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django detect changes in models Meta ?

2014-08-22 Thread Néstor
is that true if the table is already there?


On Fri, Aug 22, 2014 at 6:55 AM, Norman Bird 
wrote:

> I am new, just completed the tutorials, but from my understanding you run
> "python manage.py syncdb" and that rebuilds the tables etc.
>
> On Friday, August 22, 2014 3:32:43 AM UTC-4, termopro wrote:
>>
>> Hi there,
>>
>> I am using Django 1.7 RC2.
>> I have created models and have run all the migrations so Django created
>> tables in database.
>> Now i decided to change database table names and have added Meta class to
>> models containing table name:
>>
>> class SomeModel(models.Model):
>>...
>>class Meta:
>>   db_table = 'newname'
>>
>> Now when i run "makemigrations" Django doesn't detect any changes in
>> models:
>> "No changes detected in app 'blabla'."
>> As far as i understand the logic, Django should change table names from
>> 'appname_somemodel" to "newname".
>>
>> Is this an expected behavior or i am missing something?
>>
>  --
> 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/1083dee2-e8ec-451f-9ef9-1ebbc04c41af%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/CAON-vCMhSVSAXUsj6ROaXbYg5NzqYbUenz2VUmjHvRj%3Dghpwvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Template Not Applying - Django Polls Tutorial (Newbie Question)

2014-12-23 Thread Néstor
You might need to make for admin
mysite/templates/admin/base_site.html

for regular html files for the polls only
mysite/polls/templates/polls/index.html

That is how I got it to work.  Good luck!!!

:-)

On Tue, Dec 23, 2014 at 2:13 PM, Ken Wayne  wrote:

> Windows 8
> Django 1.7.1
> Python 3.4.2
> Google Chrome Version 39.0.2171.95 m
>
> Bottom of part 2 of the the tutorial
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/ it indicates how
> to customize the admin template but when I follow the directions it doesn't
> show any change in my browser.  I've restarted the development server and
> refreshed my browser.
>
> *File Snip base_site.html:*
> {% block title %}{{ title }} | Polls Administration {% endblock %}
>
> *File Snip settings.py:*
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
> # TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
> TEMPLATE_DIRS = ['C:\Python34\Scripts\mysite\templates']
>
> I tried the environment path, and hard coding the path.  Since the
> tutorial didn't indicate the BASE_DIR path I made a copy of the file in
> each of the following directories:
> C:\Python34\Scripts\mysite\templates\admin
> C:\Python34\Scripts\mysite\mysite\templates\admin
> C:\Python34\Scripts\mysite\polls\templates\admin
>
> Any thoughts on what I might be doing wrong?
>
> --
> 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/0a7c4e30-ba26-418b-b217-72936c72975f%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/CAON-vCPcGEhk3%2B0wO4RXSnuQWqW5H6H4ZbiHoo1h5yRx36GbBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Exception occurred processing WSGI script

2015-01-08 Thread Néstor
It would be nice to read about the solution to your problem :-)
On Jan 7, 2015 8:09 PM, "sarfaraz ahmed"  wrote:

> Issue resolved. Please close this
>
> On Wednesday, 7 January 2015 23:02:33 UTC+5:30, sarfaraz ahmed wrote:
>>
>> This is what I am trying to do.
>>
>> I am using amazon ec2 windows free tier and i am trying to setup django
>> on XAMPP.
>>
>> I am using apache 2.4 Windows 32 bit version
>> python 2.7.9 window 32 bit version
>> mod_wsgi 3.5 windows 32 bit version
>> and Django 1.7
>>
>> my project as nothing but just mysite project with myapp as application
>> My mod_wsgi file looks like this
>>
>> ==
>>
>> import os,sys
>> sys.path.append('c:\\xampp\\htdocs\\mysite')
>> os.environ['DJANGO_SETTINGS_MODULE']='mysite.settings'
>>
>> import django.core.handlers.wsgi
>> application= django.core.handlers.wsgi.WSGIHandler()
>>
>> =-==
>>
>>
>> +++
>> Apache error log looks horrible
>> +++
>>
>>
>> mod_wsgi (pid=1980): Exception occurred processing WSGI script
>> 'C:/xampp/htdocs/mysite/mod.wsgi'.
>> [Wed Jan 07 16:46:37.425730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] Traceback (most recent call last):
>> [Wed Jan 07 16:46:37.425730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\wsgi.py",
>> line 187, in __call__
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] response = self.get_response(request)
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py",
>> line 199, in get_response
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] response = self.handle_uncaught_exception(request,
>> resolver, sys.exc_info())
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\core\\handlers\\base.py",
>> line 236, in handle_uncaught_exception
>> [Wed Jan 07 16:46:37.426729 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return debug.technical_500_response(request, *exc_info)
>> [Wed Jan 07 16:46:37.427732 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\views\\debug.py",
>> line 91, in technical_500_response
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] html = reporter.get_traceback_html()
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\views\\debug.py",
>> line 350, in get_traceback_html
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return t.render(c)
>> [Wed Jan 07 16:46:37.428730 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 148, in render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return self._render(context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 142, in _render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return self.nodelist.render(context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 844, in render
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] bit = self.render_node(node, context)
>> [Wed Jan 07 16:46:37.429731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\debug.py",
>> line 80, in render_node
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] return node.render(context)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\debug.py",
>> line 90, in render
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] output = self.filter_expression.resolve(context)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Python27\\lib\\site-packages\\django\\template\\base.py",
>> line 624, in resolve
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948] new_obj = func(obj, *arg_vals)
>> [Wed Jan 07 16:46:37.430731 2015] [:error] [pid 1980:tid 1736] [client
>> ::1:49948]   File 
>> "C:\\Pytho

Custom UserChangeForm shows one list correctly and the other doesn't show values

2015-06-20 Thread Néstor Boscán
Hi

I've created a custom UserChangeForm in DJango 1.7.8 where I have 2 custom
ComboBox associated with a Model. Both are defined exactly the same. One
shows the values and the + button to add a new entity. The second only
shows an empty list.

Any ideas?

Regards,

Néstor

-- 
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/CALyLaQ%2Bi7tEiiH8NVCcn-CzYcDzv%3D7aDV3BJhSDcWAc%2BTrUf%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Calling Oracle Stored Procedures with REF CURSOR I get "unhandled data type CursorDebugWrapper"

2014-10-05 Thread Néstor Boscán
Hi

I'm trying to use DJango to call Oracle Stored Procedures with REF CURSOR. 
When I execute it I get: "unhandled data type CursorDebugWrapper". It looks 
like cx_Oracle doesn't like the DJango cursor wrapper.

Regards,

Néstor

-- 
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/52dd87fc-674b-4acf-b489-dd70d914caad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Custom Exception Handler not being called

2014-10-09 Thread Néstor Boscán
Hi

I've created a rest service using the APIView and created my own custom 
exception handler. I configured my custom exception handler in my 
settings.py file using:

REST_FRAMEWORK = {
'EXCEPTION_HANDLER': 'module.custom_exception_handler'
}

But when an exception is raised my custom exception handler is not invocked.

Regards,

Néstor

-- 
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/105ca293-2e02-450b-acce-a93eeb04923d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Using ModelForm with ID associated with PostgreSQL Sequence

2014-10-20 Thread Néstor Boscán
Hi

I have an existing PostgreSQL database where all tables have sequences 
associated to their primary key and no, I can't change it.

When I create a ModelForm it generates "Required field" for the ID field 
because it doesn't have any data.

Any ideas how to manage this situation?

Regards,

Néstor

-- 
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/496384a5-0d3a-487c-819e-0c8cd952a897%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


In django-tables2 how do I paginate from the database

2014-11-02 Thread Néstor Boscán
Hi

Can django-tables2 paginate at the database level using SQL OFFSET AND 
LIMIT?. I have a table that has millions of rows and it doesn't make any 
sense to load them in memory to show only the first 10 rows.

Regards,

Néstor

-- 
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/6f8516ba-9c58-49a6-a06b-b6a30255fd5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


invalid literal for int() with base 10: '' using FormSet with File Upload

2016-01-12 Thread Néstor Boscán
Hi Django Forum

I'm working on a web application that has a page with form set that 
requires file upload. When I upload the files I get:

Django Version:1.9.1Exception Type:ValueErrorException Value:

invalid literal for int() with base 10: ''

Exception 
Location:C:\desarrollo\Python27\lib\site-packages\django\db\models\fields\__init__.py
 
in get_prep_value, line 976Python Executable:
C:\desarrollo\Python27\python.exePython Version:2.7.3

On this line of code:

study_form_set = DiagnosticStudyFormSet(request.POST, request.FILES, 
prefix='studies', 
queryset=DiagnosticStudy.objects.filter(diagnostic__id=pk))

My model:

class DiagnosticStudy(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(verbose_name='Name', max_length=255)
link = models.CharField(verbose_name='Link', max_length=255, 
blank=True, null=True)
path = models.FileField(upload_to='files', max_length=255, blank=True, 
null=True)
diagnostic = models.ForeignKey(Diagnostic, blank=True, null=True)
study_type = models.ForeignKey(StudyType, blank=True, null=True)
class Meta:
managed = False
db_table = 't_udm_diagnostic_study'

My forms:

class DiagnosticStudyForm(ModelForm):
class Meta(object):
model = DiagnosticStudy
fields = [ 'id', 'name', 'link', 'path', 'study_type' ]
widgets = {
   'id': HiddenInput(attrs={ 'class': 'campo' }),
'name': TextInput(attrs={ 'class': 'campo', 'size': '40', 
'onchange': 'validate(this)' }),
'link': TextInput(attrs={ 'class': 'campo', 'size': '40', 'onchange': 
'validate(this)' }),
'path': FileInput(attrs={ 'class': 'campo', 'size': '40', 'accept': 
'image/gif,image/jpeg,image/pjpeg,image/png,image/tiff,image/x-tiff,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation',
 
'onchange': 'validate(this)' }),
'study_type': HiddenInput(attrs={ 'class': 'campo', 'size': '40', 
'onchange': 'validate(this)' }),
}

DiagnosticStudyFormSet = modelformset_factory(DiagnosticStudy, 
form=DiagnosticStudyForm, extra=5, can_delete=True)

The Form does not have a IntegerField only CharFields and ForeignKeys. Any 
ideas on how to know which field is generating the error?

Regards,

Néstor

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00b3ccfa-d092-4027-97fe-31fd6a828129%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.