Re: Adding an API to an existing Django app

2014-01-17 Thread Konstantinos Pachnis
Hi Dennis,

You could use content negotiation to achieve what you 
want http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html

On Friday, January 10, 2014 12:27:26 PM UTC+2, Dennis Plöger wrote:
>
> Hi people!
>
> I've just searched some time for a way to acomplish something, that seems 
> to be missing from Django or where there doesn't seem to be a Django app 
> for that. Or maybe I just don't get it.
>
> I have created an app, that has a model and uses CBVs and templates to 
> display a nice Web UI (say hello, SKD ). 
>
> Now, I'd like to add a restful API to my app. Basically, I'd like the API 
> to do exactly the same things the Web UI does. I even would like to reuse 
> my existing URLs for that! I explicitly don't want to create shadow views 
> for something like Tastypie or something.
>
> I'm thinking of a way of identifying API-requests (for example, simply 
> adding a "?json"-Parameter) and reacting to this requests.
>
> For example: 
>
> I have a view called UserListView, which reacts to the url 
> "(...)/users/list", is based on a slightly modified version of ListView and 
> displays a nice Web UI listing all users in the system.  If I call the URL 
> like "(...)/users/list?json" I would like to use the exact class, but want 
> to return JSON code returning the same data. (I'm speaking DRY here)
>
> Another example: 
>
> Another view's called UserCreateView, that returns a form when the user 
> GETs the URL "(...)/users/create" and ultimatively creates the user when he 
> POSTs to the URL. Same thing here: When GETting the URL with some magic 
> JSON parameter, I'd like to get JSON code, that describes the needed fields 
> (although this functionality would be optional). When I POST to it with the 
> JSON-parameter, it would accept JSON input, create the user and return some 
> status, also in JSON-form.
>
> Oh, and by the way, I would also like to have my authentication and 
> authorization-checks to work well with the API.
>
> The existing frameworks (like the mentioned Tastypie) only helps creating 
> REST APIs *beside* the actual code used for WEB-UIs, not reusing it and 
> thus doesn't comply to the DRY-principle in my eyes.
>
> Does somebody know of a library or application, that does what I want or 
> am I getting something wrong here?
>
> Thanks.
>
> Kind regards
>
> Dennis
>

-- 
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/888bedbe-fb08-4150-a6d9-cbe13cada142%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-17 Thread Erik Cederstrand
Den 16/01/2014 kl. 17.50 skrev Johannes Schneider 
:

> The point is, I have to distinguish between an instance which is created, but 
> its save method is not yet called. And an instance coming from the database 
> via a manager.

Okay, then create an instance variable on the model instances when you create 
them manually. Something like this:

obj = InstanceModel()
obj.pk = 123
obj.manually_created = True

Then have your save() method check for this variable:

 def save(self, *args, **kwargs):
if getattr(self, ‘manually_created’, False):
   # Was created manually. Do something
else:
   # From database. Do something else
super(self, InstanceModel).save(*args, **kwargs)
del obj.manually_created


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/BA80A159-B4D0-4559-98E5-779EFE6717A7%40cederstrand.dk.
For more options, visit https://groups.google.com/groups/opt_out.


Error when using apache 2.4.6

2014-01-17 Thread Jasvir Singh
Hello everyone.
I am facing a problem when I access it in browser. I need your help to
solve this error.
I am using apache 2.4.6 as web server and django-1.5.2 as framework.
Here are my httpd.conf file and wsgi script:
http://paste.ubuntu.com/6766758/
http://paste.ubuntu.com/6766759/

When ever I access localhost/automation, it gives following error :
http://pbrd.co/KmTP4Y

Please feel free to ask anything else.

-- 
Jasvir Singh Grewal
www.jsgrewal.com

-- 
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/CAN_O85uhhWz1pDtDED9iwphk3oRRCn6QMP4Vd_so%2BwC3OM2zvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImproperlyConfigured: Error loading psycopg2 module: No module named _psycopg

2014-01-17 Thread Timothy W. Cook
On Fri, Jan 17, 2014 at 1:52 AM, Начаров Михаил
wrote:

>  Hi Timothy,
>
> Note that your mod_wsgi module compiled for using python2.7. So what you
> need now is install(compile&install) mod_wsgi for python3 instead of the
> same module compiled for python2.7.
> On Debian you can do it by this command:
> $ sudo apt-get install libapache2-mod-wsgi-py3
>
>
> Thanks,  After some poking around, I did find that this was the problem.
 Now, recompiling it on CentOS (with Python 3 as an alternate install) was
quite another trick.  :-)

