Re: Django Weekend Cardiff

2013-12-16 Thread Daniele Procida
On Wed, Nov 13, 2013, Daniele Procida  wrote:

>The UK's first-ever Django conference will take place on the 7th-9th
>February 2014 in Cardiff, Wales.
>
>
>
>The programme for the event:
>
>Friday: tutorials and demonstrations (also open to the public)
>Saturday: talks
>Sunday: code sprints and clinics
>
>The conference is Django-focused, but all of all aspects of Python fall
>within its remit - particularly in the tutorials and workshops.

Tickets are on sale (the £50 early-bird tickets are nearly sold out). 

Tickets include meals and refreshments as well as other conference goodies.

We're accepting proposals for talks and tutorials. There'll be lightning talks 
too. We want a wide range of talks, so don't hestitate to submit a proposal.

We have a number of tutorials already confirmed:

*   Test-driven development
*   Building asynchronous applications with Tornado and Django
*   Getting started as a contributor to open-source projects

One of the aims of this conference is to create a big Django/Python/open-source 
software splash in Wales. Through our open-day activities we'll be showcasing 
Django and Python to local government and business, university researchers and 
students, local software developers and school teachers and pupils.

If you can put on a tutorial or demonstration that shows the power of 
Python/Django to one of these audiences, please drop us a line.

A number of Django core developers are already attending, and we hope more will 
confirm soon. They'll be there at the sprints and code clinics.

There are also several of super Django-using companies sponsoring the event.

There's information on international travel to Cardiff, discounted conference 
accommodation and other things to do while you're here all on our website: 
.

We hope to see you in Cardiff in February!

Daniele

-- 
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/20131216080749.584415959%40smtp.ntlworld.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Making sure I'm not missing out on some must have Django apps

2013-12-16 Thread Some Developer

On 15/12/2013 23:06, Frank Bieniek wrote:

Hi,
I would add some:
django-userena - user self registration
django-organizations - user and organizations
django-guardian - object level permissions
django-paranoia - paranoid security stuff
django-cache machine / johnny-cache

Thx
Frank


Thank for the list. I'll check them out.

Anyone else got anything to add?

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


Re: Django Debug Toolbar 1.0 beta released

2013-12-16 Thread kamagatos
Aymeric, I think the debug toolbar is very useful. I use it all the time. 
But on the other side, we should start thinking about a way to catch and 
display every ajax/json responses. because more and more applications are 
becoming ajax ready and they use front-end frameworks like angularjs or 
backbone to deal with getting stuff on the backend. I hope it makes sense.
 

On Sunday, December 15, 2013 8:11:50 AM UTC-5, Aymeric Augustin wrote:
>
> Hello,
>
> I'm happy to annonce that we're almost ready to release version 1.0 of the 
> Debug Toolbar! Now we need your help to try the beta:
>
> https://github.com/django-debug-toolbar/django-debug-toolbar/releases/tag/1.0-beta
>
> The documentation is available on Read the Docs — make sure you read the 
> "latest" version as there are many changes since 0.11:
> http://django-debug-toolbar.readthedocs.org/en/latest/
>
> Note that the setup process is different from previous versions:
>
> http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#quick-setup
>
> Please report issues on GitHub:
> https://github.com/django-debug-toolbar/django-debug-toolbar/issues
>
> If no major problems are found, we'll release 1.0 in one week.
>
> Here are the main changes from version 0.9.x and earlier. (Versions 0.10 
> and 0.11 were transitory versions leading to 1.0; they were released to 
> validate some choices before committing to support them for the lifetime of 
> 1.x.)
>
> - Panels are now rendered on demand, solving the "20MB HTML page" problem
> - Panels can be individually disabled from the frontend, in case a panel 
> degrades performance severely on a page
> - Interception of redirects can be toggled from the frontend
> - The handle can be dragged along the right side, in case it hides exactly 
> the part of the page you're working on :-) 
> - Static files are managed with django.contrib.staticfiles, solving a 
> series of URL-related issues
> - The setup process was rewritten, to provide a simplified automatic setup 
> and an optional explicit setup
> - Panels and settings received shorter or better names
> - A stable API for third-party panels is documented
> - The core of the toolbar was simplified drastically and almost all the 
> code was refactored into panels
> - The toolbar was made compatible with all current versions of Django and 
> Python, including Python 3.
> - The test suite was expanded and gained Selenium tests
> - Dozens of bugs were fixed
>
> I hope you'll like it!
>
> -- 
> Aymeric.
>

