Template Inheritance doubt

2013-05-18 Thread Parin Porecha
Hi,

I have just started to learn Django's template inheritance and I am stuck
due to this problem -
In my application's 'base.html', I have defined two blocks -
{% block topbar %}{% endblock topbar %}
and
{% block sidebar %}{% endblock sidebar %}

I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
and 'topbar.html' which extends {% block topbar %}

The 'sidebar.html' is also divided into further blocks which are extended
by other templates.

Now, my question is -
in 'views.py', i have a view which is supposed to render the whole homepage
( i.e.- including the sidebar, topbar and content ). So, which template
should I load in the view, so that both sidebar and topbar plus the content
defined in other templates gets shown ?
because 'base.html' contains many children, I'm confused which one to load

Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't get
it completely :)

-- 
Regards,
Parin Porecha

say Kifflom!  and look forward to 17.09.13 !

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Guide for migrating to a custom user model?

2013-05-18 Thread Ponytech


On Thursday, April 18, 2013 6:34:02 AM UTC+2, Mike Dewhirst wrote:
>
> On 18/04/2013 12:33pm, Chris Streeter wrote: 
> > I found this [1] blog post to be interesting. I can't vouch for it's 
> > accuracy as I haven't migrated my own site yet, but it looks correct 
> > from reading it. 
> > 
>
> I agree it is interesting. And useful - thank you Ponytech :) 
>

My pleasure :)


 

> However, it assumes a desire to transfer the deprecated user_profile 
> data into a custom user model inheriting from abstract_user. 
>
> I'm looking for a guide which is even simpler and leaves the 
> user_profile model in place as a 1:1 model and just uses 
> django.contrib.auth.models.User (and Group) directly. Anything trickier 
> than this involves significant rewriting of my Django 1.4 project. 
>
> If User.get_profile() is deprecated I suppose I'll have to find another 
> way to fetch user_profile data in future. 
>
> I'll document what I actually do and offer that as a guide when I get 
> around to it - unless someone else gets in first. 
>
>
If you'd like to keep your user_profile model in place yes this guide is 
not about that.
Did you finally find any solution to your problem ?


 

> Mike 
>
> > - Chris 
> > 
> > 
> > [1]: 
> > 
> http://ponytech.net/blog/2013/03/31/migrate-your-user-profile-data-django-15-custom-user-model/
>  
> > 
> > 
> > On Wed, Apr 17, 2013 at 5:34 PM, Mike Dewhirst 
> >  
> > > wrote: 
> > 
> > On 18/04/2013 9:55am, Brian Neal wrote: 
> > 
> > Hello - 
> > 
> > I have a Django site that I've been maintaining for 4 years. It 
> is 
> > running Django 1.4 now and is using the usual Django User model 
> > plus the 
> > get_profile() method to retrieve some extra information for each 
> > user. 
> > Now that Django 1.5 has landed and we can substitute our own 
> > custom user 
> > model [1], I'm weighing my options for going forward. The 
> > get_profile() 
> > stuff is now deprecated and will go away in Django 1.7 [2]. I'm 
> > trying 
> > to decide if I should just keep my profile model around and do 
> > the joins 
> > [3], or substitute my own model. 
> > 
> > I'm wondering if there is a guide somewhere on how to do a 
> > migration to 
> > a custom user model? In a few places people recommend South, but 
> > I have 
> > no experience with South. Is it time to learn, or is it 
> > overkill? Or can 
> > I just write my own script to fix things up? Then I have to go 
> > through 
> > all my apps and refactor the user.get_profile() calls, right? 
> > And all 
> > those FK's to Django's User model will have to be changed? 
> > 
> > 
> > +1 Yes please. I'd be delighted to see such a thing. But there are 
> > so many ways to make custom users!! 
> > 
> > I tried a custom user and quickly decided it would be difficult for 
> > me to keep a common code-base. My conclusion was to stay with 1.4 
> > and (when I get time) to figure out the absolute minimum change 
> > required to go to 1.5. 
> > 
> > If I was specifying such a guide it would be "How to migrate an 
> > existing 1.4 app to 1.5 and achieve AUTH_PROFILE_MODULE 
> > functionality without a custom user and without using deprecated 
> > mechanisms" 
> > 
> > 
> > 
> > I was hoping there was a guide or some blog posts about how to 
> > do this 
> > but I haven't seen anything other than a few stackoverflow 
> > questions. 
> > 
> > Thanks, 
> > -BN 
> > 
> > 
> > [1]: 
> > 
> > https://docs.djangoproject.__com/en/1.5/topics/auth/__customizing/#substituting-a-__custom-user-model
> >  
>
> > <
> https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#substituting-a-custom-user-model>
>  
>
> > [2]: 
> > 
> > https://docs.djangoproject.__com/en/1.5/internals/__deprecation/#id4 
>
> > <
> https://docs.djangoproject.com/en/1.5/internals/deprecation/#id4> 
> > [3]: 
> > 
> > https://docs.djangoproject.__com/en/1.5/topics/auth/__customizing/#extending-the-__existing-user-model
> >  
>
> > <
> https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#extending-the-existing-user-model>
>  
>
> > 
> > 
> > -- 
> > 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+unsubscribe@__googlegroups.com 
> > . 
>
> > To post to this group, send email to 
> > django...@googlegroups.com  
> > . 
> > Visit this group at 
> >

