Re: Migrating older 1.4 project to 1.9

2016-04-02 Thread Source3Computing
As stated above, take small steps.  Take the time to read the release notes 
for each minor version.  Most of the minor versions are bug fixes and you 
can scan through them.
 
Pay close attention to migrations if using South.  In Django 1.7 South is 
not used.  Django incorporated migrations into the core code.  In Django 
1.6 you will add code to settings.py to prepare you for Django 1.7 
migration format (if using south).  Each third-party installed app will 
also have specific requirements if upgrading from South.  Read the docs for 
each installed app.

I am in the process of updating four Django 1.5.5 / DjangoCMS 2.4.3 
applications.  It is a painful time consuming process. I am documenting 
what I am doing to publish for others but it seams each application has its 
own upgrade propblems.

-- 
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/3e9e3c81-130a-4231-89b8-724de50f0c8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


¿Como hacer mi primera aplicacion con Django en Ubuntu? ¿How Can I make my first project with Django?

2016-04-02 Thread Kike Martinez
Hola quisiera saber como puedo hacer un proyecto con Djando desde cero 
gracias

-- 
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/4ec1c813-74e8-49d5-b8dc-df6762ce76ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


obtaining related object from django.db.models.fields.related.ForeignKey

2016-04-02 Thread Axel Rau
Hi all,

from a model object, I can get a related object shortcut,
using the name of the foreign key field:

>>> m1 = Mailbox.objects.get(pk=38)
>>> str(m1.localdomainfk)
'framailx.de'

But if I have the foreign key field instead of its name,
I can only get the pk of the related object:

>>> f1 = Mailbox._meta.get_field(‚localdomainfk')
>>> f1.value_from_object(m1)
7

Can anybody show me, how to get the related object
shortcut, if I have only the local object and the foreign key field?

Axel
-—
PGP-Key:29E99DD6  ☀ computing @ chaos claudius

-- 
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/E0D34B8F-B9A0-47AC-BFB0-43A3788A71E4%40Chaos1.DE.
For more options, visit https://groups.google.com/d/optout.


Request works with sqlite not with Postgres

2016-04-02 Thread Tazo Gil
Hello,

The following request works in my dev django project (sqlite) by not in 
production with postgres 

out: >>> 
Questionnaire.objects.filter(site_id=1).annotate(moyenne=Avg('chrono__temps')).values('title','moyenne')

The errors : 

 out: Traceback (most recent call last):
 out:   File "", line 1, in 
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
 
line 234, in __repr__
 out: data = list(self[:REPR_OUTPUT_SIZE + 1])
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
 
line 258, in __iter__
 out: self._fetch_all()
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
 
line 1074, in _fetch_all
 out: self._result_cache = list(self.iterator())
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
 
line 112, in __iter__
 out: for row in compiler.results_iter():
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 808, in results_iter
 out: row = self.apply_converters(row, converters)
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 792, in apply_converters
 out: value = converter(value, expression, self.connection, 
self.query.context)
 out:   File 
"/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/expressions.py",
 
line 283, in convert_value
 out: return float(value)
 out: TypeError: float() argument must be a string or a number

Thank you for your 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0c90fbfe-e8ee-488c-8c6e-88cdfeebba88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Request works with sqlite not with Postgres

2016-04-02 Thread Tazo Gil

I forgot to precise the type of the  field Chrono.temps: 
temps = models.DurationField(null=True)

Le samedi 2 avril 2016 19:08:20 UTC+2, Tazo Gil a écrit :
>
> Hello,
>
> The following request works in my dev django project (sqlite) by not in 
> production with postgres 
>
> out: >>> 
> Questionnaire.objects.filter(site_id=1).annotate(moyenne=Avg('chrono__temps')).values('title','moyenne')
>
> The errors : 
>
>  out: Traceback (most recent call last):
>  out:   File "", line 1, in 
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 234, in __repr__
>  out: data = list(self[:REPR_OUTPUT_SIZE + 1])
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 258, in __iter__
>  out: self._fetch_all()
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 1074, in _fetch_all
>  out: self._result_cache = list(self.iterator())
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/query.py",
>  
> line 112, in __iter__
>  out: for row in compiler.results_iter():
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 808, in results_iter
>  out: row = self.apply_converters(row, converters)
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
>  
> line 792, in apply_converters
>  out: value = converter(value, expression, self.connection, 
> self.query.context)
>  out:   File 
> "/home/mimi/.virtualenvs/atmav2/local/lib/python2.7/site-packages/django/db/models/expressions.py",
>  
> line 283, in convert_value
>  out: return float(value)
>  out: TypeError: float() argument must be a string or a number
>
> Thank you for your 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2aa47b20-408b-474e-baca-c15b3c0dcfe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Forms vs Angularjs

2016-04-02 Thread Fred Stluka

Fabio,

Good point!

Browser-side security is VERY easy to bypass.

For example, just use Firebug or the built-in dev tools of Firefox,
Chrome, or Safari (or probably even IE by now), to edit the HTML
of the current page and then click the OK/Send/Submit button.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 3/22/16 10:35 AM, Fabio C. Barrionuevo da Luz wrote:

self.fields[name].widget.attrs['disabled'] = 'disabled'
self.fields[name].widget.attrs['readonly']=True

is not make real readonly to field, because if user can edit the html 
on client side, and remove disabled="disabled" and readonly input 
atributtes


to problem of readonly fields, i currently use this:

https://github.com/luzfcb/django-simple-history/blob/wip-generic-views2/simple_history/forms.py


I prevent it here 
https://github.com/luzfcb/django-simple-history/blob/wip-generic-views2/simple_history/forms.py#L24


--
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/57003696.2070502%40bristle.com.
For more options, visit https://groups.google.com/d/optout.


Multiple values to Django

2016-04-02 Thread Denis Makarov
Hello! I have a MyForm which have name, quantity and quandesc fields.

I have a basic UI form for adding this fileld.

I added button for adding another instances of field on web page. Jquery 
func below:

function addContainer() {
$("#name").clone().appendTo("#food-container");
$("#quantity").clone().appendTo("#food-container");
$("#quandesc").clone().appendTo("#food-container");
}

But after that, if I send data, I have a value of last name, quantity and 
quandesc fields.

How add functionality for support multiple data instances of this fields?

-- 
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/0c36581a-f16b-4be6-80c3-0a3d4ecbe739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Looking for ways to improve my skills

2016-04-02 Thread Devrhoid Davis
Hi All, 

I have been working with Python for just over 3 years now and have recently 
taken up django. I have completed both the polls app and have created an 
address book app by following a tutorial on youtube. I am looking fro ways 
to improve my competence with django and possibly some end to end website 
projects. Can anyone provide me with some links as to where I could find 
resources for improving my skills and then avenues for using these skills 
to generate income?

Thanks in advance. 

Regards,
Devrhoid

-- 
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/d0a6a6e6-7db8-4a20-9e2b-e4876e0576a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-extensions: dumpscript/runscript manytomany with through= broken?

2016-04-02 Thread Daniel Wilcox
Hello, I was wondering if anyone knows a good way to handle restoring a
backup taken with a m2m intermediary model.

I'm trying to upgrade from my sqlite database to a real database and would
like to keep the data that was created thus far.

Basically the models look like this:

class Message(models.Model):
subject = models.CharField(max_length=64)
...
recipients = models.ManyToManyField(User, through='SentRecord',
blank=True)

class SentRecord(models.Model):
message = models.ForeignKey(Message)
recipient = models.ForeignKey(User)
sent_at = models.DateTimeField(auto_now=True)

So I've tried both dumpdata/loaddata and dumpscript/runscript.  The former
basically quietly ignores the records but everything else is OK -- but no
Messages or SentRecords.

So I've tried two approaches -- first problem was regarding the fact that
SentRecord and Message refer to one another and so one has to be created
first. dumpscript picked SentRecord to do first -- totally sensible.  But
It can't comply with the above model because the .message foreign key will
create a column that enforces NOT NULL.

OK fine, I changed the above model to allow null on message, since it
basically does this sequence:

1. create sent messages, with no message pk
2. create messages
3. then it *should* fill in the sent messages .message pk... but instead it
blows up because because it generates stuff like this:

app_message_1.recipient.add( importer.locate_object(User, 'id', 1, ...

Which is a big no no because of the through record it's using wrong
manager.  It should be getting the sent records already created and setting
the .message pk on those instead of trying to add Users directly to the
message, as though it were a regular m2m.


I'm just wondering if anyone knows if this is a fixed issue and I'm just
'holding it wrong'... otherwise I'll be faced with some stark choices, fix
django-extensions to get my way... or do some ugly sed/awk to patch it up.

Thank you!

=D

-- 
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/CAGq7KhoAkw57YzmEZReouD7Fr9f0fX7mG-bhdGgSRu3Oc07xiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for ways to improve my skills

2016-04-02 Thread 술욱
2016-04-02 19:29 GMT-03:00 Devrhoid Davis :
> Can anyone provide me with some links as to where I could find
> resources for improving my skills and then avenues for using these skills to
> generate income?
>

In my experience, just start coding. Skills come with time, errors,
and learning from errors of course. Code your own website, your
friends' website. Some site for a small business. Learn from that and
then grow! :-)

HTH,
Norberto

-- 
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/CADut3oCBoShLEh1c_uT1KPApQ1vS_vW6u-J1KKJdimcnE3bUTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrating older 1.4 project to 1.9

2016-04-02 Thread Larry Martell
On Wed, Mar 30, 2016 at 10:07 AM, Fred Stluka  wrote:
> Roger,
>
> Yeah, I too have a large project that I'll hopefully be migrating
> from 1.4 to 1.9 soon.
>
> It's about 3.5 years worth of work, over 200,000 lines of code
> in about 1000 Python source file and Django template files.
>
> So any tips you come up with will be invaluable.  Please post
> anything you learn to this thread.

What's prevented me from migrating past 1.6 is that in my apps I
import models in the top-level __init__.py, which is no longer
supported and now everything fails with  "Apps aren't loaded yet".
Getting past that will require a major rewrite of the app, so
unfortunately we may just stay on 1.6 forever. We just don't have the
time or manpower or money for doing it.

> 
> On 3/30/16 9:23 AM, bobhaugen wrote:
>
> We feel your pain. If you do it, and write down how it goes, we would be
> grateful.
> https://github.com/valnet/valuenetwork
>
> On Tuesday, March 29, 2016 at 4:19:59 PM UTC-5, Roger Dunn wrote:
>>
>> I've inherited a moderately large project written 2 years ago using Django
>> 1.4, and wondering if it is worth creating a fresh 1.9 project and porting
>> in the old code, or doing an in-place upgrade to 1.9?
>>
>> I have it running on 1.4 'as is' but if I run python manage.py migrate it
>> comes unglued as a lot of stuff has changed since 1.4.

-- 
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/CACwCsY7c7Nrz4DsroG3Og48F64ZwybO%3DwWGja4eLTdy4pvkXOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


file upload encryption file name changing

2016-04-02 Thread Harold Gomez
please help me I have a file upload app 
also a file encryption method  
in that file encryption method a file is encrypted 
from a 

path/file.extenssion  to 


a path/filename.enc --->(1)


I gave the file name using MEDIA_FILE 

How can I give a filename.enc   in which "filename" changes 

Now I can encrypt and store to only filename.enc  

that means I can do it once and 
by the next upload filename.enc will get overwritten

I couldn't store more files


OR 

MEDIA_FILE = os.path.join(BASE_DIR, 'media/fi1.enc' )


I want fi1.enc to change with each upload

so that new files will be created 

-- 
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/fd4396f5-8965-4925-b1f3-71334d572a48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


webupload.tar.gz
Description: Binary data


Django file upload and python Encryption How change file name

2016-04-02 Thread Harold Gomez
please help me
I have a django file upload sytem
a python file encryption code
the file encryption is done by a function called encrypt_file
which will encrypt the file from 

path/filename.extention

to

path/filename.enc

the filename.enc is fixed 
and only one file is created
how can i make it so that it will change after  and i can have multiple 
files on each file upload 


MEDIA_FILE = os.path.join(BASE_DIR, 'media/fi1.enc' )
is how i made the path

from_pathto_pathsecret key
encrypt_file(request.FILES['docfile'], MEDIA_FILE, 
'8W;>i^H0qi|J&$coR5MFpR*Vn')

how can fi1 be a variable

OR

How to solve my problem(i.e any other best methods)

-- 
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/d8b5a1d3-11a3-48fd-9ffc-9617930bdfb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


webupload.tar.gz
Description: Binary data


Re: Django file upload and python Encryption How change file name

2016-04-02 Thread Harold Gomez
/myapp should be given at url filed 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5f826626-f8d3-4f48-91c4-5f9c36f31768%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Migrating older 1.4 project to 1.9

2016-04-02 Thread Mike Dewhirst

On 3/04/2016 11:01 AM, Larry Martell wrote:

On Wed, Mar 30, 2016 at 10:07 AM, Fred Stluka  wrote:

Roger,

Yeah, I too have a large project that I'll hopefully be migrating
from 1.4 to 1.9 soon.

It's about 3.5 years worth of work, over 200,000 lines of code
in about 1000 Python source file and Django template files.

So any tips you come up with will be invaluable.  Please post
anything you learn to this thread.


What's prevented me from migrating past 1.6 is that in my apps I
import models in the top-level __init__.py, which is no longer
supported


When you say "top-level" what do you mean?

I import models in the top level of each app so I can say "from app 
import this, that, other" and it works fine. Django 1.8.


Mike

 and now everything fails with  "Apps aren't loaded yet".

Getting past that will require a major rewrite of the app, so
unfortunately we may just stay on 1.6 forever. We just don't have the
time or manpower or money for doing it.



On 3/30/16 9:23 AM, bobhaugen wrote:

We feel your pain. If you do it, and write down how it goes, we would be
grateful.
https://github.com/valnet/valuenetwork

On Tuesday, March 29, 2016 at 4:19:59 PM UTC-5, Roger Dunn wrote:


I've inherited a moderately large project written 2 years ago using Django
1.4, and wondering if it is worth creating a fresh 1.9 project and porting
in the old code, or doing an in-place upgrade to 1.9?

I have it running on 1.4 'as is' but if I run python manage.py migrate it
comes unglued as a lot of stuff has changed since 1.4.




--
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/5700BD96.30301%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.