Re: importing csv data into database

2015-03-31 Thread sum abiut
Thanks guys,
appreciate your help. Yes i am looking to have a form that accepts CSV
files. I will have a read on the link that you guys have provided and see
how it goes.

Cheers


On Wed, Apr 1, 2015 at 11:44 AM, Andrew Farrell 
wrote:

> Hello Sum,
>
> There are two approaches you could take.
> One is to install a plugin like django-import-export
>  and then use
> it's import functionality. Its been a while since I've done this, but when
> I did under django-1.4 it Just Worked. This is the best approach if you
> know your data is clean and doesn't require any sort of processing before
> saving it.
>
> The other is to write a custom manage.py command
> .
> This would let you load the data using a csv.DictReader
> , do some
> logic on it, and then bulk-create
>  
> objects
> in the database. This approach has the disadvantage that if you have a bug
> in your processing script, you will end up adding messy data to your
> database and having to clean it up. To avoid this, you could write a unit
> test case  
> which
> calls your import function in its setUp() method. This testcase would
> create a separate test database, import the data into it, run your test
> functions, and then clear the test database. This approach would also let
> you, for example, deliberately insert malformed info into the data and
> verify that your import function would catch those errors.
>
> On Tue, Mar 31, 2015 at 6:46 PM, sum abiut  wrote:
>
>> Hi,
>> Could someone please advise this i am trying to import data from csv file
>> or write to database but i am confuse on how to start. i am using sqllite
>> database.
>>
>> Cheers,
>>
>>
>>  --
>> 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/CAPCf-y5Nk_ATFgYk-hduiLsrxBasS%3Dzu4Qj8Gp5F9vo%3DNRwF%2BA%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/CA%2By5TLbaBcs8%2BrJsNmXFknRGNTC5%2BOr3URs53eiFBM8GLekmcA%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/CAPCf-y66m%3DbH0ddOWmqy2AxST-C4E4btS3T4Ce0MmHb0o-OGqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: login error: hostname doesn't match .... but it does!!!

2015-03-31 Thread Stephen J. Butler
This error doesn't appear in the Django sources for 1.6 or 1.7. I
don't think the error is being generated by Django, so ALLOWED_HOSTS
isn't the culprit. Plus, another clue is that "*.doba.com" isn't an
actual value in your ALLOWED_HOSTS.

If you search it appears related to Python SSL. Do you have an
authentication backend (like an LDAP module) connecting over SSL? I
think that's what's choking. Probably an error with SNI or SAN on the
certificate. But why Python SSL doesn't think the host matches the
wildcard is another mystery.