Thanks.


>
> 16.01.2014 16:34, Timothy W. Cook пишет:
>
> This question is also on Stackoverflow http://goo.gl/LinMue  but I
> thought somene here may have an idea.
>
>
>   I have a Django 1.5, Python 2.7 site running under Apache with mod_wsgi
> on a CentOS 6.4 server.
>
> I have rebuilt this site using Django 1.6 and Python 3.3. Deploying it to
> the same server and changing the paths in httpd.conf I get the subject
> error. This new install works as expected using ./manage.py runserver.
>
> Here are the two WSGI definitions from httpd.conf:
>
> WSGIScriptAlias / /home/ccdgen/CCDGEN2/apache/wsgi.py
> WSGIPythonPath 
> /home/ccdgen/CCDGEN2/ccdgen/ccdgen:/home/ccdgen/CCDGEN2/ccdgen:/home/ccdgen/CCDGEN2/lib/python3.3/site-packages  /home/ccdgen/CCDGEN2/ccdgen>
>
>  Order allow,deny
>  Allow from all
>
> #WSGIScriptAlias /ccdgen /home/ccdgen/CCDGEN/apache/wsgi.py#WSGIPythonPath 
> /home/ccdgen/CCDGEN/mlhim/ccdgen:/home/ccdgen/CCDGEN/mlhim:/home/ccdgen/CCDGEN/lib/python2.7/site-pa
> ckages##   # Order 
> allow,deny# Allow from all#   #
>
>  The wsgi.py file is the same on both installations:
>
> import os
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mlhim.settings")from 
> django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
>
>
>
> --
>
>  Thanks in advance for any ideas.
>
>  Cheers,
>  Tim
>
>
>  --
> MLHIM VIP Signup: http://goo.gl/22B0U
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>   --
> 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%2B%3DOU3XNi7-FGOCPnKS%2Bb6%3D-ueWbPMOWFXfOce663fn0YpjWwQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>  --
> 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/52D8A90F.3040209%40gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U

Timothy Cook, MSc   +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
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%2B%3DOU3UYB-V37doGX%2B8GSY%3DN_ZOSAkPKbUHhwLvm0kBbxYd4%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Unofficial Kindle builds of the Django documentation

2014-01-17 Thread Alex Strickland

Hi Markus


I've done .mobi builds of the Django documentation so you can read it on
a Kindle:


Cool! Thanks. Will check it out.

--
Regards
Alex

--
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/52D8FB87.8010605%40mweb.co.za.
For more options, visit https://groups.google.com/groups/opt_out.


Re: mass email app for django

2014-01-17 Thread Sergiy Khohlov
In this case you have a problem with deliveries verifying. For example :
 You would like to send mass email to 1000 mail boxes and uses CC: or
BCC: field for this one. But  most of the SMTP has a limitation : ex
postfix has reading only 50 item in CC list. As result you can not
send most of the your email.  In the case of sending directly to the
other SMTP (not using own SMTP) you have problem with spam protect at
the other side.
 Anyway if you would like to receive some knowledge from me ask me
directly to via django list.  This thread is out of maillist topic
Many thanks,

Serge


+380 636150445
skype: skhohlov