Re: Template Inheritance doubt

2013-05-18 Thread Dow Street
It sounds like you are trying to have a template inherit code from multiple 
parents.  One option is to stay with a simple inheritance hierarchy where each 
child template extends at most one parent template.  If you want to use 
different code for different sub-sections of your project then just add a level 
to the hierarchy.

For example, you could add the content of topbar.html and sidebar.html into the 
topbar and sidebar blocks in the base template (i.e. inside your current topbar 
and sidebar block tags in base.html).  If a view template then extends the base 
template, but you do not want to include the topbar and sidebar code, add empty 
topbar and sidebar blocks to the view template so that the base code gets 
swapped out with an empty block.  

If you have different sections of your app and want to use different topbar and 
sidebar code in each, then add a level to your template hierarchy - something 
like:

base.html - overall site template
s1_base.html - extends base.html - put section specific topbar and sidebar code 
here
view1.html - extends s1_base.html - put view specific stuff in here

In this case you could leave empty topbar and sidebar blocks in base.html, 
adding the content to s1_base.html instead.  Or you could even have have 
view1.html extend sidebar1.html, which extends topbar1.html, which extends 
base.html or something like that (although I usually try to limit the hierarchy 
to 3-4 levels to make debugging easier).

Hope that helps.

R,
Dow



On May 18, 2013, at 2:14 AM, Parin Porecha  wrote:

> Hi,
> 
> I have just started to learn Django's template inheritance and I am stuck due 
> to this problem -
> In my application's 'base.html', I have defined two blocks -
> {% block topbar %}{% endblock topbar %}
> and
> {% block sidebar %}{% endblock sidebar %}
> 
> I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
> and 'topbar.html' which extends {% block topbar %}
> 
> The 'sidebar.html' is also divided into further blocks which are extended by 
> other templates.
> 
> Now, my question is -
> in 'views.py', i have a view which is supposed to render the whole homepage ( 
> i.e.- including the sidebar, topbar and content ). So, which template should 
> I load in the view, so that both sidebar and topbar plus the content defined 
> in other templates gets shown ?
> because 'base.html' contains many children, I'm confused which one to load
> 
> Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't get it 
> completely :)
> 
> -- 
> Regards,
> Parin Porecha
> 
> say Kifflom! and look forward to 17.09.13 !
> 
> -- 
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Noob: How do I get this app to work :(

2013-05-18 Thread Artem Zinoviev
hi Todd,
you try using generic views and you can`t :-) read this article - 
https://docs.djangoproject.com/en/1.5/topics/class-based-views/, it can 
help you.

best regards,

пятница, 17 мая 2013 г., 20:08:31 UTC+3 пользователь Todd Wickizer написал:
>
> Thanks Tom. I tried copying and pasting the urls.py data into the thing 
> and I got this error.
>
> Could not import django.views.generic.list_detail.object_detail. Parent 
> module django.views.generic.list_detail does not exist.
>
>
> I'm assuming that that is depreicated and that this app no longer works? 
> Somebody please confirm.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Noob: How do I get this app to work :(

2013-05-18 Thread Artem Zinoviev
try use something like this - https://github.com/jtuz/django-events-calendar

четверг, 16 мая 2013 г., 23:58:52 UTC+3 пользователь Todd Wickizer написал:
>
> Hello there,
>
> I just install Django yesterday. I am trying to take a calendar app and 
> edit it for my own means. Unfortunately I am a little confused on how to 
> create the Urls.py file to match the application.
>
> Here is the application.
>
> http://code.google.com/p/django-event-calendar/source/browse/#svn%2Ftrunk%2Fevents
>
>
> The admin menu + add event + add event category works great. But when I 
> click on 'view this event' I get a 404 error.
>
> Additionally I see this app uses Template Tags, which I know little about.
>
>
> I'm not sure if I am supposed to offer money for this? If it is required I 
> am willing to pay for help
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Template Inheritance doubt

2013-05-18 Thread Artem Zinoviev
if you have base.html and sidebar.html, base.html file just declare {% 
block sidebar %} section and sidebar.html make implementation of it, if you 
have SidebarView, then you load sidebar.html and this file take all from {% 
extends base.html %}. And if you try load base.html from SidebarView - you 
get it :-), but {% block sidebar %} section be blank...

суббота, 18 мая 2013 г., 12:14:37 UTC+3 пользователь Parin Porecha написал:
>
> Hi,
>
> I have just started to learn Django's template inheritance and I am stuck 
> due to this problem -
> In my application's 'base.html', I have defined two blocks -
> {% block topbar %}{% endblock topbar %}
> and
> {% block sidebar %}{% endblock sidebar %}
>
> I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
> and 'topbar.html' which extends {% block topbar %}
>
> The 'sidebar.html' is also divided into further blocks which are extended 
> by other templates.
>
> Now, my question is -
> in 'views.py', i have a view which is supposed to render the whole 
> homepage ( i.e.- including the sidebar, topbar and content ). So, which 
> template should I load in the view, so that both sidebar and topbar plus 
> the content defined in other templates gets shown ?
> because 'base.html' contains many children, I'm confused which one to load
>
> Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't get 
> it completely :)
>
> -- 
> Regards,
> Parin Porecha
>
> say Kifflom!  and look forward to 17.09.13!
>  

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Trees in Django

2013-05-18 Thread Artem Zinoviev
first parameter of render() function must be request...
try do it like this: 
*
   return render(request, "tree.html", {'annotated_list':annotated_list})
*
пятница, 17 мая 2013 г., 17:28:12 UTC+3 пользователь Cody Scott написал:
>
> I am categorizing models in a tree. The tree is created based on a string 
> of where the model falls in the tree. The tree will not change once it is 
> created.
>
> I tried using django-mptt with this code to create the tree.
>
> def add_new_nodes(category_string):
> for category in category_string.split(','):
> try:
> root = Category.get_root()
> except:
> root = Category.objects.create(value='')
> current_node = root
> for step in category.split(':'):
> added = False
> for node in current_node.get_children().all():
> print node.value
> print step
> if node.value == step:
> added = True
> current_node = node
> break
> if not added:
> new_node = Category.objects.create(value=step, 
> parent=current_node)
> current_node = new_node
>
>
> But it each time is creating a new branch from the root even with two 
> children of the root with the same name.
>
>
> Or at least that is what I get from
>
>
> {% load mptt_tags %}
> {% recursetree nodes %}
> 
> {{ node.name }}
> {% if not node.is_leaf_node %}
> 
> {{ children }}
> 
> {% endif %}
> 
> {% endrecursetree %}
>
>
>
> So I am trying to use django-treebeard similarly but I am getting an error. 
> 'str' object has no attribute 'META'
>
>
> def tree(request):
> try:
> root = Category1.get_root_nodes()[0]
> except:
> root = Category1.add_root(value='')
> annotated_list = root.get_annotated_list()
> print annotated_list
> return render("tree.html", {'annotated_list':annotated_list})
>
>
> {% for item, info in annotated_list %}
> {% if info.open %}
> 
> {% else %}
> 
> {% endif %}
>
> {{ item }}
>
> {% for close in info.close %}
> 
> {% endfor %}{% endfor %}
>
>
> But I get the error 'str' object has no attribute 'META'
>
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: new to Django and building web applications. Advice with postgresql

2013-05-18 Thread Artem Zinoviev
you want learn django or postgres ? :-) postgres is cool stuff but it 
not requited... try this course - 
https://www.udemy.com/coding-for-entrepreneurs/, (in reddit you can find only 
1$
)

пятница, 17 мая 2013 г., 8:16:59 UTC+3 пользователь d.gu...@gmail.com 
написал:
>
> Hi, 
>
> I'm new to building web applications, django, backend work, etc... I have 
> experience in C++ up to A.P. computer science level if that means anything 
> and I'm beginning to get a grasp on the python language. I've done all of 
> the exercises on code academy and have watched fairly a lot of videos on 
> building with django and python. I have somewhat of a grasp on the overall 
> design of files in the terminal that are involved (url.py, views.py, 
> etc...). I've been following 
> http://www.djangobook.com/en/2.0/chapter02.html. My question is It was 
> suggested by this free online open source book to install postgresql, so I 
> did but I had no idea how to use it and kind of gave up on it and setting 
> up the backend. Can anyone suggest a resource a book perhaps that can guide 
> me in the right direction or just give some friendly advice. My goal by the 
> end of the summer is to be able to build a substantial dynamic web 
> application with python in Django that will have the feel of a Khan Academy 
> or code academy (a dynamic website that is able to hold lots of content and 
> have a user-interface with accounts, logins, rewards systems and much more) 
> and be launced on the web for the world to see and use. The only other true 
> experience I have with web design is with static web pages and basic HTML 
> and CSS. Yes, it is a big goal, but I think I can do it with the right 
> amount of guidance. I have all summer to learn. Hell, you have to start 
> somewhere right? All suggestions are welcome.
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: new to Django and building web applications. Advice with postgresql

2013-05-18 Thread Artem Zinoviev
this is the best way - https://django.2scoops.org/, and you can 
use something like this django template project for your task -h
ttps://github.com/nigma/django-modern-template,
 
it have memcached integrated AWS S3 for static files and so on...

пятница, 17 мая 2013 г., 8:16:59 UTC+3 пользователь d.gu...@gmail.com 
написал:
>
> Hi, 
>
> I'm new to building web applications, django, backend work, etc... I have 
> experience in C++ up to A.P. computer science level if that means anything 
> and I'm beginning to get a grasp on the python language. I've done all of 
> the exercises on code academy and have watched fairly a lot of videos on 
> building with django and python. I have somewhat of a grasp on the overall 
> design of files in the terminal that are involved (url.py, views.py, 
> etc...). I've been following 
> http://www.djangobook.com/en/2.0/chapter02.html. My question is It was 
> suggested by this free online open source book to install postgresql, so I 
> did but I had no idea how to use it and kind of gave up on it and setting 
> up the backend. Can anyone suggest a resource a book perhaps that can guide 
> me in the right direction or just give some friendly advice. My goal by the 
> end of the summer is to be able to build a substantial dynamic web 
> application with python in Django that will have the feel of a Khan Academy 
> or code academy (a dynamic website that is able to hold lots of content and 
> have a user-interface with accounts, logins, rewards systems and much more) 
> and be launced on the web for the world to see and use. The only other true 
> experience I have with web design is with static web pages and basic HTML 
> and CSS. Yes, it is a big goal, but I think I can do it with the right 
> amount of guidance. I have all summer to learn. Hell, you have to start 
> somewhere right? All suggestions are welcome.
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: OperationalError: (1040, 'Too many connections')

2013-05-18 Thread Artem Zinoviev
use postgreSQL

пятница, 17 мая 2013 г., 21:24:10 UTC+3 пользователь frocco написал:
>
> Hello,
>
> How can I resolve this in django 1.5?
>
> webfaction allows max 90 connections.
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Wrong formatting while using Tabular Inlines in Django admin

2013-05-18 Thread Artem Zinoviev
you see this in safari only or chrome do it exactly?

суббота, 18 мая 2013 г., 3:34:38 UTC+3 пользователь Nikos Delibaltadakis 
написал:
>
> I use Django 1.5.1 out of the box in a virtual environment in my Mac. I 
> just created an app with two models, so the one can be used as inline in 
> the form of the other. While reducing the width of my browser I notice that 
> the table inside the inline, does not keep the same width with the other 
> elements in the page. See pictures.
>
> The big picture: http://i.imgur.com/XxugMJJ.png 
>
> Detail: http://i.imgur.com/SbqL6Jp.png
>
> I have used a brand new installation with only the necessary to make admin 
> run.
>
> Is this the expected behavior?
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Wrong formatting while using Tabular Inlines in Django admin

2013-05-18 Thread Artem Zinoviev
this can help? - 
http://www.codingnot.es/bootstrap-your-django-admin-in-3-minutes/

суббота, 18 мая 2013 г., 3:34:38 UTC+3 пользователь Nikos Delibaltadakis 
написал:
>
> I use Django 1.5.1 out of the box in a virtual environment in my Mac. I 
> just created an app with two models, so the one can be used as inline in 
> the form of the other. While reducing the width of my browser I notice that 
> the table inside the inline, does not keep the same width with the other 
> elements in the page. See pictures.
>
> The big picture: http://i.imgur.com/XxugMJJ.png 
>
> Detail: http://i.imgur.com/SbqL6Jp.png
>
> I have used a brand new installation with only the necessary to make admin 
> run.
>
> Is this the expected behavior?
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to create google app for login in django project?

2013-05-18 Thread Artem Zinoviev
Hi Avnesh, you need google API 
consolefor creating app. 
docs . After you get your 
secret key use django-social-auth, or if you need login user only -use 
loginza 

пятница, 17 мая 2013 г., 13:16:40 UTC+3 пользователь Avnesh Shakya написал:
>
> hi,
> I want to create login button in my django login page, so i have to 
> create app first for creating button, but i am unable to create app in 
> google. how to create google app for login, please tell me about, and link, 
> so that i can create app in google for authentication.
>
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: OperationalError: (1040, 'Too many connections')

2013-05-18 Thread frocco
I have been looking for an easy way to convert, but nothing works for me.
I tried dumpdata, loaddata, but get duplicate key, when I look at the file, 
I see no duplicates.

I am open to suggestions on converting.

Thanks

On Saturday, May 18, 2013 12:51:28 PM UTC-4, Artem Zinoviev wrote:
>
> use postgreSQL
>
> пятница, 17 мая 2013 г., 21:24:10 UTC+3 пользователь frocco написал:
>>
>> Hello,
>>
>> How can I resolve this in django 1.5?
>>
>> webfaction allows max 90 connections.
>>
>> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django in the Mac App Store with BitNami

2013-05-18 Thread Artem Zinoviev
sorry, but why you use apache? one-click deployment in local computer? or 
in heroku? Can i use createproject from 
template? 
why You don`t like old way by - mkvirtualenv spam && pip install django && 
django-admin.py startproject ?? Django is not CMS... :-)