-- 
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/40ae5a4e-8ceb-4abc-ba4f-4fe1a7259eec%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Making sure I'm not missing out on some must have Django apps

2013-12-16 Thread kamagatos
I use all of the above,but additionally I would add to the list 
django-storages , 
python_social_auth , 
registration_with_email(a
 fork of django registration) and django 
htmlmin .

On Sunday, December 15, 2013 11:43:32 AM UTC-5, Some Developer wrote:
>
> Right so it has been quite awhile since I updated my list of must have 
> Django apps. I was wondering if anyone had any suggestions? 
>
> Currently I use the following in all my Django projects: 
>
> Django Debug Toolbar 
> debug_toolbar_htmltidy 
> inspector_panel 
> debug_toolbar_user_panel 
> South 
> Django Compressor 
>
> Any other apps that I should be using? I'm looking for general purpose 
> apps rather than specific apps as I can find the specific ones when I 
> need them. 
>

-- 
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/00a2166b-c93a-4ade-8562-d24ead551e01%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Debug Toolbar 1.0 beta released

2013-12-16 Thread Aymeric Augustin
On 16 déc. 2013, at 12:33, kamagatos  wrote:

> we should start thinking about a way to catch and display every ajax/json 
> responses. because more and more applications are becoming ajax ready and 
> they use front-end frameworks like angularjs or backbone to deal with getting 
> stuff on the backend.

Several people have already thought about it, and some have written code: 
https://github.com/django-debug-toolbar/django-debug-toolbar/pull/356. But as 
I’m not using the toolbar myself — I merely modernized it because I believe 
it’s an important component of the Django ecosystem — I’m lacking motivation to 
write that feature.

Fortunately, in version 1.0, the core of the toolbar has been slimmed down 
drastically; almost everything is implemented in panels. You can implement the 
feature you’re describing as a third-party panel, without any changes to the 
toolbar itself. If you write such a panel and it works well, then we could 
discuss merging in the toolbar.

The public API for panels is documented here: 
http://django-debug-toolbar.readthedocs.org/en/latest/panels.html#api-for-third-party-panels.
 I hope this helps!

-- 
Aymeric.

-- 
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/004E3AC7-169E-4647-B913-EA6A20EFEF77%40polytechnique.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Debug Toolbar 1.0 beta released

2013-12-16 Thread Thomas Weholt
I'm especially happy to see support for Python 3. Very nice.



On Sun, Dec 15, 2013 at 2:11 PM, Aymeric Augustin <
aymeric.augustin.2...@polytechnique.org> wrote:

> Hello,
>
> I'm happy to annonce that we're almost ready to release version 1.0 of the
> Debug Toolbar! Now we need your help to try the beta:
>
> https://github.com/django-debug-toolbar/django-debug-toolbar/releases/tag/1.0-beta
>
> The documentation is available on Read the Docs — make sure you read the
> "latest" version as there are many changes since 0.11:
> http://django-debug-toolbar.readthedocs.org/en/latest/
>
> Note that the setup process is different from previous versions:
>
> http://django-debug-toolbar.readthedocs.org/en/latest/installation.html#quick-setup
>
> Please report issues on GitHub:
> https://github.com/django-debug-toolbar/django-debug-toolbar/issues
>
> If no major problems are found, we'll release 1.0 in one week.
>
> Here are the main changes from version 0.9.x and earlier. (Versions 0.10
> and 0.11 were transitory versions leading to 1.0; they were released to
> validate some choices before committing to support them for the lifetime of
> 1.x.)
>
> - Panels are now rendered on demand, solving the "20MB HTML page" problem
> - Panels can be individually disabled from the frontend, in case a panel
> degrades performance severely on a page
> - Interception of redirects can be toggled from the frontend
> - The handle can be dragged along the right side, in case it hides exactly
> the part of the page you're working on :-)
> - Static files are managed with django.contrib.staticfiles, solving a
> series of URL-related issues
> - The setup process was rewritten, to provide a simplified automatic setup
> and an optional explicit setup
> - Panels and settings received shorter or better names
> - A stable API for third-party panels is documented
> - The core of the toolbar was simplified drastically and almost all the
> code was refactored into panels
> - The toolbar was made compatible with all current versions of Django and
> Python, including Python 3.
> - The test suite was expanded and gained Selenium tests
> - Dozens of bugs were fixed
>
> I hope you'll like it!
>
> --
> Aymeric.
>
> --
> 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/2d498dbe-3880-4986-9dc6-a4f7a68ed1b6%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

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