On Thu, Jan 16, 2014 at 9:54 PM, Sven Aßmann  wrote:
> Hi Serge,
>
> unfortunately the smtp server is a managed server therefore no configuration 
> to
> use a db as virtual mail backend can be performed.
>
> But thanks for your notes, especially i wasn't aware that djnago can use the
> postmark / rest api for mails out of the box. I need to investigate on that -
> exiting.
>
> Cheers,
> Sven
>
> On Wednesday 15 January 2014 13:34:11 Sergiy Khohlov wrote:
>> Hello Sven,
>>
>> Look like it is not task for django. This is task  for SMTP server. Of
>> course you can create a task  for SMTP server using django but  main
>> force of the your application is based on mail server.
>>  I'm proposing  next solution:
>> 1) Store usermail in  database
>> 2) configure smtp server for using database as virtual  emails
>> database (it is not hard)
>> 3) Use django as web interface
>> 4) Send letter to SMTP using standart protocol
>>
>>  P.S. Postmark has API and it  is possible to use it directly from django.
>> If you  have any questions let me know. I've supported SMTP servers
>> for 15 years and 've worked  for spamfight service.
>> Many thanks,
>>
>> Serge
>>
>>
>> +380 636150445
>> skype: skhohlov
>>
>> On Wed, Jan 15, 2014 at 2:42 AM, Sven Aßmann  wrote:
>> > Hi Group,
>> >
>> > currently i evaluating / research for a django app that supports mailing
>> > specific texts to a receipient list (like mass emailing). the corner
>> > features are:
>> >
>> > - email text should be editable (text or html nothing special) thru the
>> > admin app
>> > - the receipient list should be maintainable independently from users and
>> > texts (like a addressbook that is maintanale thru admin app)
>> > - ideally supports several mail backends like smtp, aws sms, postmark
>> > etc..
>> > - processing of the sending can be done async via django cli / message
>> > queue services
>> >
>> > The closest use case app would be something like a newsletter app, where
>> > the subscibers can be maintainted apart from django.auth.users
>> > I am aware of www.djangopackages.com and found already a couple of
>> > applications that could make the job.
>> >
>> > I ask you folks if someone has good experience with a specific one and or
>> > what features are included and helpfull and what are not that helpfull.
>> >
>> > I really appreciate your contributions.
>> >
>> > --
>> >
>> >
>> > Best Regards,
>> > Sven
>> >
>> > --
>> > 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/3688706.24zruyElKd%40gilga
>> > mesch. For more options, visit https://groups.google.com/groups/opt_out.
> --
>
>
> Best Regards,
> Sven
>

-- 
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/CADTRxJOO1Jcr41xXEUV3c8HONiF4qg2%2BbnvxH0Y_a2Crhpn1mg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImproperlyConfigured: Error loading psycopg2 module: No module named _psycopg

2014-01-17 Thread Начаров Михаил

You're welcome!

You can also take a look to another python web-server.
Especially if you want to have for example two sites with different 
version of python on the same server.

When I wrote my first django-app on py3, I faced the same problem.


17.01.2014 15:34, Timothy W. Cook пишет:




On Fri, Jan 17, 2014 at 1:52 AM, Начаров Михаил 
mailto:michael.nacha...@gmail.com>> wrote:


Hi Timothy,

Note that your mod_wsgi module compiled for using python2.7. So
what you need now is install(compile&install) mod_wsgi for python3
instead of the same module compiled for python2.7.
On Debian you can do it by this command:
$ sudo apt-get install libapache2-mod-wsgi-py3


Thanks,  After some poking around, I did find that this was the 
problem.  Now, recompiling it on CentOS (with Python 3 as an alternate 
install) was quite another trick.  :-)


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/52D9027B.4060304%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Admin - Duplicating and Filtering Many to Many fields in form

2014-01-17 Thread Ara Sivaneswaran


Hey guys,


I am kind of stuck...

This is the situation. I got a Match Model, a Player Model and a Team model.


Here is what models look like so far:


Match Model (simplified version)

home_team = ForeignKey(Team)

visitor_team = ForeignKey(Team)

result

time

player = ManyToManyField(Player)


Player Model (simplified version)

name

team = ForeignKey(Team)


Team Model (simplified version)

name

Match has many to many relationship with Player (Player particiaptes in a 
match) Match has a foreign field Home Team Match has a foreign field 
Visitor Team.

Team has a one to many relationship with Player

What I would like to do is when editing the match, be able to see 2 
manytomany fields but filtered by teams. For example, the first manytomany 
field will only show players from the host team and the second manytomany 
field will only show players form the visitor team...

I have no idea where to start Really stuck...

Thanks a lot, Ara



-- 
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/8f9ec338-6ef6-4273-a7ca-a797aff310fb%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Problem in the admin with custom model.clean method and inlines

