Re: Should I use generic foreign key, and how?

2014-08-16 Thread Collin Anderson
I think there really are two ways to do it, as you say.

Either use a GenericForeignKey(), or have multiple ForeignKey(null=True, 
blank=True), each one pointing to a different model. I personally use the 
multiple foreign keys approach, but this is the case that GenericForeignKey 
was designed for.

-- 
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/988b283a-bf12-430c-a6bd-542eac0106fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient way to perform many queries

2014-08-16 Thread Collin Anderson
I think this should work:

Item.objects.exclude(votes__value=False).annotate(score=Count('Votes'))

-- 
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/a868f16c-4bbf-4e96-ac3f-6d50d911994c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Extened User and have fieldsets instead of inlines

2014-08-16 Thread Collin Anderson
Can you make your UserProfile2 a subclass of UserProfile?

-- 
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/31a0c207-16d4-4ff8-a684-30bcd7051b98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-16 Thread Amirouche Boubekki
Reading my answer on a desktop computer, doesn't inspire me much. So I
rewrite here... Sorry for the triple post...


2014-08-16 18:59 GMT+02:00 :

>
>
> À Sat Aug 16 2014 12:04:20 GMT+0200 (CEST), ngangsia akumbo a écrit :
> > I was having an argument about learning how to code from scratch and
> using
> > content management systems like joomla, dupal to build websites.
>

I sum up this as:

> Learn a language by building something on top a CMS like joomla, drupal
or django cms, amstrong...

- This is one way maybe one of the best way. It's among the few
recommendation I remember from university [1], it was basically was «get
pixels in the browser quickly». Doing TDD would be best. This is the idea
behind dynamic languages and their REPL.

[1] another one is «WTF is NP & P. What matters are numbers!»

- It is basically a copy/pasting code from cookbook and making them do the
right thing cf. https://djangosnippets.org/ that's how I build my first
enduser application (somekind of a social network) ten years ago in with
PHP and mysql, way before any kind of computer science curriculum or
webmaster course.

- The good thing is that you have clear entry point to modify the behavior
of the vanilla application. Those entry points are higher level: «add an
item to the menu», «add item into the overview div»...  When you start from
scratch with only a framework you might stare blankly into an elite IDE
without much inspiration, because you can start from many places: views,
models, templates and how they interact make the number of possible
application manyfolds. Most of the time I start with models, then create
html mockup pages then glue them together with views.

- You can get lost about what kind of application you can do, since you can
do much more with a framework with the same coding level.

Only downside is that with a framework you start with a lot of code to read
«ark! there is an infinite recursion somewhere!», but this will help later.
I understand more quickly code than dozens of examples use of some class.

A ready made CMS, can also be used to do «gunshot coding» which basicly
boils down to turn working code to crap code and getting back a new code
that does something you want to do. Can also be understood as «copy & paste
then fix it»


> >
> > This guy was telling they can make any web application using Joomla the
> the
> > other cms out there.
> > He does not need to learn coding.
>

Yes. Most of my early application that me and my friend were using were
just hacks of SPIP (ready made CMS for hacks) or wordpress, phpbb,
dotclear...


> > so if that was possible why do people still learn how to code from
> scratch?
>

Performance and *sustainability. *Depending on what you do, you might not
need to learn to code. How many stories I ear by friends and family of the
kevin next door getting dozen bucks a month for installing and configuring
one of the other of the

*ready made solutions. *
Usually, python people are not interested by performance, but are glad to
have a perfect backend that can serve multiple devices with the same code.
Does phpbb allow to retrieve the list of incoming message in JSON
compatible with a ready made twitter client...

Or a perfect *{{ name-the-application-of-the-kevin-next-door }}* user
experience which needs specific models, views and templates?

Or a CMS with hand crafted backends (and frontends
 ;) for every job in the
entreprise without taking too much time to answer
?


> >
> > So i need to get your opinion about this?
> >
>

I don't know the state of the art in PHP, maybe they are framework that
have what Django (and other python framework) have:

- python language
- cookbook and books
- several cms on top of it
- plugin system with numerous plugins freely available