On Tue, Mar 31, 2015 at 4:06 PM, bwv549  wrote:
> Just trying to login a new user, but I'm getting this error, which makes no
> sense to me because it looks like it should match:
>
> Login error (https://www.jtprince.dev.doba.com/new-login.html) -- Exception:
> hostname 'www.jtprince.dev.doba.com' doesn't match either of '*.doba.com',
> 'doba.com' -- Result: None
>
> ALLOWED_HOSTS = [
> '.doba.com',
> '.doba.com.',
> ]
>
> What kinds of things should I try to get past this?
>
> 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/7e279169-5359-45f2-93f4-4a713c6356c7%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/CAD4ANxXbAMmb57LQQ0nCR2skw-phf5_0MF%3D5XE1%2BtOTYoFd97Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: importing csv data into database

2015-03-31 Thread Andrew Farrell
Hello Sum,

There are two approaches you could take.
One is to install a plugin like django-import-export
 and then use it's
import functionality. Its been a while since I've done this, but when I did
under django-1.4 it Just Worked. This is the best approach if you know your
data is clean and doesn't require any sort of processing before saving it.

The other is to write a custom manage.py command
.
This would let you load the data using a csv.DictReader
, do some logic
on it, and then bulk-create

objects
in the database. This approach has the disadvantage that if you have a bug
in your processing script, you will end up adding messy data to your
database and having to clean it up. To avoid this, you could write a unit
test case 
which
calls your import function in its setUp() method. This testcase would
create a separate test database, import the data into it, run your test
functions, and then clear the test database. This approach would also let
you, for example, deliberately insert malformed info into the data and
verify that your import function would catch those errors.

On Tue, Mar 31, 2015 at 6:46 PM, sum abiut  wrote:

> Hi,
> Could someone please advise this i am trying to import data from csv file
> or write to database but i am confuse on how to start. i am using sqllite
> database.
>
> Cheers,
>
>
>  --
> 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/CAPCf-y5Nk_ATFgYk-hduiLsrxBasS%3Dzu4Qj8Gp5F9vo%3DNRwF%2BA%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/CA%2By5TLbaBcs8%2BrJsNmXFknRGNTC5%2BOr3URs53eiFBM8GLekmcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: django custom timezone middleware causing django.contrib.humanize test to fail

2015-03-31 Thread Tim Graham
In general it's not possible to have those tests pass with arbitrary 
settings. To remedy this, the new test runner in Django 1.6 [1] won't pick 
up Django's tests that are part of contrib apps. 

On a related note, consider upgrading to a supported version of Django 
(1.7+), or at least the last release in the 1.5 series (1.5.12) which 
remedies several security issues in 1.5.4.

[1] 
https://docs.djangoproject.com/en/stable/releases/1.6/#discovery-of-tests-in-any-test-module

On Tuesday, March 31, 2015 at 4:49:20 PM UTC-4, Matt Ball wrote:
>
> Hi -- I'm unable to get all tests to pass with Django 1.5.4 when I have 
> custom timezone-activating middleware enabled.
>
> I've posted code here: http://stackoverflow.com/questions/29376612
>
> Is there a way to disable the middleware for that specific test?
>

-- 
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/a28bea53-ff7c-43bc-b9c8-2f3a6f68cbb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: importing csv data into database

2015-03-31 Thread James Schneider
Is it a one-time import or are you looking to have a form that accepts CSV
files?

Either way, I would start with the Python csv module. Works really well and
should be able to convert your CSV file to a standard Python list of lists,
which you should be able to coerce into models, etc.

https://docs.python.org/2/library/csv.html

Write a small script outside of Django that reads a file representing the
typical CSV format you are expecting. Once that is working, you can
incorporate the code from that script into a model or form. If you only
need to import a CSV file one time, just modify that script to bootstrap
the Django libraries and modules, then create your model instances from
there.

You can also write directly to SQLite directly at that point if needed.

-James
On Mar 31, 2015 4:46 PM, "sum abiut"  wrote:

> Hi,
> Could someone please advise this i am trying to import data from csv file
> or write to database but i am confuse on how to start. i am using sqllite
> database.
>
> Cheers,
>
>
>  --
> 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/CAPCf-y5Nk_ATFgYk-hduiLsrxBasS%3Dzu4Qj8Gp5F9vo%3DNRwF%2BA%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/CA%2Be%2BciW7kXzcSWoL7DC8-jX5PqdkJeqyaPuAqwnvRNcfyJwULg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


importing csv data into database

2015-03-31 Thread sum abiut
Hi,
Could someone please advise this i am trying to import data from csv file
or write to database but i am confuse on how to start. i am using sqllite
database.

Cheers,

-- 
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/CAPCf-y5Nk_ATFgYk-hduiLsrxBasS%3Dzu4Qj8Gp5F9vo%3DNRwF%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: login error: hostname doesn't match .... but it does!!!

2015-03-31 Thread Mike Dewhirst

On 1/04/2015 8:06 AM, bwv549 wrote:

Just trying to login a new user, but I'm getting this error, which makes
no sense to me because it looks like it should match:

Login error (https://www.jtprince.dev.doba.com/new-login.html) --
Exception: hostname 'www.jtprince.dev.doba.com' doesn't match either of
'*.doba.com', 'doba.com' -- Result: None

ALLOWED_HOSTS = [
 '.doba.com',
 '.doba.com.',
]

What kinds of things should I try to get past this?


Maybe get rid of the second item in the list. I don't think you need the 
trailing dot.


I would put in the full hostname to prove it works then sequentially 
remove bits until the problem is revealed.


ALLOWED_HOSTS = [
'www.jtprince.dev.doba.com',
'.jtprince.dev.doba.com',
'.dev.doba.com',
'.doba.com',
 ]

Just a stab in the dark really ...

Mike




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/7e279169-5359-45f2-93f4-4a713c6356c7%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/551B303A.20300%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


login error: hostname doesn't match .... but it does!!!

2015-03-31 Thread bwv549
Just trying to login a new user, but I'm getting this error, which makes no 
sense to me because it looks like it should match:

Login error (https://www.jtprince.dev.doba.com/new-login.html) -- 
Exception: hostname 'www.jtprince.dev.doba.com' doesn't match either of 
'*.doba.com', 'doba.com' -- Result: None

ALLOWED_HOSTS = [
'.doba.com',
'.doba.com.',
]

What kinds of things should I try to get past this?

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/7e279169-5359-45f2-93f4-4a713c6356c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django custom timezone middleware causing django.contrib.humanize test to fail

2015-03-31 Thread Matt Ball
Hi -- I'm unable to get all tests to pass with Django 1.5.4 when I have 
custom timezone-activating middleware enabled.

I've posted code here: http://stackoverflow.com/questions/29376612

Is there a way to disable the middleware for that specific test?

-- 
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/8cdcad03-1bed-4ca0-ab13-10d93e0fa6c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Heisenbug to do with self.client losing its sessionstore

2015-03-31 Thread Peter Bengtsson
I have this code that looks something like this (django 1.6.11):

def test_something(self):
url = someobject.get_url()
User.objects.create_user('a', 'a...@example.com', 'secret')
assert self.client.login(username='a', password='secret')
r = self.client.get(url)
assert r.status_code == 302  # because you're not allowed to view it
someobject.privacy_setting = 'different'
r = self.client.get(url)
assert r.status_code == 200  # now you can view it according the 
business logic


This code has been working for many many months but suddenly it started to 
Heisenfail with the last line being 302 != 200.
It might be related to caching somewhere else because it ONLY ever fails 
(if it fails!) when I run the whole test suite. 
After a lot of painful debugging I concluded that sometimes, that last 
self.client.get(url) causes `request.user == >`

I.e. for the second request made by that logged in client, it's all of a 
sudden NOT logged in!! Not always. Only sometimes. :(

I put in a debugging line just before that last test like `assert 
self.client.session['_auth_user_id']` and that sometimes fails. Almost as 
if the testclient loses its session store DURING the lifetime of the test. 
Sometimes. 


Anybody seen anything similar that might be able to explain it or give me a 
clue?


-- 
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/87a1ed74-6ce2-49fa-886c-9cb015a90555%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread jirka . vejrazka
It's very likely that the actual user running the webserver process(es) does 
not have "ping" on the executables path...

  HTH

Jirka
-Original Message-
From: dk 
Sender: django-users@googlegroups.com
Date: Tue, 31 Mar 2015 08:12:03 
To: 
Reply-To: django-users@googlegroups.com
Subject: Re: subprocess behave diferent in the server than in the client.

playing a littlie bit more, I found out that does work if I am using the 
manage.py runserver.
but doesn't work using the production django =(.



On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote:

> hi, I have a button in my webpage that lunch a subprocess and check the 
> ping of the computer and save the information in a text file. that's it,  
> very basic stuff.
>
> If I am doing my click in the server computer  everything works,
> the subprocess will ping the computer, make the file and save the 
> information. 
> and go back the corresponding view.
>
>
> but if I do it from a client computer,  does all the script,  return the 
> view that needs to return, but it never lunched the subprocess =(.   is 
> like that line was commented or something doesn't even complain or spits 
> errors =(
>
> have any one got an issue like 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/bb43b536-352e-4eb0-b32a-485860d19e13%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/1427155839-1427828537-cardhu_decombobulator_blackberry.rim.net-201002000-%40b3.c3.bise7.blackberry.
For more options, visit https://groups.google.com/d/optout.


Chicago Django Study Group

2015-03-31 Thread Lane Campbell
Hello All,

I'm hosting a weekly study group in Chicago. If anyone on the list is 
interested in stopping in and joining us please register (it's 
free): 
http://www.eventbrite.com/e/chicago-django-study-group-april-5th-2015-tickets-16386027048

Regards,
Lane

-- 
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/d36e7b70-52df-4201-b84d-945a8404ca87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Intermittent "Can't initialize character set latin1 errors" after centos 6 install

2015-03-31 Thread zignorp
We've also gotten "can't initialize utf8" errors in the same intermittent 
time period.

OperationalError: (2019, "Can't initialize character set utf8 (path: 
/usr/share/mysql/charsets/)")




-- 
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/375f8bb6-6a3d-492a-b9ee-dcd2d23ddb1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Intermittent "Can't initialize character set latin1 errors" after centos 6 install

2015-03-31 Thread zignorp
Hello,
We have an application that doesn't have much user interaction, mostly list 
displays that has been stable for quite some time. We haven't changed it 
since moving to django 1.6.5
but centos was just upgraded from 5 to 6 on the server we need to work on.
After this we started noticing intermittent:
OperationalError: (2019, "Can't initialize character set latin1 (path: 
/usr/share/mysql/charsets/)")
errors. 

These errors will show up randomly for 7-18 minutes, perhaps twice a week, 
and I can't discern any pattern for when they're showing up.
When they stop happening, I can hit the same urls, with no content/data 
changed, and it's fine.

We are using mysql-python 1.2.5


When we check the db, it's:
| character_set_database | utf8|
| collation_database | utf8_general_ci |


Settings are:
DATABASES = {
  'default': {
'ENGINE': 'django.db.backends.mysql', 
'NAME': 'dbname',
'USER': 'dbuser', 
'PASSWORD': 'dbpassword',
'HOST': 'host',
'PORT': '',
"OPTIONS": { 
'sql_mode': 'TRADITIONAL,STRICT_ALL_TABLES,ANSI', 
'connect_timeout': 10, 
'charset': 'utf8', 
'init_command': 'SET storage_engine=INNODB', 
} 

}
}

We just added the sql_mode to match settings from other applications on the 
server, but the error was happening without it. We haven't been able to 
reproduce it. The server shows:

SHOW variables LIKE '%character_set%';
+--++
| Variable_name| Value  |
+--++
| character_set_client | utf8   |
| character_set_connection | utf8   |
| character_set_database   | utf8   |
| character_set_filesystem | binary |
| character_set_results| utf8   |
| character_set_server | utf8   |
| character_set_system | utf8   |
| character_sets_dir   | /usr/share/mysql/charsets/ |
+--++

-- 
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/d5abca0b-105c-4f0f-8c22-b91a18fd6d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: encode url

2015-03-31 Thread Vijay Khemlani
you want to encode them before they are submitted to the server? why?

On Tue, Mar 31, 2015 at 1:23 PM, Pnelson  wrote:

> Im trying to learn django and i have a form in html that have 3 arguments
> (app_id,user_id and username) and i want to encode those 3 arguments in
> base64.
>
> views.py
>
> def encode(self):
> return base64.b64encode()
> def decode(self):
> return base64.b64decode()
>
> login.html
>
> 
> Application ID: 
> User ID: 
> Username: 
> 
> 
>
> URL created:
> http://127.0.0.1:8000/notification_html/?appid=1&userid=&username=1
>
> Any suggestion to encode the url?
>
> Thanks for 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/5651af5b-9878-4c52-92a0-6ac32e1610dd%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/CALn3ei2mnCBx0qJjsXRJbJdR9Qcy_UMVrR2p7qKMxCzHyJff-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread aRkadeFR

What is your production stack (nginx/uwsgi/permissions folder etc. etc.)?
Do you have any logger / stack trace to debug it?

Thanks

On 03/31/2015 05:12 PM, dk wrote:
playing a littlie bit more, I found out that does work if I am using 
the manage.py runserver.

but doesn't work using the production django =(.



On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote:

hi, I have a button in my webpage that lunch a subprocess and
check the ping of the computer and save the information in a text
file. that's it,  very basic stuff.

If I am doing my click in the server computer everything works,
the subprocess will ping the computer, make the file and save the
information.
and go back the corresponding view.


but if I do it from a client computer,  does all the script, 
return the view that needs to return, but it never lunched the

subprocess =(.   is like that line was commented or something
doesn't even complain or spits errors =(

have any one got an issue like 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/bb43b536-352e-4eb0-b32a-485860d19e13%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/551ACF38.2040601%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


Re: Hidden fields in formsets

2015-03-31 Thread aRkadeFR

Hello,

I read very quickly, but you sure you want to *render* and get the value
of "user_create" from the client?
It can be modified by any client...

aRkadeFR

On 03/31/2015 10:45 AM, François GUÉRIN wrote:

Hi,

I'm using multiple formsets in Create / Update views, and I want to 
set some *hidden* fields in it : user_create, date_create on creation, 
user_update, date_update on update.


I've created a MultiFormsetMixin, which provide machinery to 
initialize those formsets in my CreateView / UpdateView.
Basicaly, the mixin fill a formset_list containing dicts with 
{'formset': , 'name': , 'verbose_name': 
}... The rendering of the formsets uses the same 
rendering than 'normal' formsets, via a {%for formset in formset_list 
%}{# formset rendering #}[% endfor %}. The formsets display normaly.


Data initialization is performed through the 'initial' dict. Every 
forms in the formsets have the same values for those fields, at 
initialization, so I update each form of the formsets with those values.


My problem is that those hidden fields are not rendered in the 
template, even in a 'hidden_field'. I've tryed to set 'exclude' and 
'hidden_fields' Meta option in my ModelForm object, but it doesn't work.


When I go through the 'form.hidden_fields' I have my formset 
administrative normal data (id, parent) but not my fields.


Is it possible to render those fields in the template ?

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/13de9082-3dd5-4b3c-bb72-7393e3f0884c%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/551ACE9D.3050008%40arkade.info.
For more options, visit https://groups.google.com/d/optout.


encode url

2015-03-31 Thread Pnelson


Im trying to learn django and i have a form in html that have 3 arguments 
(app_id,user_id and username) and i want to encode those 3 arguments in 
base64.

views.py

def encode(self):
return base64.b64encode()
def decode(self):
return base64.b64decode()

login.html


Application ID: 
User ID: 
Username: 



URL created: 
http://127.0.0.1:8000/notification_html/?appid=1&userid=&username=1

Any suggestion to encode the url? 

Thanks for 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/5651af5b-9878-4c52-92a0-6ac32e1610dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django project for multiple clients

2015-03-31 Thread Benjamin Scherrey
This is what we've done successfully for multiple projects. Django makes it
fairly straightforward.

  -- Ben

On Fri, Mar 27, 2015 at 4:37 PM, Gabriel - Iulian Dumbrava <
gabriel.dumbr...@gmail.com> wrote:

> If your clients are using different subdomains, like client1.webapp.com,
> client2.webapp.com then you can have separate settings file per subdomain
> and completely isolate the client data, but still use the same virtualenv
> and codebase. You must also take care of the file upload/access because you
> also need to isolate it.
>
> joi, 26 martie 2015, 18:23:38 UTC+2, Steven Nash a scris:
>>
>> We are design a DJango based application to be used my multiple clients.
>> Each client will have there own database but share the same code base.
>>
>> In the past, when I've done something like this, I have configure a
>> separate virtual host for each client.
>>
>> This time we are thinking about using URL routing to select the clients
>> database, and creating a small Django Webapp to allow an admin team to
>> setup new clients etc.
>>
>> I'd be interested to hear how others have tackled this, I have Googled
>> quite a bit on this topic.
>>
>> Steve
>>
>  --
> 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/0db98454-b9f4-4ed0-9924-e528d0b11174%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Chief Systems Architect Proteus Technologies 
Chief Fan Biggest Fan Productions 
Personal blog where I am not your demographic
.

This email intended solely for those who have received it. If you have
received this email by accident - well lucky you!!

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


Re: subprocess behave diferent in the server than in the client.

2015-03-31 Thread dk
playing a littlie bit more, I found out that does work if I am using the 
manage.py runserver.
but doesn't work using the production django =(.



On Monday, March 30, 2015 at 5:53:59 PM UTC-5, dk wrote:

> hi, I have a button in my webpage that lunch a subprocess and check the 
> ping of the computer and save the information in a text file. that's it,  
> very basic stuff.
>
> If I am doing my click in the server computer  everything works,
> the subprocess will ping the computer, make the file and save the 
> information. 
> and go back the corresponding view.
>
>
> but if I do it from a client computer,  does all the script,  return the 
> view that needs to return, but it never lunched the subprocess =(.   is 
> like that line was commented or something doesn't even complain or spits 
> errors =(
>
> have any one got an issue like 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/bb43b536-352e-4eb0-b32a-485860d19e13%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade to django 1.7- ImproperlyConfigured -Tastypie label duplicate? help

2015-03-31 Thread Filipe Ximenes
Thats strange.
Are you using pip to install dependencies? Try uninstalling everything and
reinstalling again.
Make sure INSTALLED_APPS is not being defined somewhere else in the code.
Does the error persists if you set DEBUG = False locally?

On Tue, Mar 31, 2015 at 10:21 AM, amarshall  wrote:

> Hi Filipe,
>
> I have few apps installed. When I comment out the tastypie line my app
> builds but gets an error in production because tastypie app isn't found.
> Here it is:
>
> INSTALLED_APPS = (
> 'django.contrib.admin',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'rest_framework',
># 'south',   // commented out after upgrade to Django 1.7
> 'tastypie',
> 'lokal',#my app
> )
>
>
>
> On Tuesday, March 31, 2015 at 5:52:55 AM UTC-4, Filipe Ximenes wrote:
>>
>> Can you show us your INSTALED_APPS?
>> It may be the case you have a lot of apps installed and is not seeing a
>> duplicate reference to tastypie.
>> On Mar 29, 2015 9:43 PM, "amarshall"  wrote:
>>
>>> Hi,
>>>
>>>  So I updated my django project from django 1.6 to 1.7.7 and when I run
>>> "python manage.py migrate" I get this error stating that I have a duplicate
>>> label.
>>>
>>> Here's the traceback
>>>
>>>   Creating tables...
>>>   Installing custom SQL...
>>>   Installing indexes...
>>> Running migrations:
>>>   Applying tastypie.0001_initial...Traceback (most recent call last):
>>>   File "manage.py", line 11, in 
>>> execute_from_command_line(sys.argv)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/core/
>>> management/__init__.py", line 385, in execute_from_command_line
>>> utility.execute()
>>>   File "/usr/local/lib/python2.7/dist-packages/django/core/
>>> management/__init__.py", line 377, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/core/
>>> management/base.py", line 288, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/core/
>>> management/base.py", line 338, in execute
>>> output = self.handle(*args, **options)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/core/
>>> management/commands/migrate.py", line 161, in handle
>>> executor.migrate(targets, plan, fake=options.get("fake", False))
>>>   File "/usr/local/lib/python2.7/dist-packages/django/db/
>>> migrations/executor.py", line 68, in migrate
>>> self.apply_migration(migration, fake=fake)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/db/
>>> migrations/executor.py", line 96, in apply_migration
>>> if self.detect_soft_applied(migration):
>>>   File "/usr/local/lib/python2.7/dist-packages/django/db/
>>> migrations/executor.py", line 140, in detect_soft_applied
>>> apps = project_state.render()
>>>   File "/usr/local/lib/python2.7/dist-packages/django/db/
>>> migrations/state.py", line 57, in render
>>> self.apps = Apps([AppConfigStub(label) for label in 
>>> sorted(self.real_apps
>>> + list(app_labels))])
>>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py",
>>> line 56, in __init__
>>> self.populate(installed_apps)
>>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py",
>>> line 89, in populate
>>> "duplicates: %s" % app_config.label)
>>> django.core.exceptions.ImproperlyConfigured: Application labels aren't
>>> unique, duplicates: tastypie
>>>
>>>
>>> Not sure what to do here. I remove tastypie from the list of
>>> INSTALLED_APPS in my settings and everything works fine. but I do need it.
>>> Any suggestions ?
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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/7e4cfbf8-d3e0-4e0e-a38c-b83930ffa3b6%
>>> 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/5128dd5e-faa1-4c6a-9cf4-0a59f7d0bc2c%40googlegroups.co

Re: Django Http post and csrf error

2015-03-31 Thread Anderson Resende

In your template put  in your form:

{% csrf_token %}

example:


  {% csrf_token %}



-- 
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/9ffa27a1-ee3b-4c95-871d-82b17cd9989d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade to django 1.7- ImproperlyConfigured -Tastypie label duplicate? help

2015-03-31 Thread amarshall
Hi Filipe,

I have few apps installed. When I comment out the tastypie line my app 
builds but gets an error in production because tastypie app isn't found. 
Here it is:

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
   # 'south',   // commented out after upgrade to Django 1.7
'tastypie',
'lokal',#my app
)



On Tuesday, March 31, 2015 at 5:52:55 AM UTC-4, Filipe Ximenes wrote:
>
> Can you show us your INSTALED_APPS?
> It may be the case you have a lot of apps installed and is not seeing a 
> duplicate reference to tastypie.
> On Mar 29, 2015 9:43 PM, "amarshall" > 
> wrote:
>
>> Hi,
>>
>>  So I updated my django project from django 1.6 to 1.7.7 and when I run 
>> "python manage.py migrate" I get this error stating that I have a duplicate 
>> label. 
>>
>> Here's the traceback
>>
>>   Creating tables...
>>   Installing custom SQL...
>>   Installing indexes...
>> Running migrations:
>>   Applying tastypie.0001_initial...Traceback (most recent call last):
>>   File "manage.py", line 11, in 
>> execute_from_command_line(sys.argv)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py"
>> , line 385, in execute_from_command_line
>> utility.execute()
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py"
>> , line 377, in execute
>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>> line 288, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
>> line 338, in execute
>> output = self.handle(*args, **options)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py"
>> , line 161, in handle
>> executor.migrate(targets, plan, fake=options.get("fake", False))
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py"
>> , line 68, in migrate
>> self.apply_migration(migration, fake=fake)
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py"
>> , line 96, in apply_migration
>> if self.detect_soft_applied(migration):
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py"
>> , line 140, in detect_soft_applied
>> apps = project_state.render()
>>   File 
>> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", 
>> line 57, in render
>> self.apps = Apps([AppConfigStub(label) for label in 
>> sorted(self.real_apps 
>> + list(app_labels))])
>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", 
>> line 56, in __init__
>> self.populate(installed_apps)
>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", 
>> line 89, in populate
>> "duplicates: %s" % app_config.label)
>> django.core.exceptions.ImproperlyConfigured: Application labels aren't 
>> unique, duplicates: tastypie
>>
>>
>> Not sure what to do here. I remove tastypie from the list of 
>> INSTALLED_APPS in my settings and everything works fine. but I do need it. 
>> Any suggestions ?
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/7e4cfbf8-d3e0-4e0e-a38c-b83930ffa3b6%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/5128dd5e-faa1-4c6a-9cf4-0a59f7d0bc2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple Django Forms

2015-03-31 Thread Bill Blanchard
Hi Stephanie,
Ping me offline, I might be able to help you out.
On Mar 30, 2015 1:43 PM, "Stephanie Socias"  wrote:

> Thank you for your suggestions!
>
> Unfortunately, as I am very green at the moment, I nee more help to
> implement all of these new techniques. Given that what I'm trying to
> accomplish requires more extensive Django and javascript knowledge, is
> there anyone who would be willing to do a video screen share with me to
> help me out?? I can pay you!
>
> Thank you,
> Stephanie
>
> On Monday, March 30, 2015 at 7:47:48 AM UTC-4, François GUÉRIN wrote:
>>
>> 1/ use generic views : ProcessFormView by example
>> 2/ use prefixes in your forms with there name (it's a param in form cctor)
>> 3/ in your template, use the {%for form in forms %}{% form.as_p
>> %}{%endfor %} if you put your forms into a
>> list form forms
>>
>> Good coding !
>>
>>
>  --
> 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/9d1c60b2-a194-40ef-8ef1-5065c1c8184e%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/CAP7uED%2BDyjCwTP%3DWnEK-M2SCy48CXdvvOZjLbG5BaGWj%3D36yzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrade to django 1.7- ImproperlyConfigured -Tastypie label duplicate? help

2015-03-31 Thread Filipe Ximenes
Can you show us your INSTALED_APPS?
It may be the case you have a lot of apps installed and is not seeing a
duplicate reference to tastypie.
On Mar 29, 2015 9:43 PM, "amarshall"  wrote:

> Hi,
>
>  So I updated my django project from django 1.6 to 1.7.7 and when I run
> "python manage.py migrate" I get this error stating that I have a duplicate
> label.
>
> Here's the traceback
>
>   Creating tables...
>   Installing custom SQL...
>   Installing indexes...
> Running migrations:
>   Applying tastypie.0001_initial...Traceback (most recent call last):
>   File "manage.py", line 11, in 
> execute_from_command_line(sys.argv)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py"
> , line 385, in execute_from_command_line
> utility.execute()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py"
> , line 377, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 288, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py",
> line 338, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py"
> , line 161, in handle
> executor.migrate(targets, plan, fake=options.get("fake", False))
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
> line 68, in migrate
> self.apply_migration(migration, fake=fake)
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
> line 96, in apply_migration
> if self.detect_soft_applied(migration):
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py",
> line 140, in detect_soft_applied
> apps = project_state.render()
>   File
> "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py",
> line 57, in render
> self.apps = Apps([AppConfigStub(label) for label in sorted(self.real_apps
> + list(app_labels))])
>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py",
> line 56, in __init__
> self.populate(installed_apps)
>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py",
> line 89, in populate
> "duplicates: %s" % app_config.label)
> django.core.exceptions.ImproperlyConfigured: Application labels aren't
> unique, duplicates: tastypie
>
>
> Not sure what to do here. I remove tastypie from the list of
> INSTALLED_APPS in my settings and everything works fine. but I do need it.
> Any suggestions ?
>
> --
> 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/7e4cfbf8-d3e0-4e0e-a38c-b83930ffa3b6%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/CAA-QWB3KXRBBSsVOCcAJ-BDi7Av%2B_JLFHBChHik069dKvksUUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Hidden fields in formsets

2015-03-31 Thread François GUÉRIN
Hi, 

I'm using multiple formsets in Create / Update views, and I want to set 
some *hidden* fields in it : user_create, date_create on creation, 
user_update, date_update on update.

I've created a MultiFormsetMixin, which provide machinery to initialize 
those formsets in my CreateView / UpdateView. 
Basicaly, the mixin fill a formset_list containing dicts with {'formset': 
, 'name': , 'verbose_name': }... The rendering of the formsets uses the same rendering than 
'normal' formsets, via a {%for formset in formset_list %}{# formset 
rendering #}[% endfor %}. The formsets display normaly.

Data initialization is performed through the 'initial' dict. Every forms in 
the formsets have the same values for those fields, at initialization, so I 
update each form of the formsets with those values.

My problem is that those hidden fields are not rendered in the template, 
even in a 'hidden_field'. I've tryed to set 'exclude' and 'hidden_fields' 
Meta option in my ModelForm object, but it doesn't work.

When I go through the 'form.hidden_fields' I have my formset administrative 
normal data (id, parent) but not my fields.

Is it possible to render those fields in the template ?

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/13de9082-3dd5-4b3c-bb72-7393e3f0884c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple Django Forms

2015-03-31 Thread François GUÉRIN
Hi Stephanie, 

Maybe you are french ? I'm sorry, but I've no time to make a screencast 
video. But the django doc is very good and in multiple languages : french 
is available if you change /en/ > /fr/ in the doc url.

1/ For generic views : 
https://docs.djangoproject.com/en/1.7/topics/class-based-views/

2/ For formsets : 
https://docs.djangoproject.com/en/1.7/topics/forms/formsets/

3/ For templates, you'd better to get a custom base_form.html. I use this 
one : 

https://gist.github.com/frague59/5c5450bf4d02643bc547

The code snippets depends on other templates, but they are not difficult to 
figure out.

Bye and good luck 
François

Le lundi 30 mars 2015 19:43:50 UTC+2, Stephanie Socias a écrit :
>
> Thank you for your suggestions!
>
> Unfortunately, as I am very green at the moment, I nee more help to 
> implement all of these new techniques. Given that what I'm trying to 
> accomplish requires more extensive Django and javascript knowledge, is 
> there anyone who would be willing to do a video screen share with me to 
> help me out?? I can pay you!
>
> Thank you,
> Stephanie
>
> On Monday, March 30, 2015 at 7:47:48 AM UTC-4, François GUÉRIN wrote:
>>
>> 1/ use generic views : ProcessFormView by example
>> 2/ use prefixes in your forms with there name (it's a param in form cctor)
>> 3/ in your template, use the {%for form in forms %}{% form.as_p 
>> %}{%endfor %} if you put your forms into a 
>> list form forms
>>
>> Good coding !
>>  
>>
>

-- 
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/f7f76f5b-e5ac-4040-8e50-9cc62f989fdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.