2014-01-17 Thread parnigot

Hello,

I've a problem with the admin and a custom clean method in one of my Models.
Here's the code:

class  Related(models.Model):
parent=  models.OneToOneField('Parent')
...

class  Parent(models.Model):

simple_mode=  models.BooleanField(
default=True
)
simple_value=  models.CharField(
null=True,  blank=True
)
...

def  clean(self):
if  self.simple_modeand  not  simple_value:
raise  ValidationError(
"If simple_mode is selected simple_value is required."
)
if  not  self.simple_modeand  not  
Related.objects.filter(parent=self).exists():
raise  ValidationError(
"If simple_mode is NOT selected a Related model MUST exists."
)

The admin code is really simple. The ParentAdmin includes the inline to 
add/change the Related object (used only if simple_mode is set to False).
Here's the code:

class  RelatedAdmin(admin.StackedInline):
model=  Related
...


class  ParentAdmin(admin.ModelAdmin):
inlines=  (RelatedAdmin,  )
...


This works fine if simple_mode is set to True and there's no need to add the 
Related model.
The problem is when I set simple_mode to False: the admin form always return 
the second ValidationError in Parent.clean(), even if all the fields in 
RelatedAdmin are correctly filled.
From my understanding this happens because, in the admin, the Parent is always 
validated and saved before all the inlines: so the Parent.clean() method is 
called before adding the Related model, obviously resulting in the 
ValidationError.

Any ideas to solve the problem?

--
e.p.

--
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/52D8F08D.60202%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Fast and Easy way to check if an instance of an Model exists in the Database

2014-01-17 Thread Tom Evans
On Thu, Jan 16, 2014 at 5:23 PM, Johannes Schneider
 wrote:
> This could be a way to it, but we need this information while handling the
> Pre_save singal. So this does not work too.

Abuse the django model instance's internals and look to see what
database this instance was loaded from - if it is None, it hasn't come
from the database.

This is highly fragile - using an undocumented API that I know has
changed in recent versions. Personally I would test that the pk does
not exist in the database (and buy faster hardware.)


>>> u=User.objects.get(id=1)
>>> u2=User()
>>> u._state.db
'default'
>>> u2._state.db
>>>

Cheers

Tom

-- 
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/CAFHbX1JYsE58wL9phRtabVN1RTcEL07PBGwnHHhPE6uUNi2y%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


recording gives me this error

2014-01-17 Thread fabricio
recording gives me this error  

My model is thus http://pastebin.com/MDM54gg8 
my view http://pastebin.com/HGwkaZCK 


when I try to record 

v_conta Conta.objects.filter = (= request.user.empresa company.) get (pk = 1
) 
v_subconta SubConta.objects.filter = (= request.user.empresa company.) get (
pk = 1) 

caixa_faccao Caixafaccao = (
company = request.user.empresa, 
client = entrega.cliente, 
observations = "Debit" 
dtlancamento datetime.now = () 
idcentrocusto = "1" 
value = vvlrtotentregue, 
valordefeito = vvlrtotentreguedefeito, 
type = "D" 
= Delivery delivery 
account = v_conta, 
sub = v_subconta, 
) 
caixa_faccao.save () 

returns me this error  


ajuadar me if you can

-- 
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/ef27d456-a3ea-4922-9c3c-314015e70c46%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Admin - Duplicating and Filtering Many to Many fields in form

2014-01-17 Thread Tom Evans
On Fri, Jan 17, 2014 at 12:38 PM, Ara Sivaneswaran
 wrote:
> Hey guys,
>
>
> I am kind of stuck...
>
> This is the situation. I got a Match Model, a Player Model and a Team model.
>
>
> Here is what models look like so far:
>
>
> Match Model (simplified version)
>
> home_team = ForeignKey(Team)
>
> visitor_team = ForeignKey(Team)
>
> result
>
> time
>
> player = ManyToManyField(Player)
>
>
> Player Model (simplified version)
>
> name
>
> team = ForeignKey(Team)
>
>
> Team Model (simplified version)
>
> name
>
> Match has many to many relationship with Player (Player particiaptes in a
> match) Match has a foreign field Home Team Match has a foreign field Visitor
> Team.
>
> Team has a one to many relationship with Player
>
> What I would like to do is when editing the match, be able to see 2
> manytomany fields but filtered by teams. For example, the first manytomany
> field will only show players from the host team and the second manytomany
> field will only show players form the visitor team...
>
> I have no idea where to start Really stuck...
>
> Thanks a lot, Ara
>
>