With the above you get almost all of what Drupal has, plus what I never
found in the documentation, its «internals» aka. the framework part of
drupal, which at the end of the day, is for people that want to get serious
things done, is more interesting for the craft than yet another forum
.



>
>  HTH
>
>
> > --
>
> > 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/5383030b-f2bb-4a8a-b3ed-5064e462d966%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
> >
>
> --
> Envoyé depuis mon Jolla

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group a

Re: Django frustrations :)

2014-08-16 Thread Cal Leeming [iops.io]
If you're serious about wanting to learn more, then the best thing you can
do is learn more about Python itself.

Until you understand Python, you won't understand the internals of Django
and it's strengths/weaknesses.

Have a look at http://learnpythonthehardway.org/ - If you are adventurous,
start diving into things like generators, tracebacks, stack inspection,
list comprehensions, classes, meta classes/MROs, decorators, context
managers (contextlib), maybe even Python GIL. Look at some of the internals
such as super(), dir(), inspect.* etc.

After a month or two you'll have a deeper and better understanding, and
will enable you to become a better programmer. It will also give you the
basic tools to be able to understand the Django source code and solve many
of your own problems, allowing you to be more self sufficient.

Cal


On Sat, Aug 16, 2014 at 5:54 PM, Mariusz Wilk  wrote:

> Hi guys. If I seem like a spoilt brat or sth in this post then maybe I am,
> let me know.
> I'm completely new to programming. I completed Python tutorial on
> codecademy and completed about 20 'assignments' on CheckiO, but I wanted to
> actually implement what I'd learned to a larger project like a website (in
> the meantime I also got to know html/css a little bit). So I started a
> tutorial on Django but got seriously stuck plus I didn't really understand
> almost anything about what I was doing. Ok..  so I went on to another
> Django tutorial. Again, same thing. And for the third time.. same thing. By
> now I'm really frustrated by how easy it was to learn the basics of Python,
> HTML and CSS and how impossible it is to understand Django and create sth
> without 1000 errors on the way. Maybe there's something I could do that
> would help me understand Django tutorials before actually doing them? Maybe
> I need some general computer course that would help me understand all the
> jargon.
> Well, that's about it. Any advice will be 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/972bd82d-5d8f-4462-938b-ff37ffd7b3d4%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/CAHKQagETj2gK0VVNvk4uWF7iu0Q6KAvVhrah21D1g%3D%3DH1RA5gQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Should I use generic foreign key, and how?

2014-08-16 Thread Aaron Law
Hi all,

I have php web programming background, and new to Django. I am helping my
brother to build an online system to manage inventory, and I've got a
database design & coding problem recently. Needing help!

That is, I have a set of tables of "possible products", "inventory",
"suppiler", etc. I want to attach a "comment" to each of them. Therefore, I
think I should make a generic "comment" table to hold all the comments of
products, inventory, suppiler.

--
possible_products
id: int (pk)
name: varchar
url: varchar
price: decimal
created_at: datetime
updated_at: datetime
--
comments
id: int (pk)
parent_id: int (fk)
content: text
author: int (fk)
table: char (which the table this comment belongs to)
created_at: datetime
updated_at: datatime
--

My problem is, when "possible_products" table is the parent of "comment",
then a foreign key of the parent (id number) is stored in the "comment"
table in order to link up them.

However, how about the fk of the "inventory" table and the "suppiler"
table? It should not be that: I create 2 more columns of "inventory_id" nor
"suppiler_id" in "comments" table. (That is, I should not create the 4th
column when I want to link up the 4th parent table.)

So, Should I use generic forgien key of Django? (so that, my "comment"
table design is right.) And how to use/implement it?

P.S I mainly develop the system in the Admin section of Django.

Regards,
Aaron Law Ho hon
--~--~-~--~~~---~--~~
Free as in Freedom ;-)
--~--~-~--~~~---~--~~

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


Re: cms web buyilding

2014-08-16 Thread amirouche . boubekki