How to automatically test Django apps

2013-12-16 Thread Michael Herrmann
Hi everyone,

I'm working for a startup called BugFree Software. We're launching a new 
Python product for web automation today and, since you are all doing web 
development with Python, I wanted to let you know about it.

Helium is a library that wraps around Selenium to simplify web automation. 
It does away with many of the technicalities involved with web scripting. 
For example: Here is a Selenium script. Can you guess what it does?

>>> ff = Firefox()
...
>>> text_area = ff.find_element_by_id("u_0_1q")
>>> text_area.send_keys("Hello World!")
>>> button = ff.find_element_by_class_name("_42g-")
>>> button.click()

Here is the same script rewritten using Helium:

>>> start_firefox()
...
>>> write("Hello World!", into="Update Status")
>>> click("Post")

Can you now guess what it does? That's right; It updates your Facebook 
status.

In an extended comparison that we were invited to write for the December 
issue of Professional Tester (professionaltester.com), we found that an 
example script automating Gmail took 66% fewer lines of code and 75% less 
effort using Helium than with Selenium alone.

You can find more information and download Helium from http://heliumhq.com. 
Any feedback would be highly appreciated.

Hoping to hear your thoughts and comments,
Michael Herrmann
heliumhq.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/6bcfb36a-89cc-4911-9bcd-98aeeb12b26f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Site/Docs/Tutorials translation

2013-12-16 Thread Lucas Infante
Hello guys!

Sorry if my question is not being asked in the right place (I hope it is).

I am interested in translating Django official site/docs/tutorials into 
brazilian portuguese. Does anyone know who would I have to contact (to get 
information on how to do this) or how could I be able to contribute to 
Django Project in that way?

Thanks in advance!

-- 
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/8d53f953-fcc1-4a5b-b547-9751d58e6af3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to automatically test Django apps

2013-12-16 Thread Larry Martell
On Mon, Dec 16, 2013 at 6:37 AM, Michael Herrmann
 wrote:
> Hi everyone,
>
> I'm working for a startup called BugFree Software. We're launching a new
> Python product for web automation today and, since you are all doing web
> development with Python, I wanted to let you know about it.
>
> Helium is a library that wraps around Selenium to simplify web automation.
> It does away with many of the technicalities involved with web scripting.
> For example: Here is a Selenium script. Can you guess what it does?
>
> >>> ff = Firefox()
> ...
> >>> text_area = ff.find_element_by_id("u_0_1q")
> >>> text_area.send_keys("Hello World!")
> >>> button = ff.find_element_by_class_name("_42g-")
> >>> button.click()
>
> Here is the same script rewritten using Helium:
>
> >>> start_firefox()
> ...
> >>> write("Hello World!", into="Update Status")
> >>> click("Post")
>
> Can you now guess what it does? That's right; It updates your Facebook
> status.
>
> In an extended comparison that we were invited to write for the December
> issue of Professional Tester (professionaltester.com), we found that an
> example script automating Gmail took 66% fewer lines of code and 75% less
> effort using Helium than with Selenium alone.
>
> You can find more information and download Helium from http://heliumhq.com.
> Any feedback would be highly appreciated.
>
> Hoping to hear your thoughts and comments,


Is this open source?

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


Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
Hi

I am not able to figure this out. I want to add objects to a query set.

I have 2 models :
1. Projects which is basically a list of projects. I have a field which
defines the owner of the project. e.g. :

class Project(models.Model):
...
owner = models.ForeignKey(User)

2. ProjectMember - This is a table where I add any user ( other than owner
) if they are member of the project.

class ProjectMember(models.Model):
project = models.ForeignKey(Project)
member = models.ForeignKey(User)
added_on = models.DateTimeField()

What I am trying to do is get a list of projects which the current user is
either owner or member of. So, I have this in my view :

def mylist(request):
projects = Project.objects.filter(owner=request.user)
member_of = ProjectMember.objects.filter(member = request.user)
# Now find all projects the user is a member of and add to the projects
list
all_projects = projects
for m in member_of:
all_projects |= m.project
return render (request, "project/projects_mine.html",
{'projects':projects})


I am doing something wrong here as the line all_projects |= m.project is
not working. I tried with a += also.

How can I achieve what I am trying to do ?

Vibhu

-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

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


Re: Adding Objects to Query Set