четверг, 16 мая 2013 г., 12:46:02 UTC+3 пользователь victoria написал:
>
> Hi,
>
> I guess that most of you already have a Django development environment set 
> up. However I want to share this with the django users. In BitNami we have 
> been packaging Django for a while together with Python, Apache and 
> MySQL/PostgreSQL and providing one-click deployment options. Now we have 
> prepared a package for the Mac App Store which makes it even easier to get 
> started for Mac OS X users. You need to download BitNami Stack for Django 
> from the Mac App 
> Storeand
>  follow the official Django guides. The installation steps can be 
> skipped because BitNami does it for you. I hope you enjoy Django even more 
> with this new deploy option. We wrote a blog 
> postentry
>  about it in case this sounds interesting to you and you want to learn 
> more about this.
>
> If you try it please feel free to let me know your comments I would really 
> appreciate to have your feedback.
>
> Thanks,
>
> Victoria. 

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Help converting from mysql to postgres

2013-05-18 Thread frocco
Hello

Here are my steps.

python manage.py dumpdata --database=legacy > data.json

python manage.py loaddata  data.json --database=default

IntegrityError: Problem installing fixture 'data.json': Could not load 
accounts.UserProfile(pk=17): duplicate key value violates unique constraint 
"accounts_userprofile_user_id_key"
DETAIL:  Key (user_id)=(17) already exists.

In the mysql table, there is only one record with user_id 17

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




no module name.models