À Sat Aug 16 2014 12:04:20 GMT+0200 (CEST), ngangsia akumbo a écrit :
> I was having an augment about learning how to code from scratch and using 
> content management systems like joomla, dupal to build websites.
> 
> This guy was telling they can make any web application using Joomla the the 
> other cms out there.
> He does not need to learn coding.
> so if that was possible why do people still learn how to code from scratch?
> 
> So i need to get your opinion about this?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/5383030b-f2bb-4a8a-b3ed-5064e462d966%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Envoyé depuis mon Jolla

-- 
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/btggn6.naez1z.1hge13l-qmf%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django frustrations :)

2014-08-16 Thread alghafli

Hello
I am not sure how much time you have been programming and what you have 
learned so far. I do know however that i have not taken a real computer 
science course and i did not study computer science. if i can do it 
without computer science, you certainly can do it.
One thing that helped me learn django is getting used to errors. anytime 
you learn a new library you will definitely get errors. I did get errors 
in the first time. so you have to get used to them and deal with them.
are good at reading errors? you have to learn this skill. Many times in 
django and programming generally you face one error that leads to 
another that leads to another. you get a chain of errors causing each 
other. you probably just made the root error. all other errors are made 
by the root error you made. do not panic and look for it. once you fix 
it, all 1000 errors will disappear.
If you are not good at reading errors yet, copy the errors and show them 
here so that someone can help. you will learn this skill with time.
I suggest you stick with the django tutorial in django website since 
most people here are probably familiar with it.


Best regards,
Mohammad

On السبت 16 آب 2014 21:13, Babatunde Akinyanmi wrote:


Hi Mariusz,
You won't go far in learning anything if you back out at the slightest 
resistance. When your code spews errors, you should attempt to find 
out what exactly caused the errors.


That said, Django is just pure python. Nothing special and magical 
about it.


My advice, anytime you hit such snags, ask for help on the group.

On 16 Aug 2014 17:54, "Mariusz Wilk" > wrote:


Hi guys. If I seem like a spoilt brat or sth in this post then
maybe I am, let me know.
I'm completely new to programming. I completed Python tutorial on
codecademy and completed about 20 'assignments' on CheckiO, but I
wanted to actually implement what I'd learned to a larger project
like a website (in the meantime I also got to know html/css a
little bit). So I started a tutorial on Django but got seriously
stuck plus I didn't really understand almost anything about what I
was doing. Ok..  so I went on to another Django tutorial. Again,
same thing. And for the third time.. same thing. By now I'm really
frustrated by how easy it was to learn the basics of Python, HTML
and CSS and how impossible it is to understand Django and create
sth without 1000 errors on the way. Maybe there's something I
could do that would help me understand Django tutorials before
actually doing them? Maybe I need some general computer course
that would help me understand all the jargon.
Well, that's about it. Any advice will be 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/972bd82d-5d8f-4462-938b-ff37ffd7b3d4%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/CA%2BWjgXO0pJkFk%3D3_wWW0PTJS%3D6Lumany6hH2n81%3DEW21fgrXFg%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


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


Re: Django frustrations :)

2014-08-16 Thread Babatunde Akinyanmi
Hi Mariusz,
You won't go far in learning anything if you back out at the slightest
resistance. When your code spews errors, you should attempt to find out
what exactly caused the errors.

That said, Django is just pure python. Nothing special and magical about
it.

My advice, anytime you hit such snags, ask for help on the group.
On 16 Aug 2014 17:54, "Mariusz Wilk"  wrote:

> Hi guys. If I seem like a spoilt brat or sth in this post then maybe I am,
> let me know.
> I'm completely new to programming. I completed Python tutorial on
> codecademy and completed about 20 'assignments' on CheckiO, but I wanted to
> actually implement what I'd learned to a larger project like a website (in
> the meantime I also got to know html/css a little bit). So I started a
> tutorial on Django but got seriously stuck plus I didn't really understand
> almost anything about what I was doing. Ok..  so I went on to another
> Django tutorial. Again, same thing. And for the third time.. same thing. By
> now I'm really frustrated by how easy it was to learn the basics of Python,
> HTML and CSS and how impossible it is to understand Django and create sth
> without 1000 errors on the way. Maybe there's something I could do that
> would help me understand Django tutorials before actually doing them? Maybe
> I need some general computer course that would help me understand all the
> jargon.
> Well, that's about it. Any advice will be 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/972bd82d-5d8f-4462-938b-ff37ffd7b3d4%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/CA%2BWjgXO0pJkFk%3D3_wWW0PTJS%3D6Lumany6hH2n81%3DEW21fgrXFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-16 Thread amirouche . boubekki