I would model it differently, then this problem does not occur.

I would have a Roster model. This has a foreign key to a team, and a
many-to-many to the players who played on that team in that game. If
the players have set positions in the game, that would be stored on
the through table to Players for that specific game. Similarly, game
stats would be scored on the through table also.

The match model has two foreign keys to two Rosters (home and away),
the result and time.

Cheers

Tom

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


Re: Error when using apache 2.4.6

2014-01-17 Thread Andrew Farrell
To bisect your problem, I think that the error happens before the wsgi file
even runs.
you can test this by putting
assert False at the top of /home/jass/Automation/apache/django.wsgi and
seeing if the error changes to a 500. If it doesn't, I'm right. If it does,
the problem is in django.wsgi

Given that,
What does `ls -la /home/jass/Automation/apache/` say?
What about `tail -n 140 /var/log/apache2/error.log`


On Fri, Jan 17, 2014 at 3:59 AM, Jasvir Singh wrote:

> Hello everyone.
> I am facing a problem when I access it in browser. I need your help to
> solve this error.
> I am using apache 2.4.6 as web server and django-1.5.2 as framework.
> Here are my httpd.conf file and wsgi script:
> http://paste.ubuntu.com/6766758/
> http://paste.ubuntu.com/6766759/
>
> When ever I access localhost/automation, it gives following error :
> http://pbrd.co/KmTP4Y
>
> Please feel free to ask anything else.
>
> --
> Jasvir Singh Grewal
> www.jsgrewal.com
>
> --
> 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/CAN_O85uhhWz1pDtDED9iwphk3oRRCn6QMP4Vd_so%2BwC3OM2zvQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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%2By5TLbrjMx4J9QSUzJTNvC2FhA7EQmTLxOrM4SPYxBi-gNEfA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using apache 2.4.6

2014-01-17 Thread Sandeep kaur
On Fri, Jan 17, 2014 at 2:29 PM, Jasvir Singh 
wrote:
>
> I am using apache 2.4.6 as web server and django-1.5.2 as framework.
> Here are my httpd.conf file and wsgi script:
> http://paste.ubuntu.com/6766758/
> http://paste.ubuntu.com/6766759/

According to me, in your wsgi file, change
sys.path.append('/home/jass')
to
sys.path.append('/home/jass/')

that means add slash at the end.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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


Re: Django Admin - Duplicating and Filtering Many to Many fields in form

2014-01-17 Thread Ara Sivaneswaran
Wow, really nice way to look at it. I would have never thought about it 
this way!
One little question, is it possible to have all the players already 
selected in the form? And the admin will remove players who were not part 
of the game? It's faster to remove 1 or 2 player instead of adding 10-15 
players

Thanks,
Ara

On Friday, January 17, 2014 9:42:57 AM UTC-5, Tom Evans wrote:
>
> On Fri, Jan 17, 2014 at 12:38 PM, Ara Sivaneswaran 
> > wrote: 
> > Hey guys, 
> > 
> > 
> > I am kind of stuck... 
> > 
> > This is the situation. I got a Match Model, a Player Model and a Team 
> model. 
> > 
> > 
> > Here is what models look like so far: 
> > 
> > 
> > Match Model (simplified version) 
> > 
> > home_team = ForeignKey(Team) 
> > 
> > visitor_team = ForeignKey(Team) 
> > 
> > result 
> > 
> > time 
> > 
> > player = ManyToManyField(Player) 
> > 
> > 
> > Player Model (simplified version) 
> > 
> > name 
> > 
> > team = ForeignKey(Team) 
> > 
> > 
> > Team Model (simplified version) 
> > 
> > name 
> > 
> > Match has many to many relationship with Player (Player particiaptes in 
> a 
> > match) Match has a foreign field Home Team Match has a foreign field 
> Visitor 
> > Team. 
> > 
> > Team has a one to many relationship with Player 
> > 
> > What I would like to do is when editing the match, be able to see 2 
> > manytomany fields but filtered by teams. For example, the first 
> manytomany 
> > field will only show players from the host team and the second 
> manytomany 
> > field will only show players form the visitor team... 
> > 
> > I have no idea where to start Really stuck... 
> > 
> > Thanks a lot, Ara 
> > 
> > 
>
> I would model it differently, then this problem does not occur. 
>
> I would have a Roster model. This has a foreign key to a team, and a 
> many-to-many to the players who played on that team in that game. If 
> the players have set positions in the game, that would be stored on 
> the through table to Players for that specific game. Similarly, game 
> stats would be scored on the through table also. 
>
> The match model has two foreign keys to two Rosters (home and away), 
> the result and time. 
>
> Cheers 
>
> Tom 
>