2013-12-16 Thread Sebastian Morkisch
Hi

I am working on the same thing. Same here, one project model, one extended 
User model. Well, when I printed the request, I got the Usename, which is 
not an id, but you'd like to compare ids. Is that correct?

So perhaps you're closer to a solution, if you have a method like this:

def get_queryset(self):
   return Project.objects.filter(owner=self.request.user.id) <-- see that 
id?

Best regards,
Sebastian

>

-- 
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/9dec582e-41c0-47b1-a9ed-65850eac8585%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Adding Objects to Query Set

2013-12-16 Thread Andrew Farrell
It sounds like you just want a set of projects and don't actually need a
querySet.
You can do this with
projects = set( Project.objects.filter(owner=request.user).all() )
member_projects = set( ProjectMember.objects.filter(member = request.user) )
total_projects = set(projects) | set(member_projects)

You could also do
projects = Project.objects.filter(owner=request.user).all()
member_projects = ProjectMember.objects.filter(member =
request.user).exclude(project__owner=request.user).all()
total_projects = projects + member_projects


On Mon, Dec 16, 2013 at 8:47 AM, Vibhu Rishi  wrote:

> Hi
>
> I am not able to figure this out. I want to add objects to a query set.
>
> I have 2 models :
> 1. Projects which is basically a list of projects. I have a field which
> defines the owner of the project. e.g. :
>
> class Project(models.Model):
> ...
> owner = models.ForeignKey(User)
>
> 2. ProjectMember - This is a table where I add any user ( other than owner
> ) if they are member of the project.
>
> class ProjectMember(models.Model):
> project = models.ForeignKey(Project)
> member = models.ForeignKey(User)
> added_on = models.DateTimeField()
>
> What I am trying to do is get a list of projects which the current user is
> either owner or member of. So, I have this in my view :
>
> def mylist(request):
> projects = Project.objects.filter(owner=request.user)
> member_of = ProjectMember.objects.filter(member = request.user)
> # Now find all projects the user is a member of and add to the
> projects list
> all_projects = projects
> for m in member_of:
> all_projects |= m.project
> return render (request, "project/projects_mine.html",
> {'projects':projects})
>
>
> I am doing something wrong here as the line all_projects |= m.project is
> not working. I tried with a += also.
>
> How can I achieve what I am trying to do ?
>
> Vibhu
>
> --
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius
>
> --
> 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/CAPiONwm9%2Bnp_BROqjVEfmDaE_KgAnYnhv8u-GuiFBG7q2QeuaA%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%2By5TLaNBRwaYuRmJq1hzF2Lfb67dnOduu3%3D46_7TDX0TtRx%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Output of form in Extjs

2013-12-16 Thread Sean
Hi JJ,

I am very interested in the django form output in ExtJS style, has your 
code been upload somewhere I can have a look, such as github?
Also, my email address is liushu2...@gmail.com

Thanks,
Sean

On Tuesday, 4 September 2012 20:05:01 UTC+1, JJ wrote:
>
> Hi all,
> I created parse django to extjs in modelforms and forms. Basically works 
> as form.as_p but is form.extjs_output. I mapped all widgets fields to 
> extjs. I would like to submit this code to django-project. What do you 
> think?
> Thank you.
>
> João Júnior
>

-- 
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/f7c5db94-aad9-4570-9c71-60c28c504364%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
Hi Sebastian,

Not really. I want the list of project objects which is coming ok by
filtering on the user object. I checked it from commandline, and I am
getting it correctly.

The problem is the 2nd table. I want to get the projects from the 1st table
when the user is a member as specified in the 2nd table.

e.g. following is the full list of projects. + denotes that I am owner. *
denotes where I am a member.

Project1
Project2 ( + )
Project 3
Project4 ( * )

When I do a projects = Project.objects.filter(owner=request.user) I get a
query set like :
[]

Now, when I do member_projects= Member.objects.filter(member=request.user)
I get a query set like:
[]

So far so good. I dont have any issues from them. However, in my templates,
now I need to pass on 2 querysets because these objects are different. I
have 2 loops for listing the projects. one for projects where I print the
name as  {{ o.name }} and one for the ProjectMember where I print the name
as o.project.name . I want to make the code neater and have just one loop :)

Now from the 2nd queryset ( since the object type is different), I want to
take out the actual project objects and add to the 1st set. Thats where I
am hitting a roadblock.

for o in member_projects
   o.project

works fine, as I get the project object.