À Sat Aug 16 2014 12:04:20 GMT+0200 (CEST), ngangsia akumbo a écrit :
> I was having an augment about learning how to code from scratch and using 
> content management systems like joomla, dupal to build websites.
> 
> This guy was telling they can make any web application using Joomla the the 
> other cms out there.
> He does not need to learn coding.
> so if that was possible why do people still learn how to code from scratch?
> 
> So i need to get your opinion about this?
> 

Easy answer is performance lookup "wordpress (farms OR performance)"

Another answer is that if you know the langage it s easier to fully learn a 
framework than learn a cms. A cms must have something like a framework put 
together inside the website engine. More sloc means more things to read and 
understand.

So learning a fw  is easier and you get more power out of it, even if you have 
no ready to eye shoot nice pixels put together in a browser.

You get a similar coding experience as using a cms using Django admin to build 
a web engine, I'm still not convinced that current dj admin is the best tool 
for high quality craft.

Also most python fw and especially djanjo have a lot of plugins/extension which 
evenif they don t always attract the hurry client satisfy the smart coder.
 
 HTH

 
> --
 
> 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/5383030b-f2bb-4a8a-b3ed-5064e462d966%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Envoyé depuis mon Jolla

-- 
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/rx8qin.naesjb.2y85jf-qmf%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.


Django frustrations :)

2014-08-16 Thread Mariusz Wilk
Hi guys. If I seem like a spoilt brat or sth in this post then maybe I am, 
let me know.
I'm completely new to programming. I completed Python tutorial on 
codecademy and completed about 20 'assignments' on CheckiO, but I wanted to 
actually implement what I'd learned to a larger project like a website (in 
the meantime I also got to know html/css a little bit). So I started a 
tutorial on Django but got seriously stuck plus I didn't really understand 
almost anything about what I was doing. Ok..  so I went on to another 
Django tutorial. Again, same thing. And for the third time.. same thing. By 
now I'm really frustrated by how easy it was to learn the basics of Python, 
HTML and CSS and how impossible it is to understand Django and create sth 
without 1000 errors on the way. Maybe there's something I could do that 
would help me understand Django tutorials before actually doing them? Maybe 
I need some general computer course that would help me understand all the 
jargon. 
Well, that's about it. Any advice will be 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/972bd82d-5d8f-4462-938b-ff37ffd7b3d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Facebook permisson - django-allauth

2014-08-16 Thread Julo Waks
I have this problem,
i am working in an app that uses django-allauth for login with facebook.
When i ask for login i need to ask for publish_stream scope.
In local environment this work great.
In production does not.

Does anyone have a clue?

here my settings/base.py

SOCIALACCOUNT_PROVIDERS = {
> 'facebook': {
> 'SCOPE': ['email', 'publish_stream'],
> 'METHOD': 'oauth2'  # instead of 'oauth2'
> }
> }


thanks in advanced.

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


User model, m2m and CircularDependencyError

2014-08-16 Thread Craig Jones
I am getting the "standard" CircularDependencyError (Django 1.7c2 with 
migrations) with ManyToManyFields and a custom user.

from django.db import models
from member.models import Member
from company.models import Company

class Affiliation( models.Model ):
member = models.ForeignKey( Member )
company = models.ForeignKey( Company )

-- 

from django.db import models

class Company( models.Model ):
name = models.CharField(max_length=100)

members = models.ManyToManyField( 'member.Member', 
through='affiliation.Affiliation' )
 
-- 

class Member( AbstractBaseUser, PermissionsMixin ):
username = models.CharField(max_length=100, unique=True)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)