2013-05-18 Thread Kakar Arunachal Service
I'm practicing from a book Begining django e-commerce and m stuck in one
place. My project name is ecomstore, and in it i have two app, one is
preview and the other is catalog. In my preview app, there's just html in
the templates dir, and thats not the problem, because the result was fine
when i ran the server. And then i made a new app, catalog. It has two
models, Category and Product. Then to register it with the admin, i made
one admin.py file. And there i imported those two module by:
from django.contrib import admin
from django.ecomstore.catalog.models import Category, Product
...and some other forms related import.
Then when i run the server, i get an Import error: No module named
catalog.models.
I have installed my app in settings.py.  Hope u guys could solve my problem.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




no module name error

2013-05-18 Thread Kakar Arunachal Service
I'm practicing from a book Begining django e-commerce and m stuck in one
place. My project name is ecomstore, and in it i have two app, one is
preview and the other is catalog. In my preview app, there's just html in
the templates dir, and thats not the problem, because the result was fine
when i ran the server. And then i made a new app, catalog. It has two
models, Category and Product. Then to register it with the admin, i made
one admin.py file. And there i imported those two module by:
from django.contrib import admin
from django.ecomstore.catalog.models import Category, Product
...and some other forms related import.
Then when i run the server, i get an Import error: No module named
catalog.models.
I have installed my app in settings.py.  Hope u guys could solve my problem.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Unless you actually created your stuff inside your installation of Django
(or under some directory named site-packages or dist-packages), which is
not recommended, it is unlikely that the place from which you import
Category and Products will be named beginning with "django.".

The book may be assuming more background than you have.  If you haven't
already done so, doing, one time, the tutorial at
docs.djangoproject.com(be sure to do the one for the version of django
that you have installed),
is very worthwhile.  Things that you may have misinterpreted in the book
might then make perfect sense.

And if you're not already facile with python, the tutorial at
docs.python.org, again, be sure to do the one for the version of python
that you have, is worth doing first of all.

Bill


On Sat, May 18, 2013 at 3:42 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> I'm practicing from a book Begining django e-commerce and m stuck in one
> place. My project name is ecomstore, and in it i have two app, one is
> preview and the other is catalog. In my preview app, there's just html in
> the templates dir, and thats not the problem, because the result was fine
> when i ran the server. And then i made a new app, catalog. It has two
> models, Category and Product. Then to register it with the admin, i made
> one admin.py file. And there i imported those two module by:
> from django.contrib import admin
> from django.ecomstore.catalog.models import Category, Product
> ...and some other forms related import.
> Then when i run the server, i get an Import error: No module named
> catalog.models.
> I have installed my app in settings.py.  Hope u guys could solve my
> problem.
>
> --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Kakar Arunachal Service
Oh..m sorry. I mistyped, it was not django.ecomstore.catalog.models, but
just, ecomstore.catalog.models import Category, Product. N in the catalog
dir, it has __init__.py file, so should have done the problem. N m using
sqlite3 so i dnt need adapters too. Pls help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Does the ecomstore directory (as well as the catalog dirction) also have an
__init__.py file in it?  And is the ecomstore directory in the same
directory as manage.py ?

Or is ecomstore the project name, rather than part of an app with extra
levels?  (Still needs an __init__.py)   And if so, and if this is a recent
Django where settings.py is in a subdirectory (named ecomstore) of the
directory containing manage.py (probably also named ecomstore, since
startproject creates it that way), which ecomstore contains the catalog
directory (It needs to be where settings.py is, since you are qualifying it
with the project name)?


On Sat, May 18, 2013 at 4:04 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> Oh..m sorry. I mistyped, it was not django.ecomstore.catalog.models, but
> just, ecomstore.catalog.models import Category, Product. N in the catalog
> dir, it has __init__.py file, so should have done the problem. N m using
> sqlite3 so i dnt need adapters too. Pls help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help converting from mysql to postgres

2013-05-18 Thread frocco
I am getting 

IntegrityError: duplicate key value violates unique constraint 
"catalog_pricing_pkey" 
DETAIL: Key (id)=(8) already exists. 

catalog_pricing_id_seq
Start Value 8
Last Value 1
Increment 1


There are 8 records in table. id 1 through 8

If I reset sequence, last value is set to 1
if I restart sequence, last value is set to 8

On Saturday, May 18, 2013 1:23:04 PM UTC-4, frocco wrote:
>
> Hello
>
> Here are my steps.
>
> python manage.py dumpdata --database=legacy > data.json
>
> python manage.py loaddata  data.json --database=default
>
> IntegrityError: Problem installing fixture 'data.json': Could not load 
> accounts.UserProfile(pk=17): duplicate key value violates unique constraint 
> "accounts_userprofile_user_id_key"
> DETAIL:  Key (user_id)=(17) already exists.
>
> In the mysql table, there is only one record with user_id 17
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Kakar Arunachal Service
ecomstore is the project name. And within it, it has another ecomstore,
which has the __init__.py, settings.py, urls.py and wsgi.py. And yes
catalog too has the __init__.py file in it, as it was created by the
startapp command. The error says, import error: no module named
catalog.models in admin.py line 2, which is, from ecomstore.catalog.models
import Category Product.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Kakar Arunachal Service
The directory is as follows:
ecomstore
--manage.py
--ecomstore
  __init__.py
 settings.py
 urls.py
 wsgi.py
--preview
 __init__.py
 models.py
 views.py
 test.py
--templates
 --tags
   navigation.html
 base.html
 catalog.html
 index.html