However, now I want to add this project into the 1st queryset  - and there
i am not able to.

Hope this clears what I am trying to achieve!

V.

On Mon, Dec 16, 2013 at 8:21 PM, Sebastian Morkisch
wrote:

> Hi
>
> I am working on the same thing. Same here, one project model, one extended
> User model. Well, when I printed the request, I got the Usename, which is
> not an id, but you'd like to compare ids. Is that correct?
>
> So perhaps you're closer to a solution, if you have a method like this:
>
> def get_queryset(self):
>return Project.objects.filter(owner=self.request.user.id) <-- see that
> id?
>
> Best regards,
> Sebastian
>
>>  --
> 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/9dec582e-41c0-47b1-a9ed-65850eac8585%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

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


Re: Adding Objects to Query Set

2013-12-16 Thread Vibhu Rishi
Hi Andrew,

The set seem to add on properly. How do i now access the project detail ?
When I try to iterate over it since this set is made of 2 different object
types, it fails for one of them.

e.g. i have in the project model attribute as 'name' for the project. so
when i iterate over the list like :

for o in totoal_projects:
  print o.name

this fails when it hits the ProjectMember objects as for them the name is
actually o.project.name

V.


On Mon, Dec 16, 2013 at 8:21 PM, Andrew Farrell wrote:

> It sounds like you just want a set of projects and don't actually need a
> querySet.
> You can do this with
> projects = set( Project.objects.filter(owner=request.user).all() )
> member_projects = set( ProjectMember.objects.filter(member = request.user)
> )
> total_projects = set(projects) | set(member_projects)
>
> You could also do
> projects = Project.objects.filter(owner=request.user).all()
> member_projects = ProjectMember.objects.filter(member =
> request.user).exclude(project__owner=request.user).all()
> total_projects = projects + member_projects
>
>
> On Mon, Dec 16, 2013 at 8:47 AM, Vibhu Rishi wrote:
>
>> Hi
>>
>> I am not able to figure this out. I want to add objects to a query set.
>>
>> I have 2 models :
>> 1. Projects which is basically a list of projects. I have a field which
>> defines the owner of the project. e.g. :
>>
>> class Project(models.Model):
>> ...
>> owner = models.ForeignKey(User)
>>
>> 2. ProjectMember - This is a table where I add any user ( other than
>> owner ) if they are member of the project.
>>
>> class ProjectMember(models.Model):
>> project = models.ForeignKey(Project)
>> member = models.ForeignKey(User)
>> added_on = models.DateTimeField()
>>
>> What I am trying to do is get a list of projects which the current user
>> is either owner or member of. So, I have this in my view :
>>
>> def mylist(request):
>> projects = Project.objects.filter(owner=request.user)
>> member_of = ProjectMember.objects.filter(member = request.user)
>> # Now find all projects the user is a member of and add to the
>> projects list
>> all_projects = projects
>> for m in member_of:
>> all_projects |= m.project
>> return render (request, "project/projects_mine.html",
>> {'projects':projects})
>>
>>
>> I am doing something wrong here as the line all_projects |= m.project is
>> not working. I tried with a += also.
>>
>> How can I achieve what I am trying to do ?
>>
>> Vibhu
>>
>> --
>> Simplicity is the ultimate sophistication. - Leonardo da Vinci
>> Life is really simple, but we insist on making it complicated. -
>> Confucius
>>
>> --
>> 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/CAPiONwm9%2Bnp_BROqjVEfmDaE_KgAnYnhv8u-GuiFBG7q2QeuaA%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%2By5TLaNBRwaYuRmJq1hzF2Lfb67dnOduu3%3D46_7TDX0TtRx%2Bw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

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


Re: Adding Objects to Query Set

2013-12-16 Thread antialiasis
Rather than fetching ProjectMember.objects.filter(member=request.user), you 
want to fetch 
Project.objects.filter(projectmember_set__member=request.user). That will 
get you Project objects rather than ProjectMember objects.