companies = models.ManyToManyField( 'company.Company', 
through='affiliation.Affiliation')

is_active = models.BooleanField( default=True )
is_staff = models.BooleanField( default=False )

USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['email', 'first_name', 'last_name']

objects = MemberManager()
   
When I run makemigrations it *appears* to be putting the m2m in the second 
run of the migration:

$  python manage.py makemigrations member company
Migrations for 'member':
  0001_initial.py:
- Create model Member
Migrations for 'affiliation':
  0001_initial.py:
- Create model Affiliation
  0002_auto_20140816_1407.py:
- Add field company to affiliation
- Add field member to affiliation
Migrations for 'company':
  0001_initial.py:
- Create model Company

According to Django this needs to be done manually but it appears to have 
been done automatically.


*In addition, you may run into a CircularDependencyError when running your 
migrations as Django won’t be able to automatically break the dependency 
loop due to the dynamic dependency. If you see this error, you should break 
the loop by moving the models depended on by your User model into a second 
migration (you can try making two normal models that have a ForeignKey to 
each other and seeing how makemigrations resolves that circular dependency 
if you want to see how it’s usually done)*
But I am still getting the error:

django.db.migrations.graph.CircularDependencyError: [('affiliation', 
u'0002_auto_20140816_1400'), (u'company', u'0001_initial'), ('member', 
u'0001_initial'), (u'affiliation', u'0002_auto_20140816_1400')]

I am very confused how I am supposed to break the loop.  There are several 
things on Google about this but it is not clear to me of the correct 
practice in 1.7(c2).

So, any help or ideas on this would be gratefully 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/dc7b42df-f2f7-495e-8dff-e7cf14dfb3c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-16 Thread Lee
Most cms' of that ilk fits a very specific set of needs. Once you need to move 
outside the mould they give you and need to customise it for a specific 
business requirement, without some level of understanding of coding and the 
chosen cms' underpinnings he'll find it very difficult to proceed any further. 
This is one of the reasons than you see many cms sites based on those platforms 
that look exactly the same, there are a lot of poor quality web debs out there. 

But you don't need to reason with him on his abilities. You do what is right 
for you and if you put the effort in, you'll end up a far more useful resource 
than he ever will with that mindset

-- 
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/ae57447f-7773-43aa-aecc-f505a58d3f29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: cms web buyilding

2014-08-16 Thread Bob Gailer
Go to the joomla site and see what you think.

Bob gailer
On Aug 16, 2014 6:05 AM, "ngangsia akumbo"  wrote:

> I was having an augment about learning how to code from scratch and using
> content management systems like joomla, dupal to build websites.
>
> This guy was telling they can make any web application using Joomla the
> the other cms out there.
> He does not need to learn coding.
> so if that was possible why do people still learn how to code from scratch?
>
> So i need to get your opinion about this?
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5383030b-f2bb-4a8a-b3ed-5064e462d966%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/CAP1rxO7Vz_U3PRPHQDceMDfvdnFPc1jqy6MdRiY%2B%3DE4_6sGWhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Efficient way to perform many queries

2014-08-16 Thread 9devmail
prefetch_related() works great.

How about prefetching some computed value instead of records?

{% for item in items %}

{{ item.name }}

{{ item.score }}

{% endfor %}

I want to prefetch 'score' for every item, where 'score' would be 
equivalent to:

score = Votes.objects.all().count() - Votes.objects.filter(value=False).
count()

Is there any way to prefetch such query?

Code below prefetches all data for Vote records. How can it be changed to 
prefetch only the score?

Item.objects.all().prefetch_related('votes')



-- 
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/c63c09b7-0d07-464a-be96-35fd544b7545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


cms web buyilding

2014-08-16 Thread ngangsia akumbo
I was having an augment about learning how to code from scratch and using 
content management systems like joomla, dupal to build websites.

This guy was telling they can make any web application using Joomla the the 
other cms out there.
He does not need to learn coding.
so if that was possible why do people still learn how to code from scratch?

So i need to get your opinion about this?



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5383030b-f2bb-4a8a-b3ed-5064e462d966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.