--static
 css.css
--catalog
 __init__.py
 admin.py
 forms.py
 models.py
 tests.py
 views.py

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Yes, but of which directory is the catalog directory a sub-directory?  The
upper ecomstore (which contains manage.py) or the lower ecomstore (which
contains settings.py)?  Or is it somewhere else entirely?



On Sat, May 18, 2013 at 6:59 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> ecomstore is the project name. And within it, it has another ecomstore,
> which has the __init__.py, settings.py, urls.py and wsgi.py. And yes
> catalog too has the __init__.py file in it, as it was created by the
> startapp command. The error says, import error: no module named
> catalog.models in admin.py line 2, which is, from ecomstore.catalog.models
> import Category Product.
>
>  --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread kakararunachalservice

Its in the upper directory, i.e. where the manage.py is.



Sent from Samsung tablet

Bill Freeman  wrote:

Yes, but of which directory is the catalog directory a sub-directory?  The 
upper ecomstore (which contains manage.py) or the lower ecomstore (which 
contains settings.py)?  Or is it somewhere else entirely?



On Sat, May 18, 2013 at 6:59 PM, Kakar Arunachal Service 
 wrote:
ecomstore is the project name. And within it, it has another ecomstore, which 
has the __init__.py, settings.py, urls.py and wsgi.py. And yes catalog too has 
the __init__.py file in it, as it was created by the startapp command. The 
error says, import error: no module named catalog.models in admin.py line 2, 
which is, from ecomstore.catalog.models import Category Product.

-- 
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?hl=en.
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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Trailing zeros in DecimalField

2013-05-18 Thread Pedro J. Aramburu
I've been reviewing the code of *models.DecimalField* and *
forms.DecimalField* because trailing zeros after the decimal point are 
being removed in my forms. I didn't find anything suggesting that it's done 
there, instead they are handled properly according to my needs. Although 
the proper handling, on the django admin site forms the trailing zeros are 
being removed. 

Does anyone knows how to "fix" it? Is this a django-admin thing or have I 
missed something?

I would appreciate any insight.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Can you run:

   python manage.py shell

?  If you already have an error, try again with the 'ecomstore.catalog',
line commented out in settings.py

If shell runs without an error and gives you a python prompt, try the
following, in sequence until you get an error:

  >>> import ecomstore
  >>> import ecomstore.catalog
  >>> import ecomstore.catalog.models
  >>> dir(import.ecomstore.models)

If you make it this far, are Product and Category in the list?
If you got an error, at what point?


On Sat, May 18, 2013 at 7:10 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> The directory is as follows:
> ecomstore
> --manage.py
> --ecomstore
>   __init__.py
>  settings.py
>  urls.py
>  wsgi.py
> --preview
>  __init__.py
>  models.py
>  views.py
>  test.py
> --templates
>  --tags
>navigation.html
>  base.html
>  catalog.html
>  index.html
> --static
>  css.css
> --catalog
>  __init__.py
>  admin.py
>  forms.py
>  models.py
>  tests.py
>  views.py
>
> --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Ok.  If catalog is in the upper directory, take the leading "ecomstore."
off of the import statement.  Also remove it from the entry in
INSTALLED_APPS.

Alternatively, move the catalog directory (will all of its contents), into
the lower directory. If you are at a unix or mac os shell prompt the 'mv'
command will do this for you.  If you are on Windows or in a GUI drag and
drop may work, but you're on your own to know how to do it.

Things in the upper directory are directly available for import, without
prefixing them with the project name.  That whole directory is on sys.path
(as "") because that was the current directory when you typed "python
manage.py ...".  The name of this directory actually doesn't matter to
Django and Python.  The lower ecomstore is a python package (directory with
an __init__.py) in the upper directory, so *THAT* package can be imported
with:

   import ecomstore

and things inside that package can be imported by prefixing its name to
theirs (ecomstore.settings, ecomstore.url, ecomstore.wsgi, and, if you move
the catalog package there, ecomstore.catalog).


On Sat, May 18, 2013 at 7:31 PM, kakararunachalservice <
kakararunachalserv...@gmail.com> wrote:

>
> Its in the upper directory, i.e. where the manage.py is.
>
>
>
> Sent from Samsung tablet
>
>
> Bill Freeman  wrote:
>
>
> Yes, but of which directory is the catalog directory a sub-directory?  The
> upper ecomstore (which contains manage.py) or the lower ecomstore (which
> contains settings.py)?  Or is it somewhere else entirely?
>
>
>
> On Sat, May 18, 2013 at 6:59 PM, Kakar Arunachal Service <
> kakararunachalserv...@gmail.com> wrote:
>
>> ecomstore is the project name. And within it, it has another ecomstore,
>> which has the __init__.py, settings.py, urls.py and wsgi.py. And yes
>> catalog too has the __init__.py file in it, as it was created by the
>> startapp command. The error says, import error: no module named
>> catalog.models in admin.py line 2, which is, from ecomstore.catalog.models
>> import Category Product.
>>
>>  --
>> 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?hl=en.
>> 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?hl=en.
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Kakar Arunachal Service
Ok i removed ecomstore from,
from ecomstore.catalog.models import Product, Category
to
from catalog.models import Product, Category
And i think it worked fine. But now again it gives an error:
ImproperlyConfigured at/catalog - 'ProductAdmin.exclude' refers to field
'created_at' that is missing from the form.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Kakar Arunachal Service
And by the way thanks for being patience with me!

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name erro