On Monday, December 16, 2013 1:47:13 PM UTC, Vibhu Rishi wrote:
>
> Hi 
>
> I am not able to figure this out. I want to add objects to a query set. 
>
> I have 2 models :
> 1. Projects which is basically a list of projects. I have a field which 
> defines the owner of the project. e.g. : 
>
> class Project(models.Model):
> ...
> owner = models.ForeignKey(User)
>
> 2. ProjectMember - This is a table where I add any user ( other than owner 
> ) if they are member of the project. 
>
> class ProjectMember(models.Model):
> project = models.ForeignKey(Project)
> member = models.ForeignKey(User)
> added_on = models.DateTimeField()
>
> What I am trying to do is get a list of projects which the current user is 
> either owner or member of. So, I have this in my view : 
>
> def mylist(request):
> projects = Project.objects.filter(owner=request.user)
> member_of = ProjectMember.objects.filter(member = request.user)
> # Now find all projects the user is a member of and add to the 
> projects list
> all_projects = projects
> for m in member_of:
> all_projects |= m.project
> return render (request, "project/projects_mine.html", 
> {'projects':projects})
>  
>
> I am doing something wrong here as the line all_projects |= m.project is 
> not working. I tried with a += also. 
>
> How can I achieve what I am trying to do ? 
>
> Vibhu
>
> -- 
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius 
>

-- 
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/094848da-0d22-47a2-b97a-0abed22cc5e2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django Tutorial 2 - Start the development server: why I couldn't get the admin’s login screen?

2013-12-16 Thread Yuqi Wang
I think I did every step before this, the tutorial says there should be the 
admin's login screen (fig 1 below), but the screen I got was the same as it 
was when no Django project was created (fig.2). I've no idea what went 
wrong.








-- 
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/a33c7a5e-86e0-40d6-b393-c1df55876ddc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django Tutorial 2 - Start the development server: why I couldn't get the admin’s login screen?

2013-12-16 Thread Thomas Murphy
Have you enabled admin in settings.py?

What about setting up the database and creating the initial super user?


On Mon, Dec 16, 2013 at 3:42 PM, Yuqi Wang  wrote:

> I think I did every step before this, the tutorial says there should be
> the admin's login screen (fig 1 below), but the screen I got was the same
> as it was when no Django project was created (fig.2). I've no idea what
> went wrong.
>
>
> 
>
>
>
> 
>
>
>
>  --
> 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/a33c7a5e-86e0-40d6-b393-c1df55876ddc%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/CALgvumX%2Bp6Vb7iqu9gY60pUhxGmp1ROkCMz0kaEiOuC2X9N1nA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Url logic

2013-12-16 Thread Branko Majic
On Sun, 15 Dec 2013 01:20:17 -0800 (PST)
giuliano.bertole...@gmail.com wrote:

>  
> Hello,
>  
> I'm wondering how you would you organize the url layout in a following 
> scenario
>  
> Suppose I've a table of Authors and for each author a list of books.
> A book can have only one author, so I link the author with a foreign key.
>  
> Now I could point to a particular author with a url like this (to show the 
> details)
>  
> /mylibrary/author/32
>  
> I wish to put a button to add a new book and would like the CreateView 
> derived class handling the request to collect the author id (32 in this 
> case) so my form would automatically set the foreign key and make it 
> unchangeable from the client browser.
>  
> Now the questions are:
>  
> 1) would you oranize the url in a way like this?   (notice that 32 is the 
> author id)
> /mylibrary/book/32/addnewbook
>  
> 2) how do I extract the slug within my BookNew (derived from CreateNew)?
> url(r'^book/(?P\d+)/addnewbook, BookNew.as_view()),
>  
> seems not avaliable as in the context/template: {{ slug }}
>  
> Cheers,
> Giulio.
>  

One way to take care of this is to have a URL of
form /mylibrary/book/new?author_id=32. I.e. you'd pass the default
values for author ID via GET parameter, and based on that you'd set-up
the query set for your form widget inside of a view.

I think this is just one possible approach, of course. The thing is,
this way it might be a bit easier to extend the schema for other fields
by adding extra GET parameters, and you'd avoid redundancy and
duplication with URLs (i.e. there's just one and only one URL for adding
books).

Best regards

-- 
Branko Majic
Jabber: bra...@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: bra...@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.


signature.asc
Description: PGP signature


Re: How to automatically test Django apps

2013-12-16 Thread Michael Herrmann
On Monday, December 16, 2013 1:54:01 PM UTC+1, rush wrote:
>
>  
> According to http://heliumhq.com/files/helium_license.txt it is not.
>
> Furthermore it is not free. According to their price page you have to pay 
> at least 200 euro per year to use it.
>

We added a Social License yesterday that is in fact free. :-) Check it out 
on http://heliumhq.com/purchase

M 

-- 
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/cc0c3dc0-072a-4e00-bdc8-5c22dcd3e85c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.