Re: I can't load fixtures

2014-08-14 Thread eprikazc
'/myapps/fixtures' is treated as absolute path. Try removing leading slash 
to make it relative. Either you can write full absolute path to the 
directory.

thanks,
Eugene


On Thursday, August 14, 2014 9:05:30 PM UTC+4, Daniel Grace wrote:
>
> I created a fixtures file called testdata.xml in a fixtures folder, but I 
> can't load the fixtures file into the database.
>
> I placed an __init__.py file in the fixtures folder (not sure about this 
> step, is it needed?)
>
> I put the fixtures directory in settings.py:
> FIXTURE_DIRS = (
>'/myapp/fixtures/',
> )
>
> I tried two ways to load the fixture, but neither worked:
> >python manage.py syncdb
> Creating tables ...
> Installing custom SQL ...
> Installing indexes ...
> Installed 0 object(s) from 0 fixture(s)
> >python manage.py loaddata "myapp/fixtures/testdata.xml"
> C:\myenv\lib\site-packages\django\core\management\commands\loaddata.py:216: 
> User
> Warning: No fixture named 'myapp/fixtures/testdata' found.
>   warnings.warn("No fixture named '%s' found." % fixture_name)
> Installed 0 object(s) from 0 fixture(s)
>
> Any ideas?
> Thanks
>

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


dba designer consulting needed

2014-08-14 Thread Mike Dewhirst

I'm looking for a DBA designer in Melbourne for some paid consulting.

I have a Django 1.6 prototype system working nicely with Postgres 9.1.

But it was designed as a proof-of-concept rather than a production 
system. I figured the project wouldn't actually get off the ground 
without funding and then I'd be able to hire someone to get serious 
about design perfection. In particular, distributed database versus 
monolithic and optional integration of external systems by some users 
plus parts which are shared among all users.


Well, it didn't work out the way I planned. Funding is still a way off 
and now I have people who want to use the prototype.


The consulting task is to determine if the design can be tweaked so it 
can be put into production. And if so, to so tweak it.


If I can't find someone in Melbourne I'll consider a remote consultant 
but I think the conversation bandwidth required would make remote less 
than ideal.


Thanks for any sympathy

Cheers

Mike

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


Re: Django app runs with DEBUG=True but gives "Bad Request (400)" error with DEBUG=False (Using Apache and WSGI). Why?

2014-08-14 Thread Chris Seberino
Ug!! That was it!! THanks!!!

cs

On Thursday, August 14, 2014 10:14:34 PM UTC-5, Collin Anderson wrote:
>
> a quick thing to check: is your ALLOWED_HOSTS set correctly? 
>

-- 
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/aa49887d-c362-43cd-9b29-d7eeb8b4f00a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django app runs with DEBUG=True but gives "Bad Request (400)" error with DEBUG=False (Using Apache and WSGI). Why?

2014-08-14 Thread Collin Anderson
a quick thing to check: is your ALLOWED_HOSTS set correctly?

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


Django app runs with DEBUG=True but gives "Bad Request (400)" error with DEBUG=False (Using Apache and WSGI). Why?

2014-08-14 Thread Chris Seberino
If I set DEBUG=True this Django app runs fine.  If I remove DEBUG=True I get
a "Bad Request (400)" and apache error logs show lots of this..

[Fri Aug 15 03:04:27.400567 2014] [core:warn] [pid 2011:tid 
140575764432768] AH00045: child process 2015 still did not exit, sending a 
SIGTERM
[Fri Aug 15 03:04:29.402824 2014] [core:warn] [pid 2011:tid 
140575764432768] AH00045: child process 2015 still did not exit, sending a 
SIGTERM
[Fri Aug 15 03:04:31.405041 2014] [core:warn] [pid 2011:tid 
140575764432768] AH00045: child process 2015 still did not exit, sending a 
SIGTERM
[Fri Aug 15 03:04:33.407308 2014] [core:error] [pid 2011:tid 
140575764432768] AH00046: child process 2015 still did not exit, sending a 
SIGKILL

Why would it work with DEBUG turned on?

cs

-- 
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/f29c4f76-a4e1-45ae-bdd6-2f2e15601630%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Strange behavior with defer and select_related

2014-08-14 Thread Zach Snow
Upon reviewing the code in `django/db/models/sql/compiler.py` it seems 
clear that the list of deferred fields is per-table instead of per-table 
alias  -- see `deferred_column_names`, 
https://github.com/django/django/blob/f0b358880a6825d667c037757caac470bc526a1f/django/db/models/sql/compiler.py#L683
 
which for the above example will generate something like the following:

{ 'defer_company': set([u'creator_id', 'name', u'id']) }

Whereas I would expect:

{ 'T3': set([u'creator_id', 'name', u'id']) }