2013-05-18 Thread Kakar Arunachal Service
Ok i got d solution for ProductAdmin not in the form problem. But thanks
again!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: no module name error

2013-05-18 Thread Bill Freeman
Since I'm unfamiliar with the book, I don't know about the 'created_at'
field, which must be specific to the book's app design.

Try commenting out the reference to 'created_at' in admin.py and see if you
get further.  If so, then try to be sure that you are following the book in
order, and that there aren't a set of changes that you need to make
together, of which you have only made some.  Try to be sure that you
understand each change the book makes, and read ahead before implementing
changes.

It's past my bedtime here, and I don't expect to be on line tomorrow.  Good
luck.  Someone else may step in to help, or if you're still having trouble
on Monday I'll try to find some more time.




On Sat, May 18, 2013 at 8:07 PM, Kakar Arunachal Service <
kakararunachalserv...@gmail.com> wrote:

> And by the way thanks for being patience with me!
>
> --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Doesn't display any comments

2013-05-18 Thread Anitha Rao


Try this template code:The template tags should be lined up in one single 
line.

Comments
{% get_comment_count for bookmarks.sharedbookmark shared_bookmark.idas 
comment_count %}
{% get_comment_list for bookmarks.sharedbookmark shared_bookmark.idas 
comment_list %}
{% for comment in comment_list %}

Posted by: {{ comment.user_name }} on
{{ comment.submit_date }}
{{ comment.comment|escape|urlizetrunc:40|
linebreaks }}

{% endfor%}
Number of comments: {{ comment_count }}
{% render_comment_form for bookmarks.sharedbookmarkshared_bookmark.id%}

view.py:

def bookmark_page(request, bookmark_id):
shared_bookmark = get_object_or_404(SharedBookmark,
id=bookmark_id)
variables = RequestContext(request, {
'shared_bookmark' : shared_bookmark
})
return render_to_response('bookmark_page.html', variables)

form.html:
{% if user.is_authenticated %}

{% csrf_token %}
Post a comment:






{% else %}
Please log in to post comments.
{% endif %}

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Doesn't display any comments

2013-05-18 Thread Anitha Rao
Your template code should be in the same line. like:

the template code:

Comments
{% get_comment_count for bookmarks.sharedbookmark shared_bookmark.idas 
comment_count %}
{% get_comment_list for bookmarks.sharedbookmark shared_bookmark.idas 
comment_list %}
{% for comment in comment_list %}

Posted by: {{ comment.user_name }} on
{{ comment.submit_date }}
{{ comment.comment|escape|urlizetrunc:40|
linebreaks }}

{% endfor%}
Number of comments: {{ comment_count }}
{% render_comment_form for bookmarks.sharedbookmarkshared_bookmark.id%}

view.py:

def bookmark_page(request, bookmark_id):
shared_bookmark = get_object_or_404(SharedBookmark,
id=bookmark_id)
variables = RequestContext(request, {
'shared_bookmark' : shared_bookmark
})
return render_to_response('bookmark_page.html', variables)

form.html:
{% if user.is_authenticated %}

{% csrf_token %}
Post a comment:






{% else %}
Please log in to post comments.
{% endif %}


On Sunday, November 27, 2011 1:40:05 AM UTC-5, Tsung-Hsien wrote:
>
> I use comment of Django applicaition, and the comment page looks
> anything good, but when I post the comment, there is no comment
> displayed on the page without any problem showing.
>
> the template code:
>
> Comments
> {% get_comment_count for bookmarks.sharedbookmarkshared_bookmark.idas 
> comment_count %}
> {% get_comment_list for bookmarks.sharedbookmarkshared_bookmark.idas 
> comment_list %}
> {% for comment in comment_list %}
> 
> Posted by: {{ comment.user_name }} on
> {{ comment.submit_date }}
> {{ comment.comment|escape|urlizetrunc:40|
> linebreaks }}
> 
> {% endfor%}
> Number of comments: {{ comment_count }}
> {% render_comment_form for 
> bookmarks.sharedbookmarkshared_bookmark.id%}
>
> view.py:
>
> def bookmark_page(request, bookmark_id):
> shared_bookmark = get_object_or_404(SharedBookmark,
> id=bookmark_id)
> variables = RequestContext(request, {
> 'shared_bookmark' : shared_bookmark
> })
> return render_to_response('bookmark_page.html', variables)
>
> form.html:
> {% if user.is_authenticated %}
> 
> {% csrf_token %}
> Post a comment:
> 
> 
> 
> 
> 
> 
> {% else %}
> Please log in to post comments.
> {% endif %}
>
> I tried replace shared_bookmark.id with
> object_pk,causing the page can't display the comment form.
>
> How to fix this?
> Thanks!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Template Inheritance doubt

2013-05-18 Thread Parin Porecha
Dow,
I am trying to have multiple children of the same parent. And thats why I'm
not able to decide which child to load. Anyways, the sidebar and topbar are
more or less static, so I guess there isn't much need to have separate
files for them. I want to have them different so that developing that
section of the website would be easier. In the end, I want to merge all
those different sections into one file and load that in my view. Can you
please help me with this ?

Artem,
Yes, I get it :) Thanks!