-- 
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/2bcb2275-d04f-42c5-af00-50692b3a7770%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Could SelectDateWidget show chinese?

2014-01-17 Thread forrest yang
Just try to use django in a chinese web site.
Is that possilbe to make SelectDateWidget show chinese month name? or is 
there any other workaround?

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/bf21d5f0-5974-4017-aac0-8694337192af%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Presentation ideas?

2014-01-17 Thread John DeRosa
I’m glad Russ answered too. I was thinking only about tutorials, but neglected 
to explain that. Not that it was hard to figure out, I supposed.

On Jan 16, 2014, at 8:56 PM, Keith Edmiston  wrote:

> John/Russ,
> 
> Thanks a ton for these suggestions. Great thoughts!
> 
> Keith
> 

-- 
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/E18E4296-C681-46F6-8B06-515D901A091F%40ipstreet.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using apache 2.4.6

2014-01-17 Thread Jasvir Singh
On Fri, Jan 17, 2014 at 8:37 PM, Andrew Farrell  wrote:
> To bisect your problem, I think that the error happens before the wsgi file
> even runs.
> you can test this by putting
> assert False at the top of /home/jass/Automation/apache/django.wsgi and
> seeing if the error changes to a 500. If it doesn't, I'm right. If it does,
> the problem is in django.wsgi

yes you are right. When I removed wsgi file, error remains same

> Given that,
> What does `ls -la /home/jass/Automation/apache/` say?
total 12
drwxrwxrwx  2 jass jass 4096 Jan 17 23:57 .
drwxrwxrwx 11 jass jass 4096 Jan 17 17:28 ..
-rw-r-  1 jass jass  203 Jan 17 23:57 django.wsgi

> What about `tail -n 140 /var/log/apache2/error.log`

https://gist.github.com/jasvir99/8478976

-- 
Jasvir Singh Grewal
www.jsgrewal.com

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


Re: Error when using apache 2.4.6

2014-01-17 Thread Jasvir Singh
On Fri, Jan 17, 2014 at 8:53 PM, Sandeep kaur  wrote:
> that means add slash at the end.

No, It didn't works.

-- 
Jasvir Singh Grewal
www.jsgrewal.com

-- 
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/CAN_O85v3i%2Bzum2J80XsdAJObAAf7Kuzdsf1Dc0c0jHyEreF5Sw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using apache 2.4.6

2014-01-17 Thread carlos
Hi i remember one time i try use de version apache 2.4.6 with django and
virtualhost but never work correctly
and change apache for nginx i resolved my problem :)

Cheers


On Fri, Jan 17, 2014 at 12:38 PM, Jasvir Singh wrote:

> On Fri, Jan 17, 2014 at 8:53 PM, Sandeep kaur 
> wrote:
> > that means add slash at the end.
>
> No, It didn't works.
>
> --
> Jasvir Singh Grewal
> www.jsgrewal.com
>
> --
> 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/CAN_O85v3i%2Bzum2J80XsdAJObAAf7Kuzdsf1Dc0c0jHyEreF5Sw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAM-7rO16BHeqd6OLD%2ByN-XdQpUYNesYAYr-od1R_k8tYk3kknQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Error when using apache 2.4.6

2014-01-17 Thread parnigot

Il 17/01/14 19:38, Jasvir Singh ha scritto:

On Fri, Jan 17, 2014 at 8:53 PM, Sandeep kaur  wrote:

that means add slash at the end.

No, It didn't works.


You should try to use the new configuration directives for Apache 2.4.
For more information see here 
 on the Apache 
documentation.


--
e.p.

--
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/52D99DCD.6010800%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Could SelectDateWidget show chinese?

2014-01-17 Thread Russell Keith-Magee
Hi Forrest,

All the strings used by SelectDateWidget are translated, so it should just
be a matter of setting your active locale to zh_CN (or whatever chinese sub
locale is more appropriate to your situation).

As for how to set your language preference: there are a number of options,
depending on what you're trying to achieve:

https://docs.djangoproject.com/en/dev/topics/i18n/translation/#how-django-discovers-language-preference

Yours,
Russ Magee %-)

On Sat, Jan 18, 2014 at 1:09 AM, forrest yang wrote:

> Just try to use django in a chinese web site.
> Is that possilbe to make SelectDateWidget show chinese month name? or is
> there any other workaround?
>
> 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/bf21d5f0-5974-4017-aac0-8694337192af%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAJxq849Zdo5N1UhjrmGYD1_WKJO%2Bnat-TDXb%2BJKFn5COMH5jBg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


JSON serialization

2014-01-17 Thread Igor Korot
Hi, ALL,
I'd like someone to help me understand this situation.
Looking at the page: 
https://docs.djangoproject.com/en/dev/topics/serialization/ the part which 
says "Serialization formats->JSON" there is an example of how the data 
would be serialized.
The sample uses the symbol "double quotation".
 
On my machine I have django 1.6.1:
 
C:\Documents and Settings\Igor.FORDANWORK>python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] 
on win32
Type "help", "copyright", "credits" or "license" for more information. 
>>> import django
>>> django.get_version()
'1.6.1'
>>>
 
In my views.py I'm using following code:
 
usb_list = serializers.serialize("json", USB.objects.all())
return render_to_response('html/index.html', {"usb_data": usb_list} )
 
where USB is the data model class.
This class overrides a __unicode__() function to produce a good output on 
the console.
 
Now when I go to the page to see it in the browser I see the data as a JSON 
but the data is surrounded with a text """.
 
So in the docs I see something like this: "abc", while my application will 
show: "abc"
 
In the index.html I have this code:
 



Test
{% load staticfiles %}

var data = "{{usb_data}}";
# some more JavaScript code



 
Is this a recent change? Am I doing something wrong?
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/783144af-8478-408a-bdd5-0b7b5a5a1161%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: JSON serialization

2014-01-17 Thread Mario Gudelj
In your template try {{usb_data|safe}}
On 18/01/2014 4:53 pm, "Igor Korot"  wrote:

> Hi, ALL,
> I'd like someone to help me understand this situation.
> Looking at the page:
> https://docs.djangoproject.com/en/dev/topics/serialization/ the part
> which says "Serialization formats->JSON" there is an example of how the
> data would be serialized.
> The sample uses the symbol "double quotation".
>
> On my machine I have django 1.6.1:
>
> C:\Documents and Settings\Igor.FORDANWORK>python
> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import django
> >>> django.get_version()
> '1.6.1'
> >>>
>
> In my views.py I'm using following code:
>
> usb_list = serializers.serialize("json", USB.objects.all())
> return render_to_response('html/index.html', {"usb_data": usb_list} )
>
> where USB is the data model class.
> This class overrides a __unicode__() function to produce a good output on
> the console.
>
> Now when I go to the page to see it in the browser I see the data as a
> JSON but the data is surrounded with a text """.
>
> So in the docs I see something like this: "abc", while my application will
> show: "abc"
>
> In the index.html I have this code:
>
> 
> 
> 
> Test
> {% load staticfiles %}
> 
> var data = "{{usb_data}}";
> # some more JavaScript code
> 
> 
> 
>
> Is this a recent change? Am I doing something wrong?
> 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/783144af-8478-408a-bdd5-0b7b5a5a1161%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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/CAHqTbj%3DO5ysO7cmVXFg8p-aTMbHNZ5gHA4iZ8JaVzNthVjsDkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.