(As the `only_load` dictionary created by this method only lists tables for 
which the entire set of columns should not be loaded, we wouldn't see an 
entry for 'defer_company' at all). It seems that impossible to generate the 
correct SQL without tracking deferred fields per-table alias, but it wasn't 
clear to me that the information necessary to determine the table alias to 
which each deferred field "path" (of the form 
'field1__field2__...__fieldN') should be applied is available in the 
relevant place in the code.

-Zach

On Thursday, August 14, 2014 11:59:08 AM UTC-5, Zach Snow wrote:
>
> Hi there. I'm running into some strange behavior when using `defer` with 
> `select_related` and I wanted to find out if I'm simply misunderstanding 
> what should be going on, or if indeed I have stumbled onto a bug.
>
> Summary: Using `defer` on a table that has been re-included in a query via 
> `select_related` affects the fields returned by "original" table.
>
> Consider in the following example that each `Company` might have many 
> users, and each company might have been created by a user owned by the 
> company itself or a different company. Now we'd like to query the database 
> for a list of companies, along with enough information about the `creator` 
> to display, say, their name and company name.
>
> (For the sake of the example the number of fields is very small, but in 
> practice I ran into this bug because doing multiple `select_related`s on a 
> wide table actually caused me to hit the 1664 column limit in Postgres).
>
> # This is in an app "defer".
> from django.db import models
>
> class Company(models.Model):
> creator = models.ForeignKey('defer.User', null=True)
> name = models.CharField(max_length=32)
> description = models.TextField()
>
> class User(models.Model):
> company = models.ForeignKey(Company)
> username = models.CharField(max_length=32)
> name = models.CharField(max_length=32)
>
> Now we query `Company` in such a way that it is `select_related` again 
> into the query, and defer fields on the instance of the table that is 
> `select_related`, but not on the "main" instance of the table.
>
> >>> cs = Company.objects.all().select_related(
> 'creator', 
> 'creator__company').defer('creator__company__description')
> >>>cs.first().description # Causes a query.
>
> Printing the SQL shows what's going wrong:
>
> >>> print cs.query
> SELECT "defer_company"."id", "defer_company"."creator_id",
> "defer_company"."name", "defer_user"."id",
> "defer_user"."company_id", "defer_user"."username", 
> "defer_user"."name",
> T3."id", T3."creator_id", T3."name"
> FROM "defer_company"
> LEFT OUTER JOIN "defer_user" ON ( "defer_company"."creator_id" = 
> "defer_user"."id" )
> LEFT OUTER JOIN "defer_company" T3 ON ( "defer_user"."company_id" = 
> T3."id" )
>
> Note that we are *not* retrieving the field `defer_company.description`. 
> It seems that the `defer` called on the instance of the `defer_company` 
> table selected through the `creator` field (`T3` above) is being applied to 
> the "first" instance of the table as well.
>
> Updating the SQL to include that column (in the way I expected `defer` and 
> `select_related` to behave) succeeds in returning the correct data -- in 
> sqlite3, at least.
>
> I encountered this behavior in version 1.6.5 and also reproduced it in 
> 1.7c2.
>
> Thanks!
>  
> -Zach
>

-- 
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/d66f5898-6dd5-422f-8d7f-782183625b39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Authenticating against django auth db from apache

2014-08-14 Thread Collin Anderson
Does commenting out the check_password line in wsgi.py actually fix the 
problem? Are you importing "auth" somewhere in your settings?

-- 
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/2edb0f75-d34d-44cd-b0dd-428ec7a38fe3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Authenticating against django auth db from apache

2014-08-14 Thread Héctor Urbina
Hello,

I'm following intructions in 
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/apache-auth/, 
but the wsgi.py script is giving the following error:

ImportError: Could not import settings 'uddo.settings' (Is it on sys.path? 
Is there an import error in the settings file?): cannot import name 'auth'

This error raises because of the line importing the check_password 
function. Here is my wsgi.py:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "uddo.settings")

from django.contrib.auth.handlers.modwsgi import check_password

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


The script was working fine before adding the fourth code line (import 
check_password).

Anyone knows what could be happening?

Thanks,
H.

-- 
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/6dd1f706-0b9c-4cc1-b295-b5917d731add%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: TypeError : Unable to save m2m relation modelform

2014-08-14 Thread Collin Anderson
Could it be the issue with clashing id fields? 
https://docs.djangoproject.com/en/dev/topics/db/models/#multiple-inheritance

-- 
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/4099d5f6-c31d-4af9-83e7-176376475ea6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Template in parent folder

2014-08-14 Thread Collin Anderson
Are you saying you have templates/sitebase.html and 
tempaltes/child/template.html, and you can't {% extends "sitebase.html" %} 
in your child/template.html?

-- 
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/1714b3c1-0271-4852-8da1-d078c9c240a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


TypeError : Unable to save m2m relation modelform

2014-08-14 Thread kevin
Type Error : 'ExtendedTag' instance expected, got 