On Sat, May 18, 2013 at 9:56 PM, Artem Zinoviev wrote:

> if you have base.html and sidebar.html, base.html file just declare {%
> block sidebar %} section and sidebar.html make implementation of it, if
> you have SidebarView, then you load sidebar.html and this file take all
> from {% extends base.html %}. And if you try load base.html from
> SidebarView - you get it :-), but {% block sidebar %} section be blank...
>
> суббота, 18 мая 2013 г., 12:14:37 UTC+3 пользователь Parin Porecha написал:
>
>> Hi,
>>
>> I have just started to learn Django's template inheritance and I am stuck
>> due to this problem -
>> In my application's 'base.html', I have defined two blocks -
>> {% block topbar %}{% endblock topbar %}
>> and
>> {% block sidebar %}{% endblock sidebar %}
>>
>> I have 2 templates - 'sidebar.html' which extends {% block sidebar %}
>> and 'topbar.html' which extends {% block topbar %}
>>
>> The 'sidebar.html' is also divided into further blocks which are extended
>> by other templates.
>>
>> Now, my question is -
>> in 'views.py', i have a view which is supposed to render the whole
>> homepage ( i.e.- including the sidebar, topbar and content ). So, which
>> template should I load in the view, so that both sidebar and topbar plus
>> the content defined in other templates gets shown ?
>> because 'base.html' contains many children, I'm confused which one to load
>>
>> Thanks to mattmc who tried to help me with this in IRC. Sorry, didn't get
>> it completely :)
>>
>> --
>> Regards,
>> Parin Porecha
>>
>> say Kifflom!  and look forward to
>> 17.09.13 !
>>
>  --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Regards,
Parin Porecha

say Kifflom!  and look forward to 17.09.13 !

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




How to send xml payload by django test client?

2013-05-18 Thread Adam
Hi,

I am new to Django and Python...That is not a very good point for me to 
start up a new Django based web application. I am trying my best to learn 
how to work with Django. If this is a stupid question, please forgive my 
ignorance.

How could I send a xml payload by Django test client to my application?

Here is the code of the class based view I wrote for receiving the xml file.

class NewReport(View):
def post(self, request):
rawdata = request.body
## cannot accept the request if body is null
if (not rawdata):
return HttpResponse('naked body')

reportraw = ReportRaw(rawdata)
reportraw.save()
return HttpResponse('ok')


Here is the test code.

class ReportRawTests(TestCase):
def test_new_view_with_no_data(self):
"""
If no report embedded in a request.body, an appropriate error
code should be displayed.
"""
response = self.client.post(reverse('new'), {}) cause 
exception
self.assertEqual(response.status_code, 200)
self.assertContains(response, "naked body")

As the comment describes, the test is about how server side should response 
to a request which has no report data inside. The expected behaviour is 
that the server will return 'naked body' string in response object. 
However, the test code cannot work and I got exceptions. How could I send a 
real xml payload with the test client? What about a empty payload?

Best regards,
/Adam

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Help converting from mysql to postgres

2013-05-18 Thread Mike Dewhirst

I cannot claim any DBA credentials so be careful reading further.

I use dumpdata successfully with lots of --exclude=djkgd.sdsghg options 
only for testing fixtures. I have tried a few times and failed to get it 
working transferring between two Postgres databases.


I use postgres dump and load for that purpose. It is reliable and easy. 
I can show you my scripts for that if you want.


Maybe you can use MySQL dump and edit the output to look like the 
Postgres dump then load that?


Maybe someone has written converter?

Mike


On 19/05/2013 8:47am, frocco wrote:

I am getting

IntegrityError: duplicate key value violates unique constraint
"catalog_pricing_pkey"
DETAIL: Key (id)=(8) already exists.

catalog_pricing_id_seq
Start Value 8
Last Value 1
Increment 1


There are 8 records in table. id 1 through 8

If I reset sequence, last value is set to 1
if I restart sequence, last value is set to 8

On Saturday, May 18, 2013 1:23:04 PM UTC-4, frocco wrote:

Hello

Here are my steps.

python manage.py dumpdata --database=legacy > data.json

python manage.py loaddata  data.json --database=default

IntegrityError: Problem installing fixture 'data.json': Could not
load accounts.UserProfile(pk=17): duplicate key value violates
unique constraint "accounts_userprofile_user_id_key"
DETAIL:  Key (user_id)=(17) already exists.

In the mysql table, there is only one record with user_id 17

--
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?hl=en.
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: OperationalError: (1040, 'Too many connections')

2013-05-18 Thread Artem Zinoviev
http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL

суббота, 18 мая 2013 г., 20:00:15 UTC+3 пользователь frocco написал:
>
> I have been looking for an easy way to convert, but nothing works for me.
> I tried dumpdata, loaddata, but get duplicate key, when I look at the 
> file, I see no duplicates.
>
> I am open to suggestions on converting.
>
> Thanks
>
> On Saturday, May 18, 2013 12:51:28 PM UTC-4, Artem Zinoviev wrote:
>>
>> use postgreSQL
>>
>> пятница, 17 мая 2013 г., 21:24:10 UTC+3 пользователь frocco написал:
>>>
>>> Hello,
>>>
>>> How can I resolve this in django 1.5?
>>>
>>> webfaction allows max 90 connections.
>>>
>>> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.