I had created m2m field (required false). When I tried to save form with 
parent select (from multiple choice field), It rises type error. When I 
tried to save it without selecting parent and category, it work fine. I 
couldn't able to figure out what I am missing. 
Code Snipped (full available at https://github.com/Pattinson/m2mdemo)

models.py

class BasicTag(models.Model):
name = models.CharField(max_length=150, verbose_name="Tag Name")
image_class = models.CharField(max_length=30, blank=True)
color = models.CharField(max_length=10, blank=True)

def __unicode__(self):
return self.name

class ExtendedTag(models.Model):
parent = models.ManyToManyField(BasicTag, blank=True,
related_name="parent")
category = models.ManyToManyField(BasicTag, blank=True,
  related_name="category")

def __unicode__(self):
return self._id

class CombineTag(BasicTag, ExtendedTag):
"""

"""

forms.py

class CombineTagForm(forms.ModelForm):
class Meta:
model = CombineTag


I had follow official doc 

 which 
say that

If your model has a many-to-many relation and you specify commit=False when 
you save a form, Django cannot immediately save the form data for the 
many-to-many relation. This is because it isn’t possible to save 
many-to-many data for an instance until the instance exists in the database.

Errors

Request Method: POST
Request URL: http://127.0.0.1:8080/
Django Version: 1.6.5
Exception Type: TypeError
Exception Value:

'ExtendedTag' instance expected, got 
Exception Location: 
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in _add_items, line 649
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:

['/home/virus/project/m2mdemo',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
Server time: Thu, 14 Aug 2014 18:37:29 +
Traceback Switch to copy-and-paste view

/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in 
get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/home/virus/project/m2mdemo/tag/views.py in add
form.save_m2m() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/forms/models.py in save_m2m
f.save_form_data(instance, cleaned_data[f.name]) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in save_form_data
setattr(instance, self.attname, data) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in *set*
manager.add(*value) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in add
self._add_items(self.source_field_name, self.target_field_name, *objs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py 
in _add_items
raise TypeError("'%s' instance expected, got %r" % 
(self.model._meta.object_name, obj)) ...
▶ Local vars

-- 
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/b211f94e-5927-404c-a35a-f6020acfc73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Template in parent folder

2014-08-14 Thread Cayla Shaver
For some reason we are having trouble with Django's templates and parent 
folders.  We uploaded a sitebase.html file into the parent folder but none 
of the children folders can find the sitebase.html file.  Is there a trick 
for setting this up that we haven't been able to find?

-- 
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/0a2a2f62-27f2-48ba-85e4-81761580080a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread m1chael
I recently met a business man in my community that was looking to hire
me to put together some school intranets.. long story short, I told
him no because he would not allow me to develop in Django/Python. I
don't need that in my life. :)

Mike

On Thu, Aug 14, 2014 at 12:28 PM, Nikolas Stevenson-Molnar
 wrote:
> Well, there's always: http://animuchan.net/django_php/
>
> _Nik
>
>
> On 8/14/2014 1:24 AM, ngangsia akumbo wrote:
>
> I am working with a php guy in my office .
> He is asking me how can we mix php and django?
> Cos he want that when we have a project to do he should be able to
> paticipate using php in building the project
>
> can someone give me some tips
>
> --
> 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/07bbe137-9497-495f-adfa-77d0e82d2b7e%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/53ECE3B6.8020306%40consbio.org.
>
> 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/CAAuoY6PcBv-DM%2Bs656%3D%2Bhij0bpFfXuRSmfqh-_Lz-E%3D_BbRw8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tango with Django Tutorial

2014-08-14 Thread Mando
Hi,

you really didn't give good information as to why it failed and why you had 
to populate it manually, perhaps you missed a step in the tutorial?

What is the specific error you are getting when you run the command to 
initially populate the database.

On Wednesday, August 13, 2014 2:47:37 PM UTC-5, darkman237 wrote:
>
> This is one of the tutorials I'm going through. I checked everything and 
> it all to have been entered properly. The initial populate database app 
> didn't work, so I entered the items in manually. While it shows in recent 
> activity that the categories were entered, I do not see the name of the 
> category only the variable name(category). Can't seem to track down the 
> problem. Also likes needs to be defined, but I can't find the part where it 
> enters that in. It's not where I am currently, so I'm a little stumped 
> there as well. Anyone out there that has completed this tutorial and can 
> give me a hand with it 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/493bffd1-6030-4f75-a11c-88036ce2ac88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Cannot import in admin.py

2014-08-14 Thread Daniel Grace
I get an error after editing my admin.py file as follows:

from django.contrib import admin
from flow.models import Flow
admin.site.register(Flow)

... here is the error:
ImportError at /
cannot import name 'Flow'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.6.5
Exception Type: ImportError
Exception Value: 
cannot import name 'Flow'
Exception Location: C:\landy\cresta\flow\admin.py in , line 2
Python Executable: C:\landy\Scripts\python.exe
Python Version: 3.4.0
Python Path: 
['C:\\landy\\cresta',
 'C:\\Windows\\system32\\python34.zip',
 'C:\\Python34\\DLLs',
 'C:\\Python34\\lib',
 'C:\\Python34',
 'C:\\landy',
 'C:\\landy\\lib\\site-packages']
Server time: Thu, 14 Aug 2014 18:55:00 +0100

I am running in a virtual env.

-- 
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/d5f30c9a-9611-4c42-9fd7-0895a3450cc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


I can't load fixtures

2014-08-14 Thread Daniel Grace
I created a fixtures file called testdata.xml in a fixtures folder, but I 
can't load the fixtures file into the database.

I placed an __init__.py file in the fixtures folder (not sure about this 
step, is it needed?)

I put the fixtures directory in settings.py:
FIXTURE_DIRS = (
   '/myapp/fixtures/',
)

I tried two ways to load the fixture, but neither worked:
>python manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
>python manage.py loaddata "myapp/fixtures/testdata.xml"
C:\myenv\lib\site-packages\django\core\management\commands\loaddata.py:216: 
User
Warning: No fixture named 'myapp/fixtures/testdata' found.
  warnings.warn("No fixture named '%s' found." % fixture_name)
Installed 0 object(s) from 0 fixture(s)

Any ideas?
Thanks

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


Strange behavior with defer and select_related

2014-08-14 Thread Zach Snow
Hi there. I'm running into some strange behavior when using `defer` with
`select_related` and I wanted to find out if I'm simply misunderstanding
what should be going on, or if indeed I have stumbled onto a bug.

Summary: Using `defer` on a table that has been re-included in a query via
`select_related` affects the fields returned by "original" table.

Consider in the following example that each `Company` might have many
users, and each company might have been created by a user owned by the
company itself or a different company. Now we'd like to query the database
for a list of companies, along with enough information about the `creator`
to display, say, their name and company name.

(For the sake of the example the number of fields is very small, but in
practice I ran into this bug because doing multiple `select_related`s on a
wide table actually caused me to hit the 1664 column limit in Postgres).

# This is in an app "defer".
from django.db import models

class Company(models.Model):
creator = models.ForeignKey('defer.User', null=True)
name = models.CharField(max_length=32)
description = models.TextField()

class User(models.Model):
company = models.ForeignKey(Company)
username = models.CharField(max_length=32)
name = models.CharField(max_length=32)

Now we query `Company` in such a way that it is `select_related` again into
the query, and defer fields on the instance of the table that is
`select_related`, but not on the "main" instance of the table.

>>> cs = Company.objects.all().select_related(
'creator',
'creator__company').defer('creator__company__description')
>>>cs.first().description # Causes a query.

Printing the SQL shows what's going wrong:

>>> print cs.query
SELECT "defer_company"."id", "defer_company"."creator_id",
"defer_company"."name", "defer_user"."id",
"defer_user"."company_id", "defer_user"."username",
"defer_user"."name",
T3."id", T3."creator_id", T3."name"
FROM "defer_company"
LEFT OUTER JOIN "defer_user" ON ( "defer_company"."creator_id" =
"defer_user"."id" )
LEFT OUTER JOIN "defer_company" T3 ON ( "defer_user"."company_id" =
T3."id" )

Note that we are *not* retrieving the field `defer_company.description`. It
seems that the `defer` called on the instance of the `defer_company` table
selected through the `creator` field (`T3` above) is being applied to the
"first" instance of the table as well.

Updating the SQL to include that column (in the way I expected `defer` and
`select_related` to behave) succeeds in returning the correct data -- in
sqlite3, at least.

I encountered this behavior in version 1.6.5 and also reproduced it in
1.7c2.

Thanks!

-Zach

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


Re: mixing python , php and django

2014-08-14 Thread Nikolas Stevenson-Molnar
Well, there's always: http://animuchan.net/django_php/

_Nik

On 8/14/2014 1:24 AM, ngangsia akumbo wrote:
> I am working with a php guy in my office .
> He is asking me how can we mix php and django?
> Cos he want that when we have a project to do he should be able to
> paticipate using php in building the project
>
> can someone give me some tips
>
> -- 
> 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/07bbe137-9497-495f-adfa-77d0e82d2b7e%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/53ECE3B6.8020306%40consbio.org.
For more options, visit https://groups.google.com/d/optout.


Re: How to decompose URL into model and parameters

2014-08-14 Thread 9devmail
Yes, I figured it out. Thank 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/352776cd-f859-47c9-91c5-0b93f7620404%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to decompose URL into model and parameters

2014-08-14 Thread Collin Anderson
It raises an Http404 if it doesn't exist. Is that what's going on?

-- 
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/CAFO84S5gKoWikH9t-kF%2BYJ1Nwf%3Dw--5OfzvyYc61apgkfcDh1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to decompose URL into model and parameters

2014-08-14 Thread 9devmail
Line

match = urlresolvers.resolve(urlsplit(url).path)

stops executing the script and redirects me to given URL.

-- 
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/606cc513-9e65-4740-96f7-7aa3dbb664ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic CSS

2014-08-14 Thread Drew Ferguson
Hi Avraham

Thanks for the heads-up

On Wed, 13 Aug 2014 11:25:09 +0300
Avraham Serour  wrote:

> just remember to change the headers of the response to reflect that you
> are serving a css file and not html
> 
> 
> On Wed, Aug 13, 2014 at 3:37 AM, Drew Ferguson 
> wrote:
> 
> > On Tue, 12 Aug 2014 19:53:34 -0400
> > François Schiettecatte  wrote:
> >
> > > You could certainly render the CSS either in-line in the HMTL pages
> > > or in templates, just produce CSS as opposed to HTML (I have
> > > produced RSS,
> >
> > My goodness, of course!
> >
> > Sometimes the "bleedin' obvious" is hard to see
> >
> > Thanks
> >
> > > ATOM, XML and JSON in templates). Or you could have multiple CSS
> > > files and just pick the one you want to use when you render the link
> > > to the CSS in your HTML pages.
> > >
> > > François
> > >
> > > On Aug 12, 2014, at 7:37 PM, Drew Ferguson 
> > > wrote:
> > >
> > > > Hi
> > > >
> > > > Is there any documentation describing possible ways of having
> > > > dynamic CSS in a site?
> > > >
> > > > For example, having a CSS colour scheme set from a database query
> > > > or setting a site logo URL from a database query
> > > >
> > > > Ta
> > > > --
> > > > Drew Ferguson
> > > >
> > > > --
> > > > 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/20140813003710.3f766b96%40blacktav.fergiesontour.org
> > .
> > > > For more options, visit https://groups.google.com/d/optout.
> > >
> >
> > --
> > Drew Ferguson
> >
> > --
> > 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/20140813013703.223bf526%40blacktav.fergiesontour.org
> > .
> > For more options, visit https://groups.google.com/d/optout.
> >
> 



-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

-- 
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/20140814153410.710609a0%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable application / project?

2014-08-14 Thread Collin Anderson
Do you have DJANGO_SETTINGS_MODULE="djangotest.settings" in your 
environment?

in manage.py you could change the os.environ.setdefault() line to:
os.environ['DJANGO_SETTINGS_MODULE'] = 'cresta.settings'

-- 
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/5523bf98-e756-4e15-b64c-1e4b72bb445e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to decompose URL into model and parameters

2014-08-14 Thread Collin Anderson
from django.core import urlresolvers

match = urlresolvers.resolve(urlsplit(url).path)
view = match.func
params = math.args

https://docs.djangoproject.com/en/dev/ref/urlresolvers/#resolve

-- 
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/ed76caad-2507-4c93-b115-0f63e5a9949d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about post_save

2014-08-14 Thread Collin Anderson
@receiver(models.signals.post_save, sender=Cars)
def auto_num_on_save(sender, instance, **kwargs):
if hasattr(instance, '_already_ran'):
return
my code
instance._already_ran = True
instance.save()



-- 
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/529c9c29-7e38-4a73-a0b8-8f299a4c1073%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread Lee
If its just the two of you creating small web site projects then I doubt 
its worth the cost in time, effort and money for the added complexity that 
would be present with using two different server side languages. I'd 
suggest working out some common ground personally, rather than going that 
route. 

On Thursday, 14 August 2014 14:35:46 UTC+1, Derek wrote:
>
> It can work any way you need it to.  It really depends on what aspects he 
> needs to handle and which are yours.
>
> If, for example, you create the back-end with the DB and models, then he 
> can communicate from the front-end, using JSON data via GET/PUT requests. 
>  One way for you to handle this on the back-end is via Tastypie - see 
> http://tastypieapi.org/ .  I don't write PHP, but I can see at least one 
> web link showing how this could be done: 
> http://www.littlehart.net/atthekeyboard/2010/12/15/fun-with-apis-frapi-and-django-tastypie/
>
>
> On Thursday, 14 August 2014 11:09:14 UTC+2, ngangsia akumbo wrote:
>>
>> can i have a link on how that works?
>>
>> On Thursday, August 14, 2014 9:38:15 AM UTC+1, Erik Cederstrand wrote:
>>>
>>> Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo : 
>>>
>>> > I am working with a php guy in my office . 
>>> > He is asking me how can we mix php and django? 
>>> > Cos he want that when we have a project to do he should be able to 
>>> paticipate using php in building the project 
>>> > 
>>> > can someone give me some tips 
>>>
>>> The most smooth approach I can think of is that you let PHP and Python 
>>> communicate via JSON APIs that you agree on. That, or tell him to 
>>> capitulate to the REAL Benevolent Dictator For Life. 
>>>
>>> Erik
>>
>>

-- 
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/88cb581c-d705-42d1-a191-67b34eb04197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread Anderson
Say to him to learn django.


On Thu, Aug 14, 2014 at 10:35 AM, Derek  wrote:

> It can work any way you need it to.  It really depends on what aspects he
> needs to handle and which are yours.
>
> If, for example, you create the back-end with the DB and models, then he
> can communicate from the front-end, using JSON data via GET/PUT requests.
>  One way for you to handle this on the back-end is via Tastypie - see
> http://tastypieapi.org/ .  I don't write PHP, but I can see at least one
> web link showing how this could be done:
> http://www.littlehart.net/atthekeyboard/2010/12/15/fun-with-apis-frapi-and-django-tastypie/
>
>
> On Thursday, 14 August 2014 11:09:14 UTC+2, ngangsia akumbo wrote:
>>
>> can i have a link on how that works?
>>
>> On Thursday, August 14, 2014 9:38:15 AM UTC+1, Erik Cederstrand wrote:
>>>
>>> Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo :
>>>
>>> > I am working with a php guy in my office .
>>> > He is asking me how can we mix php and django?
>>> > Cos he want that when we have a project to do he should be able to
>>> paticipate using php in building the project
>>> >
>>> > can someone give me some tips
>>>
>>> The most smooth approach I can think of is that you let PHP and Python
>>> communicate via JSON APIs that you agree on. That, or tell him to
>>> capitulate to the REAL Benevolent Dictator For Life.
>>>
>>> Erik
>>
>>  --
> 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/88ff881b-3214-43c2-8f35-df5eb895d624%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Anderson Dias Borges
Senior Analyst Developer

Tu cumprirás o desejo do meu coração se eu Te buscar...
I can't see but I'll take my chances
To hear You call my name

-- 
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/CAAin48Vp%2BeNDzK5-JoverJto51Kt27NUgwY%3DLhogd-SMR0qS3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread Derek
It can work any way you need it to.  It really depends on what aspects he 
needs to handle and which are yours.

If, for example, you create the back-end with the DB and models, then he 
can communicate from the front-end, using JSON data via GET/PUT requests. 
 One way for you to handle this on the back-end is via Tastypie - 
see http://tastypieapi.org/ .  I don't write PHP, but I can see at least 
one web link showing how this could be 
done: 
http://www.littlehart.net/atthekeyboard/2010/12/15/fun-with-apis-frapi-and-django-tastypie/


On Thursday, 14 August 2014 11:09:14 UTC+2, ngangsia akumbo wrote:
>
> can i have a link on how that works?
>
> On Thursday, August 14, 2014 9:38:15 AM UTC+1, Erik Cederstrand wrote:
>>
>> Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo : 
>>
>> > I am working with a php guy in my office . 
>> > He is asking me how can we mix php and django? 
>> > Cos he want that when we have a project to do he should be able to 
>> paticipate using php in building the project 
>> > 
>> > can someone give me some tips 
>>
>> The most smooth approach I can think of is that you let PHP and Python 
>> communicate via JSON APIs that you agree on. That, or tell him to 
>> capitulate to the REAL Benevolent Dictator For Life. 
>>
>> Erik
>
>

-- 
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/88ff881b-3214-43c2-8f35-df5eb895d624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Crispy form Change default text shown for ImageField when not empty

2014-08-14 Thread Subodh Nijsure
Hello,

I have following field in my model.

photo = models.ImageField(null=True,blank=True,upload_to="product_images")

I have defined the following layout in forms.py for this field, while
using crispy-form

self.fields['photo'].label = "Asset Image"
self.helper.layout = Layout(
'photo',
HTML("""{% if form.photo.value %}
   
 {% endif %}""", ),

Now I can upload images associated with this particular field just
fine. However when I try to update the image I see the following in my
template:

http://i.imgur.com/wcB1JIP.png

Is there any way I can change the layout so that only the browse
button and existing image are shown when the image field is not empty?
In other words, remove the text Currently: product_images/km_2.jpeg
Clear Change:

-Subodh

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


Re: post_save doesn't work

2014-08-14 Thread Stodge
I've had good success with placing the import at the end of the models file.

On Tuesday, 12 August 2014 20:06:41 UTC-4, chedi toueiti wrote:
>
> Hi Neto,
>
> Just make sure that your callback is loaded, the most easy way to do it is 
> to import the function in models.py if you have a single models file or in 
> the __init__.py of the models if you have it as a module.
>
> in https://docs.djangoproject.com/en/1.6/topics/signals/:
>
>
> Where should this code live?
>>
>> You can put signal handling and registration code anywhere you like. 
>> However, you’ll need to make sure that the module it’s in gets imported 
>> early on so that the signal handling gets registered before any signals 
>> need to be sent. This makes your app’s models.py a good place to put 
>> registration of signal handlers.
>>
>
> On Monday, August 11, 2014 10:02:18 PM UTC+1, Neto wrote:
>>
>> I'm trying to do a post_save but he doesn't work, I am using* 
>> objects.create()*:
>>
>> *views:*
>>
>> Usuario.objects.create(name='')
>>
>> *models:*
>>
>> @receiver(models.signals.post_save, sender=Usuario)
>> def auto_abc(sender, instance, **kwargs):
>> ...
>>
>>
>>
>> Why my post_save doesn't work with objects.create()? How I do?
>>
>

-- 
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/bd5f2fd0-3a0b-4017-8bd4-ab28ba6b824b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Custom management commands provided as only .pyc files?

2014-08-14 Thread Stodge
Thanks - there are some great suggestions here. Much appreciated.

-- 
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/d92437fd-c6d7-4fc6-9d7c-1dbc75007f43%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extened User and have fieldsets instead of inlines

2014-08-14 Thread Andrea
I've personally used your approach with the following Inline:

class UserProfile2Inline(admin.StackedInline):
model = UserProfile2
can_delete = False
fk_name = 'user'
max_num = 1

Andrea


2014-08-14 5:57 GMT+02:00 Elliot :

> Is it possible to have a exteneded user profile in the 'User' part of the
> admin. I have tried the following with a form
> (UserProfileForm(forms.ModelForm)) with 2 fields 'something' and 'something
> else'
>
> class UserAdminCustom(UserAdmin):
> form = UserProfileForm
>  fieldsets = (
>  (None, {'fields': ('username', 'password', 'something',
> 'something_else')}),
>  ('Personal info', {'fields': ('first_name', 'last_name',
> 'email')}),
>  ('Permissions', {'fields': ('is_staff', 'is_active',
> 'is_superuser', 'user_permissions')}),
>  ('Important dates', {'fields': ('last_login', 'date_joined')}),
>  ('Groups', {'fields': ('groups',)}),
>  )
>
>
> admin.site.unregister(User)
> admin.site.register(User, UserAdminCustom)
>
> What it results in is the 2 new fields as expected in the User in admin
> but the fields are empty and it saves nothing to these fields on save.
>
> Is the only option to use inlines, like below, or am I just missing
> something.
>
> class UserProfile2Inline(admin.StackedInline):
> model = UserProfile2
>
> class UserAdminCustom(UserAdmin):
> inlines = (UserProfile2Inline,)
>
> admin.site.unregister(User)
> admin.site.register(User, UserAdminCustom)
>
> Cheers if someone can shed some light on this for me.
>
> Elliot
>
> --
> 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/825615e1-e364-4a60-94de-e7abde68b409%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/CAAPQ7Y0aYYJigFGNDQkOqqThg-eMKdB57yQA7KrDHtgUZrySJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Extened User and have fieldsets instead of inlines

2014-08-14 Thread Elliot
Is it possible to have a exteneded user profile in the 'User' part of the 
admin. I have tried the following with a form 
(UserProfileForm(forms.ModelForm)) with 2 fields 'something' and 'something 
else'

class UserAdminCustom(UserAdmin):
form = UserProfileForm
 fieldsets = (
 (None, {'fields': ('username', 'password', 'something', 
'something_else')}),
 ('Personal info', {'fields': ('first_name', 'last_name', 
'email')}),
 ('Permissions', {'fields': ('is_staff', 'is_active', 
'is_superuser', 'user_permissions')}),
 ('Important dates', {'fields': ('last_login', 'date_joined')}),
 ('Groups', {'fields': ('groups',)}),
 )


admin.site.unregister(User)
admin.site.register(User, UserAdminCustom)

What it results in is the 2 new fields as expected in the User in admin but 
the fields are empty and it saves nothing to these fields on save. 

Is the only option to use inlines, like below, or am I just missing 
something.

class UserProfile2Inline(admin.StackedInline):
model = UserProfile2

class UserAdminCustom(UserAdmin):
inlines = (UserProfile2Inline,)

admin.site.unregister(User)
admin.site.register(User, UserAdminCustom)

Cheers if someone can shed some light on this for me.

Elliot

-- 
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/825615e1-e364-4a60-94de-e7abde68b409%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to disable application / project?

2014-08-14 Thread Mike Dewhirst

On 14/08/2014 8:38 PM, Daniel Grace wrote:

I have two projects "djangotest" (from the django tutorial) and "cresta".
When I start the server with the "runserver" command in the cresta
directory and go to
http://127.0.0.1:8000/admin/
... I see "Polls Tutorial".  I can't login with any users from the
cresta database.
How do I disable the Polls tutorial and just use the cresta project and
its applications?
Why is "Polls Tutorial" even appearing when I am running the server
through the cresta directory?


Your environment might have settled on the polls settings.py. Django 
doesn't know which project/application to launch except through 
whichever settings.py file it loads.


Are you using virtualev? If not it might be a good idea. Solves all such 
problems if you set it up as per the instructions.




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/cb8f6bc1-eb3d-41b6-a2b0-d7792e108eae%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/53EC9501.8000705%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


How to decompose URL into model and parameters

2014-08-14 Thread 9devmail
I want to parse an application URL just like Django does.

url = 'http://www.example.com/path/to/myview/123'
view, params = decompose(url)
# now view="MyView", params=('123',)

How can it be done?

-- 
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/08a4ed71-ec57-4d30-9223-ba6dbb7c2542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to disable application / project?

2014-08-14 Thread Daniel Grace
I have two projects "djangotest" (from the django tutorial) and "cresta".
When I start the server with the "runserver" command in the cresta 
directory and go to
http://127.0.0.1:8000/admin/
... I see "Polls Tutorial".  I can't login with any users from the cresta 
database.
How do I disable the Polls tutorial and just use the cresta project and its 
applications?
Why is "Polls Tutorial" even appearing when I am running the server through 
the cresta directory?

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/cb8f6bc1-eb3d-41b6-a2b0-d7792e108eae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: # in django URL

2014-08-14 Thread Drew Ferguson
Hi

The hash mark has a special meaning in URIs; this is not specific to
Django

If you must use it in an actual URL, it needs to be escaped as %23

The urlencode template tag might help

https://docs.djangoproject.com/en/dev/ref/templates/builtins/#urlencode

Notice that this URL uses a hash mark as intended to reference an anchor
in the HTML page

On Thu, 14 Aug 2014 03:01:00 -0700 (PDT)
Domagoj Kovač  wrote:

> Hi Guys, 
> 
> I have a problem, i have url 
> like:
> http://127.0.0.1:8000/get-file?file_path=/home/domagoj/pcap/#1/test.txt
> where file_path is path to the file
> 
> both
> requestGET["file_path"] and
> request.get_full_path()
> 
> ignore #1/test.txt part, how can i fix this? Is there some other way to
> get full url?
> 



-- 
Drew Ferguson

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


# in django URL

2014-08-14 Thread Domagoj Kovač
Hi Guys, 

I have a problem, i have url 
like: http://127.0.0.1:8000/get-file?file_path=/home/domagoj/pcap/#1/test.txt 
where file_path is path to the file

both
requestGET["file_path"] and
request.get_full_path()

ignore #1/test.txt part, how can i fix this? Is there some other way to get 
full url?

-- 
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/f40a7c79-bf2d-4dc1-a85d-7524f856a234%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread ngangsia akumbo
can i have a link on how that works?

On Thursday, August 14, 2014 9:38:15 AM UTC+1, Erik Cederstrand wrote:
>
> Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo  >: 
>
> > I am working with a php guy in my office . 
> > He is asking me how can we mix php and django? 
> > Cos he want that when we have a project to do he should be able to 
> paticipate using php in building the project 
> > 
> > can someone give me some tips 
>
> The most smooth approach I can think of is that you let PHP and Python 
> communicate via JSON APIs that you agree on. That, or tell him to 
> capitulate to the REAL Benevolent Dictator For Life. 
>
> Erik

-- 
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/66b6f369-5b80-4755-bb1a-79815d972a34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: mixing python , php and django

2014-08-14 Thread Erik Cederstrand
Den 14/08/2014 kl. 10.24 skrev ngangsia akumbo :

> I am working with a php guy in my office .
> He is asking me how can we mix php and django?
> Cos he want that when we have a project to do he should be able to paticipate 
> using php in building the project
> 
> can someone give me some tips

The most smooth approach I can think of is that you let PHP and Python 
communicate via JSON APIs that you agree on. That, or tell him to capitulate to 
the REAL Benevolent Dictator For Life.

Erik

-- 
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/829E01F9-FB67-4045-8FB5-AC8CC7DC1A24%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


mixing python , php and django

2014-08-14 Thread ngangsia akumbo
I am working with a php guy in my office .
He is asking me how can we mix php and django?
Cos he want that when we have a project to do he should be able to 
paticipate using php in building the project

can someone give me some tips

-- 
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/07bbe137-9497-495f-adfa-77d0e82d2b7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Question about post_save

2014-08-14 Thread Johannes Schneider
Is there any reason why this has to happen after saving? otherwise you 
could use pre_save.


bg,
Johannes

On 14.08.2014 08:12, Neto wrote:

I'm using post_save but he is in loop:

@receiver(models.signals.post_save, sender=Cars)
def auto_num_on_save(sender, instance, **kwargs):
 my code
 instance.save()


How do I save changes without calling post_save again?

--
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/91745299-16fe-477a-b532-f2580e806d91%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

--
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/53EC6206.7040903%40galileo-press.de.
For more options, visit https://groups.google.com/d/optout.


Question about post_save

2014-08-14 Thread Neto
I'm using post_save but he is in loop:

@receiver(models.signals.post_save, sender=Cars)
def auto_num_on_save(sender, instance, **kwargs):
my code
instance.save()


How do I save changes without calling post_save again?

-- 
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/91745299-16fe-477a-b532-f2580e806d91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.