Re: How to change type of field in model, when database is already populated ?

2015-05-17 Thread donarb
On Saturday, May 16, 2015 at 6:26:32 AM UTC-7, mangu rajpurohit wrote:
>
> Hi,
>
> I am new to Django. I am working on an application ,where the types of 
> table fields in database are not known before hand. So, say for eg. In 
> student table, I am assigning CharField to marks field, ie
>
> class Student(models.Model):
>  marks = model.CharField(max_length = 3)
>
> and after Student table in database is populated, can I change the type of 
> marks to IntegerField as shown below :-
>
> class Student(models.Model):
>  marks = model.IntegerField()
>
>
> Is it possible ? If not feasible, then what are the alternatives 
> ways/design strategies or what should be done in such cases ? If feasible, 
> then what are its side-effects ?
>
> Sorry for my poor english.
>

You can use the migration commands in Django to create new columns, then 
move and possibly convert the data to the new column.

https://docs.djangoproject.com/en/1.8/topics/migrations/#data-migrations


-- 
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/8001f1c0-775a-4df8-9334-b32cbc3e7689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with url template tag and namespaces

2015-04-07 Thread donarb
On Tuesday, April 7, 2015 at 9:19:17 AM UTC-7, donarb wrote:
>
> I'm having a problem with a generated url using the url template tag, 
> currently using Django 1.6.5.
>
> The appname is 'dashboard', here is the main urls.py:
>
> urlpatterns = patterns("",
> (r'^dashboard/', include('dashboard.urls', namespace='dashboard')),
> )
>
>
>
> Here is the dashboard urls.py:
>
> # dashboard/urls.py
> urlpatterns = patterns("",
> (r'^players/', include('players.urls', namespace='players')),
> )
>
>
> Here is the players urls.py:
>
> # dashboard/players/urls.py
> urlpatterns = patterns("",
> url(r'^search/?', views.PlayerSearchView.as_view(), name='search'),
> )
>
>
>
> When I code this in the template:
>
> {% url "dashboard:players:search" %}
>
>
>
> I get this url:
>
> /dashboard/playerssearch
>
>
> Any idea why there is no path separator between 'players' and 'search'?
>


Just to follow up, I found the problem. The search url pattern had an 
optional trailing '/', so it was not creating the url correctly. Once I 
removed the optional from the regex, it worked. 

-- 
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/a86d7bed-046a-4097-b607-5a6d7d6ecbd2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem with url template tag and namespaces

2015-04-07 Thread donarb
I'm having a problem with a generated url using the url template tag, 
currently using Django 1.6.5.

The appname is 'dashboard', here is the main urls.py:

urlpatterns = patterns("",
(r'^dashboard/', include('dashboard.urls', namespace='dashboard')),
)



Here is the dashboard urls.py:

# dashboard/urls.py
urlpatterns = patterns("",
(r'^players/', include('players.urls', namespace='players')),
)


Here is the players urls.py:

# dashboard/players/urls.py
urlpatterns = patterns("",
url(r'^search/?', views.PlayerSearchView.as_view(), name='search'),
)



When I code this in the template:

{% url "dashboard:players:search" %}



I get this url:

/dashboard/playerssearch


Any idea why there is no path separator between 'players' and 'search'?

-- 
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/5e041c5f-8b68-43f2-9a32-0266e5d50588%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error: 'NoneType' object has no attribute 'strip'

2014-12-03 Thread donarb
On Wednesday, December 3, 2014 11:59:42 AM UTC-8, Danish Ali wrote:
>
> this is stacktrace when I use: slug = AutoSlugField(populate_from='name') 
> in my model 
>
>
> Environment:
>
>
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/product/shop/add/
>
> Django Version: 1.7.1
> Python Version: 3.4.2
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'product')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "e:\python\lib\site-packages\django\core\handlers\base.py" in 
> get_response
>   111. response = wrapped_callback(request, 
> *callback_args, **callback_kwargs)
> File "e:\python\lib\site-packages\django\contrib\admin\options.py" in 
> wrapper
>   584. return self.admin_site.admin_view(view)(*args, 
> **kwargs)
> File "e:\python\lib\site-packages\django\utils\decorators.py" in 
> _wrapped_view
>   105. response = view_func(request, *args, **kwargs)
> File "e:\python\lib\site-packages\django\views\decorators\cache.py" in 
> _wrapped_view_func
>   52. response = view_func(request, *args, **kwargs)
> File "e:\python\lib\site-packages\django\contrib\admin\sites.py" in inner
>   204. return view(request, *args, **kwargs)
> File "e:\python\lib\site-packages\django\contrib\admin\options.py" in 
> add_view
>   1454. return self.changeform_view(request, None, form_url, 
> extra_context)
> File "e:\python\lib\site-packages\django\utils\decorators.py" in _wrapper
>   29. return bound_func(*args, **kwargs)
> File "e:\python\lib\site-packages\django\utils\decorators.py" in 
> _wrapped_view
>   105. response = view_func(request, *args, **kwargs)
> File "e:\python\lib\site-packages\django\utils\decorators.py" in bound_func
>   25. return func.__get__(self, type(self))(*args2, 
> **kwargs2)
> File "e:\python\lib\site-packages\django\db\transaction.py" in inner
>   394. return func(*args, **kwargs)
> File "e:\python\lib\site-packages\django\contrib\admin\options.py" in 
> changeform_view
>   1405. self.save_model(request, new_object, form, not add)
> File "e:\python\lib\site-packages\django\contrib\admin\options.py" in 
> save_model
>   1046. obj.save()
> File "e:\python\lib\site-packages\django\db\models\base.py" in save
>   591.force_update=force_update, 
> update_fields=update_fields)
> File "e:\python\lib\site-packages\django\db\models\base.py" in save_base
>   619. updated = self._save_table(raw, cls, force_insert, 
> force_update, using, update_fields)
> File "e:\python\lib\site-packages\django\db\models\base.py" in _save_table
>   700. result = self._do_insert(cls._base_manager, using, 
> fields, update_pk, raw)
> File "e:\python\lib\site-packages\django\db\models\base.py" in _do_insert
>   733.using=using, raw=raw)
> File "e:\python\lib\site-packages\django\db\models\manager.py" in 
> manager_method
>   92. return getattr(self.get_queryset(), name)(*args, 
> **kwargs)
> File "e:\python\lib\site-packages\django\db\models\query.py" in _insert
>   921. return 
> query.get_compiler(using=using).execute_sql(return_id)
> File "e:\python\lib\site-packages\django\db\models\sql\compiler.py" in 
> execute_sql
>   920. cursor.execute(sql, params)
> File "e:\python\lib\site-packages\django\db\backends\utils.py" in execute
>   85. sql = self.db.ops.last_executed_query(self.cursor, sql, 
> params)
> File "e:\python\lib\site-packages\mysql\connector\django\base.py" in 
> last_executed_query
>   371. return cursor.statement
> File "e:\python\lib\site-packages\mysql\connector\django\base.py" in 
> __getattr__
>   147. return getattr(self.cursor, attr)
> File "e:\python\lib\site-packages\mysql\connector\cursor.py" in statement
>   858. return self._executed.strip()
>
> Exception Type: AttributeError at /admin/product/shop/add/
> Exception Value: 'NoneType' object has no attribute 'strip'
>
>
Looks like a bug in MySQL/connector (although it could just be a symptom of 
doing the same thing in Django as the bug poster):

https://bugs.mysql.com/bug.php?id=74675


-- 
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 e

Re: Reverse for 'results' with arguments '(3L,)' and keyword arguments '{}' not found.

2014-12-02 Thread donarb
On Tuesday, December 2, 2014 6:39:46 AM UTC-8, Terry Lang wrote:
>
> I am in the middle of tutorial 4, but am getting an error.
> What did I do wrong?
>
> NoReverseMatch at /polls/3/vote/ 
>
> Reverse for 'results' with arguments '(3L,)' and keyword arguments '{}' not 
> found. 1 pattern(s) tried: [u'polls/(lP\\d+)/results/$']
>
>  Request Method: POST  Request URL: 
> http://www.alzacloud.net:8000/polls/3/vote/  Django Version: 1.7.1  Exception 
> Type: NoReverseMatch  Exception Value: 
>
> Reverse for 'results' with arguments '(3L,)' and keyword arguments '{}' not 
> found. 1 pattern(s) tried: [u'polls/(lP\\d+)/results/$']
>
>  Exception Location: 
> /home/terryl/cloud/local/lib/python2.7/site-packages/django/core/urlresolvers.py
>  
> in _reverse_with_prefix, line 468  Python Executable: 
> /home/terryl/cloud/bin/python  Python Version: 2.7.6  Python Path: 
>
> ['/home/terryl/pjtcloud',
>  '/home/terryl/cloud/lib/python2.7',
>  '/home/terryl/cloud/lib/python2.7/plat-x86_64-linux-gnu',
>  '/home/terryl/cloud/lib/python2.7/lib-tk',
>  '/home/terryl/cloud/lib/python2.7/lib-old',
>  '/home/terryl/cloud/lib/python2.7/lib-dynload',
>  '/usr/lib/python2.7',
>  '/usr/lib/python2.7/plat-x86_64-linux-gnu',
>  '/usr/lib/python2.7/lib-tk',
>  '/home/terryl/cloud/local/lib/python2.7/site-packages',
>  '/home/terryl/cloud/lib/python2.7/site-packages']
>
>
> polls/urls.py
>
> from django.conf.urls import patterns, include, url
> from django.contrib import admin
> from polls import views
>
> #urlpatterns = patterns('',
> #url(r'^polls/', include('polls.urls')),
> #url(r'^admin/', include(admin.site.urls)),
> #)
>
> # ex: /polls/
> # ex: /polls/5/
> # ex: /polls/5/results/
> # ex: /polls/5/vote/
> urlpatterns = patterns('',
> url(r'^$', views.index, name='index'),
> url(r'^(?P\d+)/$', views.detail, name='detail'),
> url(r'^(lP\d+)/results/$', views.results, name='results'),
> url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
> )
>
>
> polls/views.py
>
> from django.shortcuts import get_object_or_404, renderfrom django.http import 
> HttpResponseRedirect, HttpResponsefrom django.core.urlresolvers import reverse
> from polls.models import Choice, Question# ...def vote(request, question_id):
> p = get_object_or_404(Question, pk=question_id)
> try:
> selected_choice = p.choice_set.get(pk=request.POST['choice'])
> except (KeyError, Choice.DoesNotExist):
> # Redisplay the question voting form.
> return render(request, 'polls/detail.html', {
> 'question': p,
> 'error_message': "You didn't select a choice.",
> })
> else:
> selected_choice.votes += 1
> selected_choice.save()
> # Always return an HttpResponseRedirect after successfully dealing
> # with POST data. This prevents data from being posted twice if a
> # user hits the Back button.
> return HttpResponseRedirect(reverse('polls:results', args=(p.id,)))
>
>
>
Look at the regex for the results path match, you have a lowercase ell 
where there should be a question mark. 

-- 
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/a9144c16-af91-4187-8f55-91e23df5aa3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Does Django offers a way to generate data grid from database table like web2py

2014-11-28 Thread donarb
On Wednesday, November 26, 2014 10:33:25 PM UTC-8, Sarbjit singh wrote:
>
> Hi,
>
> I have been using web2py for sometime. I am exploring Django now, in 
> web2py there is a way to generate data grids (using SQLFORM.grid) which 
> generates very net grid based on the data model with support to add new 
> field/edit record/delete record/view record etc.
>
> Does Django (or any other package based on django) provides this 
> capability?
>
> Regards,
> Sarbjit
>


There's a couple of Django packages that provide datagrid capability. 
Haven't used any of them, so I can't say what's best.

https://github.com/djblets/djblets
https://github.com/agiliq/django-datagrid


 

-- 
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/17a5cdff-962e-43d2-bd62-0578446f6c70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Preventing race conditions when submitting forms

2014-11-25 Thread donarb
On Tuesday, November 25, 2014 7:57:08 AM UTC-8, Paul Johnston wrote:
>
> Hi,
>
> Consider an e-commerce site, where Alice and Bob are both editing the 
> product listings. Alice is improving descriptions, while Bob is updating 
> prices. They start editing the Acme Wonder Widget at the same time. Bob 
> finishes first and saves the product with the new price. Alice takes a bit 
> longer to update the description, and when she finishes, she saves the 
> product with her new description. Unfortunately, she also overwrites the 
> price with the old price, which was not intended.
>
> It's worth noting that the controller methods are thread-safe in 
> themselves. They use database transactions, which make them safe in the 
> sense that if Alice and Bob try to save at the precise same moment, it 
> won't cause corruption. The race condition arises from Alice or Bob having 
> stale data in their browser.
>
> Does Django have any way to prevent these race conditions? Just rejecting 
> the second edit with an "edit conflict" message would be a start - although 
> some intelligent merging would be even better.
>
> Thanks,
>
> Paul
>

Another option to consider for the problem you describe is to separate the 
product description and pricing into separate tables linked by foreign key, 
then restrict editing of each based on the user's group permission. I'm 
currently working on a sort of B2B e-commerce project where pricing can be 
different for each customer based on contract agreements (10 or so prices 
per product right now). We don't yet have a need for separate staff to edit 
products and prices, but the capability is there if it's ever needed.

-- 
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/68d0d761-6b67-4fe0-b8b7-71c12a31b0b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-25 Thread donarb


On Tuesday, November 25, 2014 5:33:02 AM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> Wow. Everything you've shown looks right.
>
> Here's something to try: replace base_site.html with a completely empty 
> file. That should cause the admin page to be completely blank.
>
> If that works, could you post a snippet of where you're changing the 
> template? Are you changing the  and expecting the  to be 
> different?
>
> Collin
>
>
> On Saturday, November 22, 2014 8:05:30 PM UTC-5, Andreas Ka wrote:
>>
>> Thanks for your help.
>>
>> I really think there is something wrong with that part of the tutorial. A 
>> small thing, but wrong.
>>
>>
>> > Check your settings file, 
>> > are there two TEMPLATE_DIRS variables defined?
>>
>> Nope. 
>>
>>
>> This is where I placed it:
>>
>> ...
>> import os
>> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
>> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>> ...
>>
>>
>> just tried this:
>>
>> import mysite.settings as settings
>> print settings.TEMPLATE_DIRS
>> ['D:\\Programming\\eclipse\\mysite\\templates']
>>
>> so no: not empty.
>>
>>
>> Why is my file templates/admin/base_site.html never called
>> when I open http://127.0.0.1:8000/admin/ or 
>> http://127.0.0.1:8000/admin/polls/  ?
>>
>>
>> Thanks.
>>
>>
>> On Fri, Nov 21, 2014 at 11:08 PM, donarb  wrote:
>>
>>> On Friday, November 21, 2014 10:59:19 AM UTC-8, Andreas Ka wrote:
>>>>
>>>> I don't know.
>>>> How to test that?
>>>>
>>>>
>>>>
>>>> The things I have done were these:
>>>> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>>>> customizing-your-project-s-templates
>>>>
>>>> mkdir templates
>>>> mkdir templates/admin
>>>> cp 
>>>> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html
>>>>  
>>>> templates/admin/
>>>>
>>>> ls -l templates/admin/base_site.html
>>>> -rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
>>>> (and www-data is member of that group)
>>>>
>>>> nano templates/admin/base_site.html   -> changed it to what I want to 
>>>> see
>>>> nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR, 
>>>> 'templates')]
>>>>
>>>> restarted the server.
>>>>
>>>> On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson  
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Do other templates work in that folder?
>>>>>
>>>>> Collin
>>>>>
>>>>>
>>>>> On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>>>>>
>>>>>>
>>>>>> > Show your view code
>>>>>> The tutorial did not create any view.py for the admin pages
>>>>>>
>>>>>>
>>>>>>
>>>>>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>>>>>> customize-the-admin-look-and-feel
>>>>>>
>>>>>> We copied from the Django source files these two into:
>>>>>> /mysite/templates/admin/base_site.html
>>>>>> and
>>>>>> /mysite/templates/admin/index.html
>>>>>>
>>>>>>
>>>>>>
>>>>>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#c
>>>>>> ustomize-the-admin-change-list
>>>>>> edited:
>>>>>>
>>>>>>
>>>>>> admin.py
>>>>>>
>>>>>> from django.contrib import admin
>>>>>>
>>>>>> # Register your models here.
>>>>>>
>>>>>> from django.contrib import admin
>>>>>> from polls.models import Choice, Question
>>>>>>
>>>>>>
>>>>>> class ChoiceInline(admin.TabularInline):
>>>>>> model = Choice
>>>>>> extra = 3
>>>>>>
>>>>>>
>>>>>> class QuestionAdmin(admin.ModelAdmin):
>>>>>> fieldsets = [
>>>>>> (None, 

Re: Image input missing from POST request

2014-11-22 Thread donarb
On Friday, November 21, 2014 7:56:54 PM UTC-8, Abhishek Batra wrote:
>
> Hi,
>
> This is probably not a Django issue, but just trying my luck.
>
> I have an input field corresponding to a Django ImageField in a Django 
> template. Rendered, the HTML looks like:
>
>method="post" 
>   id="profile_form"
>   enctype="multipart/form-data">
> ... (other input fields and elements) id="id_profile_pic" name="profile_pic" type="file" />
>
> The corresponding View is an UpdateView. I found request.FILES to be 
> empty and request.cleaned_data to contain 'profile_pic': None.
>
> I used firebug to track the POST data. It contained other fields but not 
> profile_pic.
>
> Can anyone say why the file does not get uploaded? I've posted this 
> question to StakOverflow 
> 
>  as 
> well, in case someone wants reputation points.
>
> Thanks,
> Abhishek Batra
>


The input field is outside the closing  tag so would not be uploaded 
as part of 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a9f69f16-861c-4a47-bd7f-6c52576ed739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Want to change home->blog to Admin home -> blog

2014-11-21 Thread donarb
On Friday, November 21, 2014 2:02:29 PM UTC-8, Collin Anderson wrote:
>
> Hi,
>
> Is your TEMPLATE_DIRS set correctly? The tutorial recommends this:
>
> TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
>
> Thanks,
> Collin
>
>
>
> On Tuesday, November 18, 2014 2:06:35 AM UTC-5, Sachin Tiwari wrote:
>>
>>
>>
>> On Thursday, November 13, 2014 7:49:28 PM UTC+5:30, Sachin Tiwari wrote:
>>>
>>>  Hi All,
>>>
>>>  I want to change Home link at admin page to Admin Home -> blog -> ...
>>>
>>>  I tried by modifying  base.html and base_site.html in my 
>>> templates/admin/, but it would work
>>>
>>>  {% block breadcrumbs %}
>>> 
>>> {% trans ' Admin Home' %}
>>> {% if title %} › {{ title }}{% endif %}
>>> 
>>> {% endblock %}
>>>
>>>Please help..
>>>
>>>
>>>
>>>
>>
>> Hi Collin,
>>
>> No changes will be reflected, Please suggest something.
>>  
>>
>

And is there only one TEMPLATE_DIRS variable defined? The settings.py 
template already has one, if the user follows the instructions to *add* 
that line and puts it before the default empty one, it may override and 
wipe out what the user added.

-- 
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/bd08b066-019c-4a97-b6ca-68a57979dda4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: my mysite/templates/admin/base_site.html is ignored (tutorial unclear?)

2014-11-21 Thread donarb
On Friday, November 21, 2014 10:59:19 AM UTC-8, Andreas Ka wrote:
>
> I don't know.
> How to test that?
>
>
>
> The things I have done were these:
>
> https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customizing-your-project-s-templates
>
> mkdir templates
> mkdir templates/admin
> cp 
> /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/base_site.html
>  
> templates/admin/
>
> ls -l templates/admin/base_site.html
> -rw-r--r-- 1 user group 338 Nov 21 18:50 templates/admin/base_site.html
> (and www-data is member of that group)
>
> nano templates/admin/base_site.html   -> changed it to what I want to see
> nano mysite/settings.py  -->   TEMPLATE_DIRS = [os.path.join(BASE_DIR, 
> 'templates')]
>
> restarted the server.
>
>
>
>
>
>
>
> On Fri, Nov 21, 2014 at 3:24 AM, Collin Anderson  > wrote:
>
>> Hi,
>>
>> Do other templates work in that folder?
>>
>> Collin
>>
>>
>> On Monday, November 17, 2014 4:12:27 PM UTC-5, Andreas Ka wrote:
>>
>>>
>>> > Show your view code
>>> The tutorial did not create any view.py for the admin pages
>>>
>>>
>>>
>>> See https://docs.djangoproject.com/en/1.7/intro/tutorial02/#customize-
>>> the-admin-look-and-feel
>>>
>>> We copied from the Django source files these two into:
>>> /mysite/templates/admin/base_site.html
>>> and
>>> /mysite/templates/admin/index.html
>>>
>>>
>>>
>>> and in https://docs.djangoproject.com/en/1.7/intro/tutorial02/#
>>> customize-the-admin-change-list
>>> edited:
>>>
>>>
>>> admin.py
>>>
>>> from django.contrib import admin
>>>
>>> # Register your models here.
>>>
>>> from django.contrib import admin
>>> from polls.models import Choice, Question
>>>
>>>
>>> class ChoiceInline(admin.TabularInline):
>>> model = Choice
>>> extra = 3
>>>
>>>
>>> class QuestionAdmin(admin.ModelAdmin):
>>> fieldsets = [
>>> (None,   {'fields': ['question_text']}),
>>> ('Date information', {'fields': ['pub_date'], 'classes': 
>>> ['collapse']}),
>>> ]
>>> inlines = [ChoiceInline]
>>> list_display = ('question_text', 'pub_date', 
>>> 'was_published_recently')
>>> list_filter = ['pub_date']
>>> search_fields = ['question_text']
>>>
>>> admin.site.register(Question, QuestionAdmin)
>>>
>>>
>>> ---
>>>
>>>
>>>
>>> On Mon, Nov 17, 2014 at 2:11 PM, Artie  wrote:
>>>
 Are you sure about correct path to your templates in views?

 Show your view code

 понедельник, 17 ноября 2014 г., 5:04:53 UTC+2 пользователь Andreas Ka 
 написал:
>
> thanks for your answer.
>
> yes, I just tried that. Same result.
>
  
>>>
 By now, I have understood much more about the templates.
>
  
>>>
 But still, for the admin pages
> mysite/templates/admin/base_site.html   
> doesn't work yet.
>
>
> ...
>

>>> On Sun, Nov 16, 2014 at 7:19 PM, RLF_UNIQUE  wrote:
>>>
 Obviously you've restarted the server and refreshed the page in such a 
 way to ensure it's not a caching issue ?
>>>
>>>
>>>  
>>>  
>>>
>>  -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/4062bb51-88cd-4c2f-9430-bd6ab87c8902%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
Check your settings file, are there two TEMPLATE_DIRS variables defined? 
Possibly you created one in your edit, but Django already has an empty one 
defined. If your edit was placed before the one that is already defined, it 
would end up empty, hence no override. 

-- 
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/5d66c7ab-92c0-4da7-9346-e25f3b2b8dcd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Uploadfile form and CSS Style

2014-11-17 Thread donarb
On Monday, November 17, 2014 5:00:54 AM UTC-8, Russo wrote:
>
> Hi James,
>
> sorry I'm new on Django, can you give me some code example? I mean, hot to 
> define the CLASS or ID into the html with elements like this {{ 
> form.docfile }} ?
>
> Regards
> Russo
>
>
> El jueves, 13 de noviembre de 2014 15:48:16 UTC-4:30, James Schneider 
> escribió:
>>
>> If you are manually expressing the form, then you can add classes and 
>> ID's to any or all elements in the form. Even if you are using something 
>> like the {{ form.as_p }} method to display the form, you can still style it 
>> using CSS styles at the tag level. Just include a custom CSS file with your 
>> template.
>>
>> -James
>> On Nov 13, 2014 12:13 PM, "Russo"  wrote:
>>
>>>  Hi Kakar,
>>>
>>> but i tried and there is not way to change the bottom style, see the 
>>> html code
>>>
>>> 
>>> >> enctype="multipart/form-data">
>>> {% csrf_token %}
>>>
>>> {{ form.non_field_errors }}
>>> {{ form.docfile.label_tag }} {{ form.docfile.help_text 
>>> }}
>>> 
>>> {{ form.docfile.errors }}
>>> {{ form.docfile }}
>>> 
>>> 
>>> 
>>>
>>> as it is a form there is no way to change style ¿?
>>>
>>> Regards/AR
>>>
>>>
>>> El 13/11/2014 a las 03:37 p.m., Kakar Nyori escribió:
>>>  
>>> Then you need to apply css to the form.
>>>
>>> On Fri, Nov 14, 2014 at 1:16 AM, Russo  
>>> wrote:
>>>
 Hi,

 i just implemented the uploadfile form on Django, and everything goes 
 greate, but i would like to do if it is possible to apply CSS styles to 
 the 
 upload botton on the forms, Anybody knows this?

 Regards
 Russo

 -- 
 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...@googlegroups.com.
 To post to this group, send email to django...@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/54650A9B.8040004%40musicparticles.com
 .
 For more options, visit https://groups.google.com/d/optout.

>>>  
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@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%2B8oko%2Bawro-H19b7XG-LXnNc4r%2BmFX0qTx_7kkvSmo%3Dvkg30A%40mail.gmail.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@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/5465119E.2030707%40musicparticles.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

I assume you have a form class for your form. In that class file, you can 
define the class or any other attribute that is used by that widget in your 
form, something like this (note, this is sort of off the top of my head, 
but you should be able to get the idea):

class MyForm(forms.Form):
upload = forms.FileField(widget=forms.FileInput(attrs={'class': 
'some_style' }))

-- 
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/87a213ab-3a49-4f6d-b01f-4a1679d122dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issue in Django 1.7.1 with __unicode__ and admin site?

2014-11-11 Thread donarb
On Tuesday, November 11, 2014 1:26:53 PM UTC-8, krmane wrote:
>
>
> That brings me to another related question. 
> I had asked this before but let's put it in a different way. 
> With the official Django tutorial for 1.7, they say it is ment for 
> Python 3X. 
> Do we have any plan to have some appendix on using the same tutorial for 
> Python 2.7x? 
> Like to have this code working with 2.7 do XYZ instead of ABC. 
> Happy hacking. 
> Krishnakant.On 11/12/2014 01:56 AM, Jorge Andrés Vergara Ebratt wrote: 
> > When you are in Python3 you don't use __unicode__ you use __str__ 
> > 
> > On Tue, Nov 11, 2014, 3:14 PM Arjan de Knegt  > 
> > wrote: 
> > 
> >> I am using Django 1.7.1 with python 3.4.0 for my latest project. 
> >> I am working on a model called Song. In the admin site all object that 
> I 
> >> add show as "Song object" where I would expect the title of the Song. I 
> >> have added __unicode__ to the model. is there something I miss or are 
> >> things changed in Django 1.7? Below the model and what is shown in the 
> >> admin site 
> >> 
> >> *Model:* 
> >> class Song(models.Model): 
> >>  title = models.CharField(max_length=100, verbose_name = 'Titel') 
> >>  author = models.CharField(max_length=100, verbose_name = 'Auteur') 
> >>  genre = models.ForeignKey('Genre', to_field='genre') 
> >>  featured = models.BooleanField(default = False, verbose_name = 
> >> 'featured') 
> >>  song_order = models.IntegerField() 
> >> 
> >>  class Meta: 
> >>  verbose_name = _('Song') 
> >>  verbose_name_plural = _('Songs') 
> >>  ordering = ['song_order'] 
> >> 
> >>  def __unicode__(self): 
> >>  return self.title 
> >> 
> >> *Shown in Admin site:* 
> >>   Song 
> >>Song object  Song 
> object 
> >>  Song object 
> >>  Song object 
> >>  
> >> 
> >> -- 
> >> 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...@googlegroups.com . 
> >> To post to this group, send email to django...@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/01cc75ba-302c-4066-9e4a-fbdc4f3504ea%40googlegroups.com
>  
> >> <
> https://groups.google.com/d/msgid/django-users/01cc75ba-302c-4066-9e4a-fbdc4f3504ea%40googlegroups.com?utm_medium=email&utm_source=footer>
>  
>
> >> . 
> >> For more options, visit https://groups.google.com/d/optout. 
> >> 
>
>
It's better to start another thread rather than hijacking a thread. 
Otherwise, people who have the same question as you can't tell by looking 
at the title of this post. But to answer your question, the comments at the 
start of the tutorial read as follows:

*If you are still using Python 2.7, you will need to adjust the code 
samples slightly, as described in comments.*

 

-- 
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/99931953-6f0e-4bc2-a82b-499e580d9831%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to test an application that's using a legacy database

2014-11-10 Thread donarb


On Monday, November 10, 2014 7:00:12 AM UTC-8, dpalao...@gmail.com wrote:
>
> Here comes the context. Sorry.
>
> On Monday, November 10, 2014 3:49:40 PM UTC+1, larry@gmail.com wrote:
>>
>>
>> No, when you run syncdb it will not create or modify any existing 
>> tables, only create new ones. 
>>
>
> Again,  are the docs 
>  wrong?
>
> David
>




Did you read the doc part you posted? 

"For tests involving models with managed=False, it’s up to you to ensure 
the correct tables are created as part of the test setup."

This means that when you are testing you need to make sure that your 
testing code creates that table, the testing process will not do it for you.

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


Re: Newbie operational error with Django db tables

2014-11-06 Thread donarb
On Thursday, November 6, 2014 6:31:08 AM UTC-8, Mr. crazy wrote:

> well,
>
> That is totally true.This is the problem which I need to find it's 
> solution.
> Do I have to make the table?? How?
> I looked for the DB tables and I didn't  find it-Maybe I did not searched 
> the correct place 
>
> I need help 
>
>
>
> On Thursday, November 6, 2014 9:04:05 PM UTC+8, Avraham Serour wrote:
>>
>> it looks like django is trying to access a table named downloads which 
>> doesn't seems to exists in the db
>>
>> On Thu, Nov 6, 2014 at 8:54 AM, Mr. crazy  wrote:
>>
>>> Hello,
>>>
>>> I'm working in a project where I use DionaeaFR to visualize my data 
>>> collected by Dionaea and the tutorial 
>>> I 
>>> followed uses Django Framework.
>>>
>>> Later I go and try to access the DionaeaFR graphs through my web 
>>> browser, However instead of seeing my graphs I see error "Operational 
>>> error"  :'(
>>>
>>> I searched online to look up for an answer on my issue bu I failed maybe 
>>> due to my knowledge being not very deep in this matter 
>>>
>>> here goes the traceback of the error :
>>>
>>> Environment:
>>>
>>>
>>> Request Method: GET
>>> Request URL: http://x.x.x.x:8000/
>>>
>>> Django Version: 1.7.1
>>> Python Version: 2.7.6
>>> Installed Applications:
>>> ('django.contrib.auth',
>>>  'django.contrib.contenttypes',
>>>  'django.contrib.sessions',
>>>  'django.contrib.sites',
>>>  'django.contrib.messages',
>>>  'django.contrib.staticfiles',
>>>  'compressor',
>>>  'django_tables2',
>>>  'django_tables2_simplefilter',
>>>  'pagination',
>>>  'django.contrib.humanize',
>>>  'Web')
>>> Installed Middleware:
>>> ('django.middleware.gzip.GZipMiddleware',
>>>  'htmlmin.middleware.HtmlMinifyMiddleware',
>>>  'django.middleware.common.CommonMiddleware',
>>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>>  'django.middleware.csrf.CsrfViewMiddleware',
>>>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>>>  'django.contrib.messages.middleware.MessageMiddleware',
>>>  'django.middleware.clickjacking.XFrameOptionsMiddleware',
>>>  'pagination.middleware.PaginationMiddleware')
>>>
>>>
>>> Traceback:
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in 
>>> get_response
>>>   98. resolver_match = 
>>> resolver.resolve(request.path_info)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
>>> resolve
>>>   343. for pattern in self.url_patterns:
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
>>> url_patterns
>>>   372. patterns = getattr(self.urlconf_module, "urlpatterns", 
>>> self.urlconf_module)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in 
>>> urlconf_module
>>>   366. self._urlconf_module = 
>>> import_module(self.urlconf_name)
>>> File "/usr/lib/python2.7/importlib/__init__.py" in import_module
>>>   37. __import__(name)
>>> File "/opt/DionaeaFR/DionaeaFR/urls.py" in 
>>>   5. from Web.views.download import downloadIndex
>>> File "/opt/DionaeaFR/Web/views/download.py" in 
>>>   11. length = len(Download.objects.all())
>>> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" 
>>> in __len__
>>>   122. self._fetch_all()
>>> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" 
>>> in _fetch_all
>>>   966. self._result_cache = list(self.iterator())
>>> File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" 
>>> in iterator
>>>   265. for row in compiler.results_iter():
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" 
>>> in results_iter
>>>   700. for rows in self.execute_sql(MULTI):
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" 
>>> in execute_sql
>>>   786. cursor.execute(sql, params)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in 
>>> execute
>>>   81. return super(CursorDebugWrapper, self).execute(sql, 
>>> params)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in 
>>> execute
>>>   65. return self.cursor.execute(sql, params)
>>> File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py" in 
>>> __exit__
>>>   94. six.reraise(dj_exc_type, dj_exc_value, traceback)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in 
>>> execute
>>>   65. return self.cursor.execute(sql, params)
>>> File 
>>> "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py" 
>>> in execute
>>>   485. return Database.Cursor.execute(self, query, params)
>>>
>>> Exception Type: OperationalError at /
>>> Exception Value: no such table: downloads
>>>
>>>
>>> I decided to drop a post h

Re: csrf question

2014-05-15 Thread donarb
On Wednesday, May 14, 2014 11:35:46 PM UTC-7, G Z wrote:
>
> So I read the documentation on passing csrf tokens, however its giving me 
> an issue i think its because im trying to pass it as a dictonary variable 
> with my form and customers.
>
> This is from the documentation
>
> from django.views.decorators.csrf import csrf_protectfrom django.shortcuts 
> import render
> @csrf_protectdef my_view(request):
> c = {}
> # ...
> return render(request, "a_template.html", c)
>
>
>
> from django.shortcuts import render
> from django.http import HttpResponse
> from vmware.models import Customer
> from django.shortcuts import render_to_response
> from vmware.models import Vms
> from .forms import SignUpForm
> from vmware.models import Vmspecs
> from django.views.decorators.csrf import csrf_protect
>
> @csrf_protect
> def index(request):
> c = {}
> form = SignUpForm(request.POST or None)
> if form.is_valid():
> save_it = form.save(commit=False)
> save_it.save()
> customers = Customer.objects.all()
> ctx = { 'customers':customers, 'form':form, c}
> return render_to_response('index.html', ctx)
>
>
>
> this is the error i get 
>
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://23.239.206.142:8000/
>
> Django Version: 1.6.4
> Python Version: 2.7.3
> Installed Applications:
> ('django.contrib.admin',
>  'django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.messages',
>  'django.contrib.staticfiles',
>  'vmware')
> Installed Middleware:
> ('django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.common.CommonMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
> in get_response
>   101. resolver_match = resolver.resolve(request.path_info)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in resolve
>   337. for pattern in self.url_patterns:
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in url_patterns
>   365. patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" 
> in urlconf_module
>   360. self._urlconf_module = import_module(self.urlconf_name)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/provisioning/urls.py" in 
>   7. url(r'^customers/', include('vmware.urls')),
> File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" 
> in include
>   26. urlconf_module = import_module(urlconf_module)
> File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in 
> import_module
>   40. __import__(name)
> File "/root/djangoprojects/provisioning/vmware/urls.py" in 
>   5. from vmware import views
>
> Exception Type: SyntaxError at /
> Exception Value: invalid syntax (views.py, line 19)
>
>
>
Specifically, you're passing 'c' into the ctx dictionary, but it has no 
key, that's the syntax error. But that c dictionary is redundant anyway 
since you've created your own context dictionary. Just remove the 
declaration of that object and don't pass it into the dictionary. 

-- 
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/d9d09fc9-5de0-4273-8a1d-446fdb485ffd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Template Based If Statement Issue

2014-05-12 Thread donarb


On Monday, May 12, 2014 3:37:47 PM UTC-7, G Z wrote:
>
> ok its still not putting out the vm data i get 
>
>
> Grant - google.com - 7029855378 - zuk...@gmail.com  - 2332 
> oakland st
> - -
>
>
> {% for customer in customers %}
> {{ customer.NAME }} - {{ customer.WEBSITE }} 
> -  {{customer.PHONE}} - {{ customer.EMAIL }} - {{ customer.ADDRESS }}   
>  
> {% for Vms in customer.vms_set.all %}
> {{ vms.id }} - {{ vms.NAME }} - {{ 
> vms.VMSTATUS }}
> {% endfor %}
> {% endfor %}
>
>
> def index(request):
>customers = Customer.objects.all()
>ctx = { 'customers':customers }
>return render_to_response('index.html', ctx)
>
>
>
>
> its still not working correctly.
>
>
>
You have

{% for Vms in customer.vms_set_all %} 

And then 

{{ vms.id }}...

Vms is not the same variable as vms.


-- 
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/15927d9c-e921-4e37-9549-90bc532b6b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What are the active Django e-commerce frameworks right now (2014)?

2014-04-26 Thread donarb
On Saturday, April 26, 2014 3:57:51 AM UTC-7, Brutus Schraiber wrote:
>
> Thanks 'somecallitblues' I will definitely take a closer look at Mezzanine 
> and Cartridge.
>
> But I'm kinda baffled. Only one answer after two weeks?
>
> Sure webshops might not be the hot topic anymore than they where a good 
> couple of years ago, and most people just use PHP and Magento anyway, but 
> still?
>
> Was my question too long? Is this the wrong place to ask such questions?
>
> I know I generally should use stackoverflow etc. first, but this is not 
> the kind of question thats welcome there...
>
> Any chance I get some more opinions on this? Or hints where I can get such?
>


What you may want to do is to go to some of the projects that you initially 
listed and ask questions of the users on their mailing lists as to what 
sorts of stores they are creating and why they picked that particular 
library.

I have been looking at some of the packages myself for some projects I'm 
wanting to do and I like what Oscar seems to be doing. Their Github account 
is pretty active and lots of good features are being added. 

-- 
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/34f402f0-0e65-49ac-adee-f93e285fd341%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: when I pip-installed django-debug-toolbar, the latest version of Django was installed automatically.

2014-02-18 Thread donarb


On Monday, February 17, 2014 9:56:09 PM UTC-8, jmin...@gmail.com wrote:
>
> hi Frank,
>
> I appreciate it but seem that this situation is so unusual  that people do 
> not understand. 
> I have done those already.
>
>
> So I do 
> 1) pip uninstall django
> 3) pip uninstall django-debug-toolbar
>
> 2) pip install django==1.3
>
>
>
> then it says:
>
>
> Downloading/unpacking django==1.3
>   Running setup.py egg_info for package django
>
> warning: no previously-included files matching '__pycache__' found 
> under directory '*'
> warning: no previously-included files matching '*.py[co]' found under 
> directory '*'
>   Requested django==1.3, but installing version 1.6.2
> Installing collected packages: django
>   Running setup.py install for django
>
> then the version 1.6 is installed. Any solution?  
>
>
>
>
>
> 2014年2月18日火曜日 9時17分13秒 UTC+9 Frank Bieniek:
>>
>>  Hi Jun,
>> to get your old django back
>> 1) pip uninstall django
>> 2) pip install django==1.3
>> 3) pip uninstall django-debug-toolbar
>> 4) pip install --no-deps django-debug-toolbar
>>
>> line 1 - remove existing django whatever version
>> line 2 - install django 1.3
>> line 3 - remove the django toolbar
>> line 4 says: install django-debug-toolbar but ignore all dependencies of 
>> this package.
>>
>> This should cleanup your environment
>> Cheers
>> Frank
>>
>>
>>
>>
>> Am 17.02.14 21:21, schrieb jmin...@gmail.com:
>>  
>> Hi Frank, 
>>
>>  Thank you for your advice but the version is still 1.6. I straggle with 
>> getting it back to the version 1.3.
>> pip install --no-deps django-debug-toolbar 
>> may help when the version become 1.6, right?
>>
>>  
>>  by the way, I tried
>> pip install --no-deps django==1.3
>>  did not help
>>
>>  Jun
>>
>> 2014年2月18日火曜日 5時01分53秒 UTC+9 Frank Bieniek: 
>>>
>>> Hi, 
>>>
>>> pip install --no-deps django-debug-toolbar 
>>> might help. --no-deps = no dependencies 
>>>
>>> I highly recommend you pip freeze 
>>> your current environement and then just do a pip install --no-deps 
>>> new_component_name, 
>>> thisway you know what is in your environment and no component can seek 
>>> stuff in... 
>>>
>>> hope this helps 
>>> Frank 
>>>
>>> http://pip.readthedocs.org/en/latest/user_guide.html#configuration 
>>>
>>> Am 17.02.2014 20:41, schrieb jmin...@gmail.com: 
>>> > Hello, 
>>> > 
>>> > when I pip-installed django-debug-toolbar, the latest version of 
>>> > Django was installed automatically. Not my intention. I got warning as 
>>> > below. 
>>> > 
>>> > 
>>> >  
>>> > WARNING! 
>>> >  
>>> > 
>>> > You have just installed Django over top of an existing 
>>> > installation, without removing it first. Because of this, 
>>> > your install may now include extraneous files from a 
>>> > previous version that have since been removed from 
>>> > Django. This is known to cause a variety of problems. You 
>>> > should manually remove the 
>>> > 
>>> > /usr/local/lib/python2.7/site-packages/django 
>>> > 
>>> > directory and re-install Django. 
>>> > 
>>> > 
>>> > 
>>> > 
>>> > but never asked if it is OK to do so. So, I tried to uninstall it and 
>>> > reinstall it. Wehn I do 
>>> > rm -rf django 
>>> > pip install django==1.3 
>>> > somehow, it says, 
>>> > 
>>> > 
>>> > Requested django==1.3, but installing version 1.6.2 
>>> > Installing collected packages: django 
>>> >   Running setup.py install for django 
>>> > 
>>> > 
>>> > Again version 1.6 was installed. Does anyone know the solution to it. 
>>> > Please. 
>>> > 
>>> > 
>>> > Jun 
>>> > -- 
>>> > 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...@googlegroups.com. 
>>> > To post to this group, send email to django...@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/a571e1ed-88e1-4263-b288-b34837fd9a80%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...@googlegroups.com.
>> To post to this group, send email to django...@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/02c62809-796b-4871-a7e2-de39f7ace459%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
What version of Python are you running? Django 1.3 runs with Python 2.4. 
I'm not sure, but maybe a higher version of Python is triggering a higher 
version dependency of Django.

If you 

Re: when I pip-installed django-debug-toolbar, the latest version of Django was installed automatically.

2014-02-18 Thread donarb


On Monday, February 17, 2014 9:56:09 PM UTC-8, jmin...@gmail.com wrote:
>
> hi Frank,
>
> I appreciate it but seem that this situation is so unusual  that people do 
> not understand. 
> I have done those already.
>
>
> So I do 
> 1) pip uninstall django
> 3) pip uninstall django-debug-toolbar
>
> 2) pip install django==1.3
>
>
>
> then it says:
>
>
> Downloading/unpacking django==1.3
>   Running setup.py egg_info for package django
>
> warning: no previously-included files matching '__pycache__' found 
> under directory '*'
> warning: no previously-included files matching '*.py[co]' found under 
> directory '*'
>   Requested django==1.3, but installing version 1.6.2
> Installing collected packages: django
>   Running setup.py install for django
>
> then the version 1.6 is installed. Any solution?  
>
>
>
>
>
> 2014年2月18日火曜日 9時17分13秒 UTC+9 Frank Bieniek:
>>
>>  Hi Jun,
>> to get your old django back
>> 1) pip uninstall django
>> 2) pip install django==1.3
>> 3) pip uninstall django-debug-toolbar
>> 4) pip install --no-deps django-debug-toolbar
>>
>> line 1 - remove existing django whatever version
>> line 2 - install django 1.3
>> line 3 - remove the django toolbar
>> line 4 says: install django-debug-toolbar but ignore all dependencies of 
>> this package.
>>
>> This should cleanup your environment
>> Cheers
>> Frank
>>
>>
>>
>>
>> Am 17.02.14 21:21, schrieb jmin...@gmail.com:
>>  
>> Hi Frank, 
>>
>>  Thank you for your advice but the version is still 1.6. I straggle with 
>> getting it back to the version 1.3.
>> pip install --no-deps django-debug-toolbar 
>> may help when the version become 1.6, right?
>>
>>  
>>  by the way, I tried
>> pip install --no-deps django==1.3
>>  did not help
>>
>>  Jun
>>
>> 2014年2月18日火曜日 5時01分53秒 UTC+9 Frank Bieniek: 
>>>
>>> Hi, 
>>>
>>> pip install --no-deps django-debug-toolbar 
>>> might help. --no-deps = no dependencies 
>>>
>>> I highly recommend you pip freeze 
>>> your current environement and then just do a pip install --no-deps 
>>> new_component_name, 
>>> thisway you know what is in your environment and no component can seek 
>>> stuff in... 
>>>
>>> hope this helps 
>>> Frank 
>>>
>>> http://pip.readthedocs.org/en/latest/user_guide.html#configuration 
>>>
>>> Am 17.02.2014 20:41, schrieb jmin...@gmail.com: 
>>> > Hello, 
>>> > 
>>> > when I pip-installed django-debug-toolbar, the latest version of 
>>> > Django was installed automatically. Not my intention. I got warning as 
>>> > below. 
>>> > 
>>> > 
>>> >  
>>> > WARNING! 
>>> >  
>>> > 
>>> > You have just installed Django over top of an existing 
>>> > installation, without removing it first. Because of this, 
>>> > your install may now include extraneous files from a 
>>> > previous version that have since been removed from 
>>> > Django. This is known to cause a variety of problems. You 
>>> > should manually remove the 
>>> > 
>>> > /usr/local/lib/python2.7/site-packages/django 
>>> > 
>>> > directory and re-install Django. 
>>> > 
>>> > 
>>> > 
>>> > 
>>> > but never asked if it is OK to do so. So, I tried to uninstall it and 
>>> > reinstall it. Wehn I do 
>>> > rm -rf django 
>>> > pip install django==1.3 
>>> > somehow, it says, 
>>> > 
>>> > 
>>> > Requested django==1.3, but installing version 1.6.2 
>>> > Installing collected packages: django 
>>> >   Running setup.py install for django 
>>> > 
>>> > 
>>> > Again version 1.6 was installed. Does anyone know the solution to it. 
>>> > Please. 
>>> > 
>>> > 
>>> > Jun 
>>> > -- 
>>> > 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...@googlegroups.com. 
>>> > To post to this group, send email to django...@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/a571e1ed-88e1-4263-b288-b34837fd9a80%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...@googlegroups.com.
>> To post to this group, send email to django...@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/02c62809-796b-4871-a7e2-de39f7ace459%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>

What is your version of python? Django 1.3 needs Python 2.4 to work. I'm 
guessing, but maybe a newer version of Python triggers a higher Django 
dependency.

If you really need to run D

Re: App_step.readme_id may not be NULL

2014-01-30 Thread donarb


On Thursday, January 30, 2014 9:08:22 AM UTC-8, Wnt2bsleepin wrote:
>
> I am new to Django and am trying to save two objects from the same form. 
>
> Models:
>
> class ReadmeTemplate(models.Model):
> """
> Represents a bugfix README
>
> Contains step models, which contain multiple steps.
> """
>
> def __unicode__(self):
> return self.title
>
> title = models.CharField(max_length=200)
> author = models.CharField(max_length=200)
> user = models.ForeignKey(User,editable=False)
>
>
> class Step(models.Model):
> """
> Represents a single step in a Readme Template
> """
> step_text = models.TextField()
> readme = models.ForeignKey(ReadmeTemplate)
>
>
> I am able to save the ReadmeTemplate fine, but the Steps are not able to 
> be saved. Here is what I am trying in the view.
>
> def createTemplate(request):
> StepFormSet = modelformset_factory(Step, max_num=100, 
> form=CreateStepForm,extra=1)
> if(request.method == 'POST'):
> readme_form = CreateReadmeTemplateForm(request.POST)
> step_forms = StepFormSet(request.POST)
> if readme_form.is_valid() and step_forms.is_valid():
> try:
> readme_object = readme_form.save()
> readme_object.user = request.user
> readme_object.save()
> step_forms.readme_id = readme_object.id
> step_forms.save()
> except forms.ValidationError, error:
> readme_object = None
>
> return HttpResponse(' type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", 
> "%s");' % (escape(readme_object._get_pk_val()), 
> escape(readme_object)))
> return 
> render(request,'App/newtemplate.html',{'readme_form':readme_form,'step_forms':
>  
> step_forms})
> else:
> readme_form = CreateReadmeTemplateForm()
> step_forms = StepFormSet(queryset=Step.objects.none())
> return 
> render(request,'App/newtemplate.html',{'readme_form':readme_form,'formset': 
> step_forms})
>
>
> Is there anyway to get the id of the readme object and assign it to the 
> step object? Thanks for any help.
>

All you need to do is to set the readme_object to the readme attribute of 
step_forms, Django will extract the id for you and set it appropriately.

step_forms.readme = readme_object


-- 
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/a98fdc71-e2d8-4d77-8ba7-60d34a718cf7%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-01-28 Thread donarb
On Tuesday, January 28, 2014 9:17:32 AM UTC-8, Malik Rumi wrote:
>
> This is somewhat like the question in "need help moving to production 
> server" but I think the right procedure is to start a new thread. So I 
> think I have done well for just starting out. With your help I've gotten 
> Django running on Windows, and I completed a tutorial and got my site 
> working locally with the admin. thank you.
>
> So I thought I was ready to move up to MySQL for some heavy lifting. I 
> followed the instructions I got here 
> http://matthewwittering.com/blog/how-to-migrating-the-database-engine-for-django.html.
>  
> I did not know what to do with the NAME part, so I put in 'django-1', and 
> promptly got the error message 'unknown database 'django-1'. I thought that 
> made sense because I hadn’t created this database in mysql already, but I 
> was just blindly following along. Having to CREATE DATABASE doesn’t make 
> sense, I thought, because it defeats the purpose of Django abstraction in 
> the first place. Besides, when I syncdb, it should take whatever name I 
> gave it when I was using sqlite3, right?
>
> Wrong. When I ran syncdb, this time with NAME: ' ', I got :   File 
> "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default 
> terror handlerraise errorclass, errorvalue 
> django.db.utils.OperationalError: (1046, 'No database selected').
>
> So, what am I missing here? There almost certainly is an easy solution I'm 
> not seeing. Do I need to create a database in mysql? If so, must it have 
> the same name as it had in sqlite3? I know that name was made from putting 
> the model name together with something else, but I don't actually remember 
> what it was, and it seems like a lot of extra work to install an sqlite 
> browser just to get that name right. If that's what I need to do, maybe I 
> can just open that file with notepad? 
>
> Or can I create the database, (presumably directly in the shell), and then 
> empty it, as these instructions say, and that will take care of it? I 
> frankly didn't understand why I would need to 'empty' a new and empty 
> database, but that's what it says. 
>
> Any and all helpful advise welcome and appreciated. 
>

You should go through the tutorial, which explains how to create a project.

>From the database setup page:

*"If you’re using PostgreSQL or MySQL, make sure you’ve created a database 
by this point. Do that with “CREATE DATABASE database_name;” within your 
database’s interactive prompt.*

*If you’re using SQLite, you don’t need to create anything beforehand - the 
database file will be created automatically when it is needed." *

https://docs.djangoproject.com/en/1.6/intro/tutorial01/#database-setup


-- 
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/c991d28f-720e-495a-b7ae-3e8d7e52dcef%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Commercial Django e-commerce products

2014-01-28 Thread donarb
On Tuesday, January 28, 2014 5:39:38 AM UTC-8, Alex Strickland wrote:
>
>
> Can anyone suggest any commercial Django e-commerce products? 
>
>
The only commercial one written in Django that I know of is WebCube. I know 
nothing about them, so can't make a suggestion.

www.getwebcube.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/2417d062-b5fa-4b86-92d1-c688bf317a65%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: List in a Template

2013-11-09 Thread donarb


On Saturday, November 9, 2013 5:37:19 PM UTC-8, donarb wrote:
>
>
> As I said, I haven't tested this and I may be buggy, but you should be 
> able to get the idea.
>
>
Um, I'm definitely not buggy, but my sample may be...

-- 
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/50ac62a7-e1bd-4af4-a424-6c6a4b93c44c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: List in a Template

2013-11-09 Thread donarb


On Saturday, November 9, 2013 9:28:01 AM UTC-8, Timothy W. Cook wrote:
>
> SOLVED (sort of). 
>
> On Sat, Nov 9, 2013 at 2:56 PM, donarb > 
> wrote: 
>
> > If the user is a manager, you should be able to just test for membership 
> in 
> > the list: 
> > 
> > {% if user in mgr_list %} 
>
> This made perfect sense after I realized that I was looking at a list 
> of objects and not just the email string returned from the model. But, 
> it didn't work. 
>
> > Another option would be to have a property such as "is_manager' and test 
> for 
> > that in the template. 
> > 
>
> I thought about this but I also need to see if the manager status has 
> expired. So I solved it in this way, though it may not be the most 
> efficient. 
>
> The view now creates an actual list of email addresses of users with 
> active manager status. 
>
> class IndexView(TemplateView): 
>
> template_name = 'index.html' 
>
> def get_context_data(self, **kwargs): 
> context = super(IndexView, self).get_context_data(**kwargs) 
> mlist = [] 
> for x in Manager.objects.all(): 
> if x.expires >= now(): 
> print(x.expires) 
> mlist.append(x.user.email) 
> context['mgr_list'] = mlist 
> return context 
>
>
> Is there a better way?  Will this be particularly slow if I have 1,000 
> managers? 
>
> Thanks, 
> Tim 
>

The better way is to use the database to find the values, rather than doing 
it in Python. Off the top of my head, I'd do something like this:

def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)

# Get all active managers from the database
q = Manager.objects.filter(expires__gte=now())

# Create a list of all of their email addresses, the values() and 
values_list() methods
# can pull out just the fields you want - 'flat' creates a list rather 
than a dict or tuple
mlist = q.values_list('user__email', flat=True)
context['mgr_list'] = mlist
return context

As I said, I haven't tested this and I may be buggy, but you should be able 
to get the idea.


-- 
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/c04a7b1d-67c2-48d4-9500-2a12453e4bd5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: List in a Template

2013-11-09 Thread donarb
On Saturday, November 9, 2013 5:55:07 AM UTC-8, Timothy W. Cook wrote:
>
> I have a view that creates a list of managers in the context. I want 
> to test if a logged in user is in the list before displaying a link to 
> the manager dashboard. 
>
> class IndexView(TemplateView): 
>
> template_name = 'index.html' 
>
> def get_context_data(self, **kwargs): 
> context = super(IndexView, self).get_context_data(**kwargs) 
> context['mgr_list'] = Manager.objects.all() # TODO: filter for 
> expired status 
> return context 
>
> The test in the template: 
> {% if user.is_authenticated %} 
>   logout 
>   {% if user.email in mgr_list %} 
>  Manager 
> Dashboard 
>   {% endif %} 
> {% else %} 
>   register 
>   login 
> {% endif %} 
>
> The correct items are displayed for the user.is_authenticated test. 
>
>
> Just for testing I put  {{mgr_list}} in my template and it displays this: 
>
> [>,  t...@mlhim.org>] 
>
>
> which is correct as far as the emails are concerned but I do not 
> understand where the 'Manager:' comes from and why are they wrapped in 
> angle brackets?  This seems to be why my 'if' doesn't test correctly 
> but I do not know what to change. 
>
> Thoughts? 
>
> Thanks, 
> Tim 
>
>
The problem is that you are trying to compare the email property of a user 
with a list of Managers. The angle bracket notation you show is Python's 
way of displaying object instances. It's showing there are two Manager 
objects in the list, the emails addresses you see are just the string 
representation of the object, a sort of shorthand to be able to identify 
different instances

If the user is a manager, you should be able to just test for membership in 
the list:

{% if user in mgr_list %}

Another option would be to have a property such as "is_manager' and test 
for that in the template.


-- 
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/daec375a-327c-40a1-9a87-e59be0ebdba1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Python shell displays Segmentation Fault: 11 after upgrade to Mavericks OS

2013-10-24 Thread donarb


On Thursday, October 24, 2013 2:34:13 PM UTC-7, Don Fox wrote:
>
>
>
> python manage.py  shell
>
> Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
>
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> (InteractiveConsole)
>
> >>> from polls.models import Poll, Choice
>
> >>> Poll.objects.all()
>
> Segmentation fault: 11
>
>
> This type of thing just started after upgrade. I assume there's a 
> connection.
>


Looks as though python-dev knows about it:

https://groups.google.com/forum/#!searchin/dev-python/mavericks/dev-python/5xMUs-1sRv8/5sYji7PDbYMJ

There is a temporary patch script available in the bug report at the given 
message number

http://bugs.python.org/issue18458#msg201087

-- 
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/f3a5a9f1-43f1-4b6e-9f90-3d411639b1bd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: View not working / how can I test it in the shell?

2013-10-11 Thread donarb
On Friday, October 11, 2013 2:48:13 PM UTC-7, Mario Osorio wrote:
>
> Hello all, working with mezzanine, I created in an app (newsroom) folder, 
> a views.py http://dpaste.com/1413587/. This view is an addition to the 
> blog app in site-packages. I then I put a section in my blog_post_list.html 
> template file to (supposedly) show the data from that view 
> http://dpaste.net/show/6cHStytzI5cqfICpFVAT/,
>  
> but I cannot see this data. blog_post_list.html is my home. Will someone 
> please point my mistake here? How can I test this view in the shell.TIA!
>

What is featured_post_list? You assign it in the context, but it doesn't 
appear anywhere (except as the name of the view method). Perhaps you meant 
to pass "blog_posts" instead?

-- 
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/21554f81-3490-434b-92be-23c07e1ee503%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ImportError: No module named django.core.management

2013-07-28 Thread donarb
On Sunday, July 28, 2013 7:31:39 AM UTC-7, vinoth job wrote:
>
> venv
>  /bin
>  /build
>   /django
>  /include
>  /lib
>  /local 
>
>
> here i installed django-1.4.5. and there is no error output coming when i 
> run this command .
> pip freeze|grep -i django
>
>
> On Sun, Jul 28, 2013 at 5:42 AM, René Fleschenberg 
> 
> > wrote:
>
>> Hi,
>>
>> vinoth job:
>> >  python manage.py syncdb
>> >
>> > Traceback (most recent call last):
>> >   File "manage.py", line 8, in 
>> > from django.core.management import execute_from_command_line
>> > ImportError: No module named django.core.management
>>
>> This error can also occur if the virtualenv is not actviated. Did you run
>> ``source bin/activate`` (or the appropriate ``workon`` command, in case 
>> you're
>> using virtualenv-wrapper)? Does your shell prompt show the name of the
>> virtualenv?
>>
>> If the virtualenv is activated: is Django really installed in the 
>> virtualenv?
>> What's the output of ``pip freeze|grep -i django`` (with the virtualenv 
>> being
>> active)?
>>
>>
>> --
>> René Fleschenberg
>>
>> Am Stadtgarten 28, 45276 Essen, Germany
>> Phone: +49 1577 170 7363
>> E-Mail: re...@fleschenberg.net 
>>
>> --
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
How did you install it? That's not the normal place for the installation, 
it should be in lib/pythonxx/site-packages.

While in the virtualenv, you should be able to just type pip install Django, 
and it will install in the correct place.

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




Re: django-registration ImportError

2013-07-21 Thread donarb


On Saturday, July 20, 2013 9:23:37 PM UTC-7, Mike wrote:
>
> I just updated django-registration to 1.0 (from 0.8) and now I get an 
> ImportError:
>
> ImportError: cannot import name activate
>
>
> /Users/mike/sieve-django/SIEVEENV/lib/python2.7/site-packages/registration_email/backends/default/urls.py
>  in 
>
>1. 
>
>from registration.views import activate, register
>
>
>
> Has anyone else had this problem? For now I'll revert to 0.8.
>


The package has been rewritten to use class based views. The activate 
method (as well as the register method) no longer exists by itself, it's a 
method in the ActivationView class.

Check the documentation for information on how to upgrade:

https://django-registration.readthedocs.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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Design for storing likes/dislikes?

2013-07-16 Thread donarb
On Tuesday, July 16, 2013 5:29:47 PM UTC-7, Victor Hooi wrote:
>
> Hi,
>
> We have a list of users, who are going to like/dislike various widgets.
>
> My question is regarding how to store the like/dislikes.
>
> Essentially, there can be three states between a user and a widget - like, 
> dislike, and unrated, so it's not just a straight Boolean.
>
> I'm thinking of just doing a M2M between user and widgets models, and then 
> storing an extra field on that M2M.
>
> I can either store a Boolean, for whether the item is liked/unliked - and 
> then an unrated item simply won't be exist in the table.
>
> Or I can store a integer (with a choice tupled defined), with say 
> 0=unrated, 1=like, 2 = unlike, and all possible combinations are listed.
>
> We'll be doing queries to compare users, and see if their likes/dislikes 
> intersect.
>
> Are there any pros/cons of the two approaches for this given query, or is 
> there perhaps a more efficient way of storing this data?
>
> Cheers,
> Victor
>



Django has a NullBooleanField that allows 3 states, Unknown (null), True, 
False.

 

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




Re: where the syntax error?

2013-01-14 Thread donarb


On Monday, January 14, 2013 12:39:08 PM UTC-8, Érico Oliveira wrote:
>
> class Imovel(models.Model): 
> disponivel = models.BooleanField(choices=DISPO) 
> data_venda =  models.DateTimeField(auto_now_add=True, blank=True) 
>
> def validaData(self): 
> if self.data_venda < datetime.now - timedelta(days=2) <- 
>


The syntax error refers to the missing colon at the end of the condition.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/MIvxYM9aKxYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Correct way to specifiy database-level column defaults

2013-01-10 Thread donarb
auto_now and auto_now_add don't work at the database level for raw SQL inserts 
or updates.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/noYf3kz3qMYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Correct way to specifiy database-level column defaults

2013-01-10 Thread donarb
On Thursday, January 10, 2013 6:04:47 AM UTC-8, 
john.w...@tpiengineering.com wrote:
>
> What is the best way to specify a database level default value with 
> Django?  If I want a timestamp column to default to the SQL function now(), 
> is there an accepted way to make it happen?  Or to default a boolean column 
> to True?  I notice that when I call *manage.py sqlall* I don't see any *
> DEFAULT* values specified in the generated queries for Postgres.
>


If you need default values defined at the database level, you'll have to 
define them yourself. You'll still have to define the default values in the 
model so that the ORM will enforce the default. You may be able to use the 
inspectdb command to generate the model.py file for you to tweak, not sure 
if it generates the default parameter for model fields based on the 
database columns.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/-wDtqdnKd4oJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to add an element of derived data to a Django model?

2013-01-05 Thread donarb


On Saturday, January 5, 2013 8:48:00 AM UTC-8, Saqib Ali wrote:
>
>
> I have a Django Model as follows:
> 
>
> class myModel(models.Model):
>
> a = models.IntegerField()
>
> b = models.IntegerField()
>
>
> I want to add a models.BooleanField() named c to the myModel class. 
> However the value of c is simply derived from a and b so I don't want it to 
> be stored in the Database. 
> I want to c to be True if a > b, otherwise False. I want c to reflect the 
> correct/current value even when a and b get modifed. And I want to be able 
> to access c using myModel.c just like I can access a and b.
>
> Is there any way to do this?
>

Use a property inside your class

@property
def c(self):
return self.a > self.b

Now you can access c as myModel.c anytime.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/IITPrYviRhUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

2012-12-30 Thread donarb
At this point, I would just skip trying to load the data through Django and 
write a quick Python script to load the data using INSERT statements or create 
a bulk data file to load it directly into MySQL. I'm not as familiar with MySQL 
as I am with Postgres, but Postgres can swallow a whole data file and rollback 
the transaction should it find invalid data in a row. I'm guessing MySQL can do 
something similar.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/B4RwpUtco8wJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

2012-12-30 Thread donarb


On Sunday, December 30, 2012 11:58:46 AM UTC-8, Sam Raker wrote:
>
> So I upped the verbosity like you said, and basically all it got me was a 
> bunch of text telling me all the places Django didn't find my fixture 
> before it finally did, and then the same error. Here's the full text of the 
> error:
>
> Traceback (most recent call last):
>   File 
> "/home/menusadmin/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/django/core/management/commands/loaddata.py",
>  
> line 190, in handle
> for obj in objects:
>   File 
> "/home/menusadmin/.pythonbrew/pythons/Python-2.7.3/lib/python2.7/site-packages/django/core/serializers/pyyaml.py",
>  
> line 62, in Deserializer
> raise DeserializationError(e)
> DeserializationError: maximum recursion depth exceeded while calling a 
> Python object
>
> I tried changing commit to False in loaddata.py, I tried adding a manager 
> class to the one model I have that another model refers to with a natural 
> key (e.g., 'name,' a CharField, as opposed to the primary key). I read 
> something about loaddata having some unicode-related problems, so I added 
> custom Manager classes for all my models that coerce appropriate fields to 
> strings, e.g.:
>
> class MenuManager(models.Manager):
> def create_Menu(self,restaurant,year,location,status,pk,period,language):
> menu = 
> self.create(restaurant=str(restaurant),year=int(year),location=str(location),status=str(status),pk=int(pk),period=str(period),language=str(language))
>  return menu
>
> I'm still getting the exact same error. Help?
>
 
Then the next thing I'd do is to test the yml data itself, separate from 
Django to make sure that the data is not corrupted in any way. Run a script 
like this, if it passes, then you probably have some sort of error in your 
models that is recursive.

*#!/usr/bin/env python*
*
*
*import yaml*
*
*
*stream = open("test.yml", "r")*
*print yaml.load(stream)*


Finally, I'd run

*./manage.py validate*


to make sure that all of your models are valid.

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WoMoRX8i3DsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

2012-12-30 Thread donarb
On Sunday, December 30, 2012 9:54:45 AM UTC-8, Sam Raker wrote:
>
> Thanks for your suggestions.
>
> I eliminated the underscores and got rid of the __unicode__ methods 
> entirely, cleaned up my except statement, and changed the order of stuff 
> such that all of each model's fields are defined before any methods. (As 
> for the pk field: The csvs I'm using are actually dumps from another 
> database, so everything has its own primary key already, and I realized 
> it's way easier to just leave them alone rather than waste the processing 
> time and memory reconnecting everything via Python.) 
>
> I'm still having the same problem. I don't think it's related to the 
> length of the files or something in simplejson, as even a dozen-line yaml 
> file gives me the same exception when I try to load it with loaddata. 
>
> Any more ideas?
>

 
Next, I would post the stack trace, there's probably something in there 
that points to the problem, if the yaml parser thinks there is recursion in 
the data. And up the verbosity when running the loaddata command:

--verbosity 3

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/pq_mI5E031EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Getting Access to Object in Admin Panel

2012-12-29 Thread donarb
You can code a string that references the __unicode__ method:

  list_display = ('__unicode__', ...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/t0v9rTmcTeUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

2012-12-29 Thread donarb
And your __unicode__ method is incorrect as well. You should be returning 
self.restaurant.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bsJoTGDbveYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: loaddata deserializationerror: maximum recursion depth exceeded while calling a Python object

2012-12-29 Thread donarb
Not sure if it's related to your problem, but you should never create function 
names like __period__. Names such as those are reserved for Python internals.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BeMmAD5_nfgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: debugging issues with settings.py and database (postgres) and syncdb

2012-12-27 Thread donarb
On Thursday, December 27, 2012 8:51:11 AM UTC-8, Dan Richards wrote:
>
> Yeah, psycopg2 is definitely installed...
>

I noticed that you are using djcelery (which I know nothing about), but 
have you tried getting everything working without it first? There's a line 
in your settings that says

DATABASES['default'] = dj_database_url.config()

Could this be trashing the database setting somehow?
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/LIPEOOXN1YUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: debugging issues with settings.py and database (postgres) and syncdb

2012-12-27 Thread donarb


On Thursday, December 27, 2012 8:51:11 AM UTC-8, Dan Richards wrote:
>
> Yeah, psycopg2 is definitely installed...
>
> On Thursday, December 27, 2012 9:03:31 AM UTC-5, ke1g wrote:
>>
>>
>>
>> On Thu, Dec 27, 2012 at 8:26 AM, Dan Richards  wrote:
>>
>>> Hmmm...well that isn't working either - same error.  My method for 
>>> verifying it's picking up the right settings.py is by putting a syntax 
>>> error in the settings.py it should be using and seeing that it generates an 
>>> error.  This is the settings.py file in the directory below my app 
>>> directory and that includes url.py and wsgi.py...
>>>
>>> On Wednesday, December 26, 2012 4:25:11 PM UTC-5, Ryan Blunden wrote:

 Ok. I would try setting the ENGINE value to *sqlite3* and try running 
 *syncdb 
 *again. If that works (which it should), then we can presume it's a 
 configuration access problem with the DB. 


 On 26 December 2012 13:18, Dan Richards  wrote:

> NO, just me messing around that it made no difference.  I have the db 
> access to all and trust and the error doesn't change no matter what I use 
> there.  It feels like it could be a permissions problem, but I don't know 
> how to track it down other than to verify I can access postgres via psql 
> which I can do...
>
>
> On Wednesday, December 26, 2012 12:40:28 PM UTC-5, Dan Richards wrote:
>>
>> First off, I am a newbie to django, python and postgres - so I 
>> suspect I am missing something obvious, but I am stumped.  Any ideas 
>> will 
>> be gratefully accepted...
>>
>> I get the popular "Improperly configured settings.DATABASES" error 
>> message when I run syncdb on my test app.  I am running:
>>
>> django 1.4.3
>> postgres 9.2
>> MAC OS 10.6.8
>>
>> I have verified that it is picking up the right settings.py file (the 
>> one in the app subdirectory) so I assume there is either something wrong 
>> with the settings I have entered or something wrong with postgres.  How 
>> does one debug this??
>>
>> I can connect to my database via psql, but nothing I have tried seems 
>> to work and there seems to be very little I can do to actually debug 
>> what 
>> the problem is...when the syncdb doesn't work, how do you debug to 
>> figure 
>> out what exactly isn't working???
>>
>> My settings.py file:
>>
>> # Django settings for hellodjango project.
>>
>> DEBUG = True
>> TEMPLATE_DEBUG = DEBUG
>>
>> ADMINS = (
>> ('Joe Smith', 'jsm...@foobar.com'),
>> )
>>
>> MANAGERS = ADMINS
>>
>> DATABASES = {
>> 'default': {
>> 'ENGINE': 'django.db.backends.**postgresql**_psycopg2', # 
>> Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
>> 'NAME': 'test_db1',  # Or path to 
>> database file if using sqlite3.
>> 'USER': '',  # Not used with sqlite3.
>> 'PASSWORD': '',  # Not used with sqlite3.
>> 'HOST': '',  # Set to empty string for 
>> localhost. Not used with sqlite3.
>> 'PORT': '',  # Set to empty string for 
>> default. Not used with sqlite3.
>> }
>> }
>>
>> # Local time zone for this installation. Choices can be found here:
>> # 
>> http://en.wikipedia.org/wiki/**L**ist_of_tz_zones_by_name
>> # although not all choices may be available on all operating systems.
>> # In a Windows environment this must be set to your system time zone.
>> TIME_ZONE = 'America/New_York'
>>
>> # Language code for this installation. All choices can be found here:
>> # 
>> http://www.i18nguy.com/**unicode**/language-identifiers.**html
>> LANGUAGE_CODE = 'en-us'
>>
>> SITE_ID = 1
>>
>> # If you set this to False, Django will make some optimizations so as 
>> not
>> # to load the internationalization machinery.
>> USE_I18N = True
>>
>> # If you set this to False, Django will not format dates, numbers and
>> # calendars according to the current locale.
>> USE_L10N = True
>>
>> # If you set this to False, Django will not use timezone-aware 
>> datetimes.
>> USE_TZ = True
>>
>> # Absolute filesystem path to the directory that will hold 
>> user-uploaded files.
>> # Example: 
>> "/home/media/media.lawrence.**co**m/media/
>> "
>> MEDIA_ROOT = ''
>>
>> # URL that handles the media served from MEDIA_ROOT. Make sure to use 
>> a
>> # trailing slash.
>> # Examples: 
>> "http://media.lawrence.com/**med**ia/",
>>  
>> "http://example.com/media/";
>> M

Re: Minimilisticaly: Deploying Django using Nginx on Ubuntu 12.10

2012-12-27 Thread donarb


On Wednesday, December 26, 2012 11:26:12 PM UTC-8, djangobie wrote:
>
> Hi all, 
> I am trying to deploy my Django project using Nginx, tried various 
> tutorials. All of them are filled bunch of dependencies and requirements. 
> Here I am looking forward to a simple (in sure way minimilistic), procedure 
> to do so i.e. deploying my Django project (*mysite1*) and (*mysite2*) 
> with apps (*myapp1*) and (*myapp2*).
>
> P.S, I am not looking for some solution stating use of 'virtualenv' or in 
> combination with other servers i.e. 'Apache' or 'Gunicorn' etc.
> It would be top, if you can explain the settings + config using (*mysite1*) 
> with (*myapp1*). 
>
> Thanks
>


You could try this tutorial https://gist.github.com/3094281.

But you're going to have to run some sort of extra server, be it Apache, 
Gunicorn, or uWSGI. Nginx does not run any apps, that is why it is so fast, 
it takes requests and either returns file system objects or routes requests 
to other processes. The tutorial above uses Nginx and uWSGI to handle the 
Django app. It starts out showing you how to use it with virtualenv, then 
shows how to run the app without virtualenv.

If you're running more than one app on a site, you might want to learn how 
to use virtualenv. This can save lots of time and headaches in the future 
when you decide you want to upgrade one of your apps to a newer version of 
python or some other module. Otherwise, upgrading anything on the system 
globally will break all your apps that depend on a specific version of 
software. And virtualenv is not that mysterious, all it really does is put 
all of your application's dependencies into a directory and modify any 
system paths and environment variables to point to that directory. It makes 
it easy to test and deploy your application to any server.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/pWbR-roeDRgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django comments customization issue

2012-12-26 Thread donarb
On Wednesday, December 26, 2012 11:43:47 AM UTC-8, sri wrote:
>
> Hi, I am trying to learn django comments customization by adding an 
> integer field to the comments framework. My Model looks like below
>
> class CommentWithRating(Comment): rating = 
> models.IntegerField(name='rating')
>
> And i am trying to display the value in the rating field by using the 
> jquery star, but it is displaying all the stars in one comment. Please 
> check the link to see how the comments are displayed. 
> http://imgur.com/43CUU  [1]
>
> The code i am using in my template is as below.
>
> 
> {% load comments %}
> 
>  Add Your Comments Here / Rate : 
> {% render_comment_form for party_details %}
> {% get_comment_count for party_details as comment_count %}
>   Customer Reviews( {{ comment_count }} comments have 
> been posted.)
> 
> {% get_comment_list for party_details as comment_list %}
> {% for comment in comment_list %}
> 
> Posted by: {{ comment.user_name }} on {{ 
> comment.submit_date }}  Rating:  
>   
> 
> {% for i in loop_times %}
> {% if i == comment.rating %}
>  class="star" checked="checked" disabled="disabled"/>
> {% else %}
>  class="star" disabled="disabled"/>
> {% endif %}
> {% endfor %}
> {{ comment.rating }}
> 
> 
> Comment: {{ comment.comment }}
> 
> {% endfor %}
> 
>
> I am working on Django 1.4.1 version and 
> http://www.fyneworks.com/jquery/star-rating/#tab-Overview[2] (for jquery 
> stars). loop_times in the template is a range from 1 to 5, which is passed 
> from the view.
>
> Can anyone help with why the ratings are all displayed in one place when i 
> use jquery star.
>
> Thanks in advance.
>


It's most likely because your input items all have the same name 'star'. 
You should use an index in the loop to make the names unique for each of 
the comments. Something like:

{% if i == comment.rating %}

{% else %}

{% endif %}

Note you have to use parentloop because your loop is nested.

Also as an FYI, your 'br' tags are coded wrong, they should be ''.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kARdtyTU33EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: ImportError at/ No module name

2012-12-25 Thread donarb
On Tuesday, December 25, 2012 4:29:22 AM UTC-8, djangobie wrote:
>
> I appreciate your response.
> The __init__.py is there in the app folder (yes, I created the app via 
> manage.py).
> It ran perfectly on initial attempts, but with new code added, I got 
> stuck. My so far conclusion (though, not helping at all) is may be I have 
> set some kind 'circular loop' here, while loading (importing) modules, 
> that's why I have pasted all the code from almost all the files.
>
> In your urls.py, remove the 'djangopractice' from the view paths. Most 
likely, the tutorial was written using 1.3. so for the first path, it 
should be:

url(r'^$', 'blog.views.index'),


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/bW_4NPBNTJ8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Change label/title from an application added to django admin

2012-12-23 Thread donarb


On Sunday, December 23, 2012 6:02:45 PM UTC-8, Ankush Chadda wrote:
>
> Hi,
> Look at the Meta options verbose_name and verbose_name_plural
>
> Using these you can change the display name in admin.
>
>

Those are for the displaying the model names, not the app name.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/PtzRhZ7Me50J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django community, is it active?

2012-12-18 Thread donarb


On Tuesday, December 18, 2012 1:36:42 PM UTC-8, sparky wrote:
>
>
> ... I'm also finding it hard to find any user groups locally in the UK 
> (I'm based in Manchester, UK).
>
>  
Sometimes Django does not have enough of a user base in an area for its own 
group, you might want to check out the local Python group, some Djangonauts 
may be attending. 

Here's the page for the Manchester Python group, which just happens to be 
meeting this Thursday:

http://madlab.org.uk/content/north-west-python-user-group-27/
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2B2NiNnwWD0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: deprecation of DotExpandedDict announced?

2012-12-17 Thread donarb
On Monday, December 17, 2012 7:37:59 AM UTC-8, roman wrote:
>
> Hello everyone,
>
> just trying 1.5 beta ...
>
> django.utils.datastructures.DotExpandedDict seems to be no longer there. 
> Can't find where this has been announced.
> Did I miss something?
>
> Regards
>  Roman
>


https://github.com/django/django/commit/c57abd3c29cedcca00821d2a0d5708f10977f3c6
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/WNNknLvDN_EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Templates not found

2012-12-12 Thread donarb
When you used the shell, you imported 'tracks.views' but in your urls.py, 
you have musicsite.views.home. The two don't match.

On Wednesday, December 12, 2012 6:11:54 AM UTC-8, Lloyd Dube wrote:
>
> urls.py:
>
> urlpatterns = patterns('',
> # Examples:
> url(r'^$', 'musicsite.views.home', name='home'),
> # url(r'^musicsite/', include('musicsite.foo.urls')),
>
> # Uncomment the admin/doc line below to enable admin documentation:
> # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
> # Uncomment the next line to enable the admin:
> url(r'^admin/', include(admin.site.urls)),
> )
>
> I even considered indentation problems, but I have checked that and it is 
> fine.
>
>
> On Tue, Dec 11, 2012 at 5:53 PM, Sergiy Khohlov 
> 
> > wrote:
>
>> please paste your urls.py
>>
>>
>> 2012/12/11 Sithembewena Lloyd Dube >:
>> > Hi Segiy,
>> >
>> > Thanks for the response. "myproject" is only an alias I used while 
>> posting
>> > the code on here, in the project code it is actually "tracks".
>> >
>> >
>> > On Tue, Dec 11, 2012 at 1:31 PM, Sergiy Khohlov 
>> > > 
>> wrote:
>> >>
>> >> take a look  you have error related to myproject.view.home   but
>> >> importing track.view.home 
>> >>
>> >> 2012/12/11 Sithembewena Lloyd Dube >:
>> >> >
>> >> >
>> >> > On Tue, Dec 11, 2012 at 4:36 AM, Sithembewena Lloyd Dube
>> >> > >
>> >> > wrote:
>> >> >>
>> >> >> Hi all,
>> >> >>
>> >> >> I have a Django project running Django 1.4.1. (just upgraded). My
>> >> >> TEMPLATE_DIRS entry is:
>> >> >>
>> >> >> '/home/mymachine/Code/myproject/templates',
>> >> >>
>> >> >>
>> >> >> and that is exactly where the index template of the new project is 
>> even
>> >> >> when i use Firefox to locate it.
>> >> >>
>> >> >> In my home view, I call render_to_response as follows:
>> >> >>
>> >> >> 'def home(request):
>> >> >> return render_to_response('myapp/index.html', {})',
>> >> >>
>> >> >>
>> >> >> This raises an exception of type ViewDoesNotExist. If I run python
>> >> >> manage.py shell, import the view and call it with None as an 
>> argument
>> >> >> for
>> >> >> request, it shows that a response object is returned. Yet, the 
>> browser
>> >> >> will
>> >> >> not render it.
>> >> >>
>> >> >> >>> from tracks.views import home as h
>> >> >> >>> h(None)
>> >> >> 
>> >> >> >>> dir(h(None))
>> >> >> ['__class__', '__contains__', '__delattr__', '__delitem__', 
>> '__dict__',
>> >> >> '__doc__', '__format__', '__getattribute__', '__getitem__',
>> >> >> '__getstate__',
>> >> >> '__hash__', '__init__', '__iter__', '__module__', '__new__',
>> >> >> '__reduce__',
>> >> >> '__reduce_ex__', '__repr__', '__setattr__', '__setitem__',
>> >> >> '__setstate__',
>> >> >> '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
>> >> >> '_base_content_is_iter', '_charset', '_container', 
>> '_convert_to_ascii',
>> >> >> '_get_content', '_headers', '_set_content', 'close', 'content',
>> >> >> 'cookies',
>> >> >> 'delete_cookie', 'flush', 'get', 'has_header', 'items', 'next',
>> >> >> 'set_cookie', 'set_signed_cookie', 'status_code', 'tell', 'write']
>> >> >>
>> >> >> Am I missing something?
>> >> >>
>> >> >> Thanks.
>> >> >>
>> >> >> --
>> >> >> Regards,
>> >> >> Sithu Lloyd Dube
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Regards,
>> >> > Sithu Lloyd Dube
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "Django users" group.
>> >> > To post to this group, send email to 
>> >> > django...@googlegroups.com
>> .
>> >> > To unsubscribe from this group, send email to
>> >> > django-users...@googlegroups.com .
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/django-users?hl=en.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google 
>> Groups
>> >> "Django users" group.
>> >> To post to this group, send email to 
>> >> django...@googlegroups.com
>> .
>> >> To unsubscribe from this group, send email to
>> >> django-users...@googlegroups.com .
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/django-users?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> > Regards,
>> > Sithu Lloyd Dube
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to 
>> > django...@googlegroups.com
>> .
>> > To unsubscribe from this group, send email to
>> > django-users...@googlegroups.com .
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com .
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> -- 
> Regards,

Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread donarb
Correction, the syntax has changed between 1.4 and 1.5. You are now 
required to quote the name in the url tag.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ijeFeRNw0aMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Template syntax error: Could not parse the remainder: '-login' from 'accounts-login'

2012-12-03 Thread donarb
Except, the Django documentation states that url names with dashes are 
acceptable and the examples show url tags using unquoted names. It even 
says you can use any character you want:

*The string used for the URL name can contain any characters you like. You 
are not restricted to valid Python names.*

https://docs.djangoproject.com/en/1.4/topics/http/urls/#id2

On Monday, December 3, 2012 4:54:19 AM UTC-8, Loai Ghoraba wrote:
>
> okay I found it:
>
> it should be  login 
> with quotes. Thanks.
>
> On Mon, Dec 3, 2012 at 2:50 PM, Loai Ghoraba 
> > wrote:
>
>> not working, giving: Reverse for '' with arguments '()' and keyword 
>> arguments '{}' not found.
>>
>> also I want to know about this dash (sorry for using the term score in 
>> the previous post ) thing
>>
>> On Mon, Dec 3, 2012 at 2:34 PM, Nikhil Verma 
>> 
>> > wrote:
>>
>>> {% url auth_login %}
>>
>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/2FM_hakKP1QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to get the source code of an url?

2012-11-27 Thread donarb
You're not parsing XML, it's HTML and it's not well formed, for example 
your title and author tags have closing tags that don't match. Your HTML 
needs to be valid XHTML before trying to use an XML parser on it. You might 
want to try something else to parse this, like Scrapy or Beautiful Soup.

On Tuesday, November 27, 2012 3:32:16 AM UTC-8, wbc wrote:
>
> I'm trying to parse an xml url with minidom. I have an url with my xml 
> data.
>
> This is my code:
>
> url = "http://myurl.com/wsname.asp";
> datasource = urllib2.urlopen(url)
>
> dom = parse(datasource)
> handleElements(dom)
>
> my handleElements function to parse xml:
>
> def handleElements(dom):
> Elements = dom.getElementsByTagName("book")
> for item in Elements:
> getText(item.getElementsByTagName("id")[0].childNodes)
> 
>
> My xml:
>
> 
>  
>  747
>  L'alchimiste
>  Paulo Cohelo 
>   
>  ...
>
> 
>
> I get no error, but no result!
>
> my handleElements() works fine because when I copy the same data from my 
> url put it in a string and use parseString instead of parse everything 
> works fine and I get my results.
>
> But when trying to openurl, Elements is empty and the loop is not even 
> started
>
> *
> *
>
> Seems that I need to get the sourcecode of the url (not it's content) 
> (like the view-source in chrome) How can I do that?
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/aYygL7amauAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: http://lightbird.net/dbe/ ... django by example help

2012-11-18 Thread donarb
When you look at the web page, the code in the "Enhancing Admin" section is 
code that should be added to the code in the first listing. So the import 
statements that you need are already there.



On Sunday, November 18, 2012 7:05:54 AM UTC-8, boxcarlo wrote:
>
> Hi,
> I'm not very expert on python and django, I'm investigating now these 
> incredible 
> tools.
> I found online http://lightbird.net/dbe/ - "Django by example", an 
> excellent tutorial to experiment with simple apps.
> I'm trying to work on the example n. 3 "Photo Organizer and Sharing App", 
> but when I try to enter the code in the first step of the tutorial 
> "Enhancing admin" http://lightbird.net/dbe/photo.html#enhancing-admin, my 
> ide editor "Aptana" identifies some errors:
> - Class Image (models.Model): (Error message: Undefined variable: models
> - Class ImageAdmin (admin.ModelAdmin): Undefined variable: admin
>
> I'm completely blocked. Is there anyone who can help me?
>
> thanks
>
> Carlo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/4lE7WW19R0gJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: pub_date timezone

2012-10-26 Thread donarb
You misspelled 'pub_date' as 'put_date' in your model definition.

On Thursday, October 25, 2012 9:30:57 AM UTC-7, BrendanC wrote:
>
> Hi erm
>  
> Went back over your comment and realised what you commented. 
> After python manage.py I gget the python prompt>>> and then typed
> from polls.models import Poll, Choice
>  
> then I typed: Poll.objects.all() and got the array brace [] returned.
> then I typed from django.utils import timezone
>  
> then typed: p = Poll(question="Whats new?", pub_date=timezone.now())
> This line will not run and tells me pub_date is an invalid argument.
>  
> Thanks again in advance 
>  
>
> On Thursday, October 25, 2012 2:28:42 PM UTC+1, emr wrote:
>
>> Hi brendan, 
>>
>> You have the import class before using, so 
>>
>> from polls.models import Poll
>>
>> 2012/10/25 Brendan Carroll 
>>
>>> Hi all
>>> I am new to Django and I'm having an issue with some code. I am trying 
>>> to get through the first tutorial from the Django site.
>>> I have a file called polls/models.py and have created a class that 
>>> contains the following code
>>> class Poll(models.Model):
>>>  question = models.CharField(max_length=200)
>>>  pub_date = models.DateTimeField('date published')
>>>  
>>> The problem occurs when I go into the command prompt and enter the 
>>> following line
>>> p = Poll(question = "Whats new? ", pub_date=timezone.now())
>>> The error is as follows: name Poll is not defined.
>>> Appreciate any help guidance
>>>  
>>>  
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msg/django-users/-/dBbvVPL8BicJ.
>>> To post to this group, send email to django...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> django-users...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/CCyy73mxifkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: overlay feature in django

2012-03-12 Thread donarb
My guess is that he means a lightbox-like popup form, especially when
he mentions login and registrations.

Don

On Mar 12, 12:21 am, kenneth gonsalves  wrote:
> On Mon, 2012-03-12 at 00:14 -0700, Derek wrote:
> > That is not an example or definition of "overlaying"; just a laundry
> > list of templates.
>
> I would take a wild guess that he means inheritance ;-)
> --
> regards
> Kenneth Gonsalves

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



Re: Django Admin base.html error

2012-02-25 Thread donarb
Try this first. Check your urlconf and make sure that all routes lead
to actual methods. Like if you have a url that points to something
like myapp.views.index, make sure that there is actually an index
method in views.py.

This error bites everyone eventually, since people get ahead of
themselves and create urls before the associated methods. Then when
you turn on the admin app, it crashes because admin requires reverse
url resolutions. The fix is to just create empty methods or
temporarily  comment out unused urls.

On Feb 24, 3:29 am, Timothy Makobu 
wrote:
> I think I just stumbled onto a Django Admin base.html bug. Here is
> the stack-trace:
>
> http://dpaste.org/fYuEw/

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



Re: Displaying template location in html

2012-01-29 Thread donarb
Use the Django Debug Toolbar, it shows all kinds of things. For
templates, it shows the names of all the templates that make up the
given page as well as which tags are used on the page.

With DDT, you don't have to annotate (and un-annotate) anything.

http://pypi.python.org/pypi/django-debug-toolbar

On Jan 28, 10:26 pm, Alec Taylor  wrote:
> With 40+ HTML files it's easy to get confused as to where each
> component comes from.
>
> I don't want to annotate each file with its relative path manually, as
> this will prove cumbersome when the site finally goes production.
>
> Is there a trick to displaying the template location on-screen?
>
> Thanks for all suggestions,
>
> Alec Taylor

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



Re: Django superusers

2009-05-15 Thread donarb

On May 15, 7:31 am, Mike Driscoll  wrote:
> The book does not mention anything about the autodiscover() call,
> although it seems to have done everything else right. Once I added
> that, the admin pages starting working as expected.


I have the PDF version of the book and the autodiscover() call is
shown on page 156, which is the second page of chapter 8. I saw no
errata though for the printed version.

Good series, by the way.

For anyone who is interested, Packt Publishing has 3 Django books
available:

Django 1.0 Website Development
Django 1.0 Template Development
Learning Website Development with Django (covers pre 1.0)

www.PacktPub.com

The author is a Google engineer and is very knowledgeable about Django
and Python. The template book is essentially a sequel to the website
book. It explains generic views, template tags, caching, there are
even chapters on admin customization and localization.

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



Re: Trouble Starting Up with runserver

2009-05-07 Thread donarb

On May 7, 8:43 am, Phil Mocek 
wrote:
> This, unfortunately, is not explained in the
> runserver documentation [1] or the admin utility's built-in help.
> The only place I've found it documented is in chapter two of The
> Django Book [2].

It is also documented in the tutorial:

http://docs.djangoproject.com/en/dev/intro/tutorial01/#creating-a-project

Don



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



Re: Running tests - minor problem with fixtures

2007-05-29 Thread donarb

The original question was never really answered.

I am using 0.96 and cannot load any fixture unless it is named
'initial_data.json', even when I add a fixtures attribute to my
testcase (yes, it is subclassed from django.test.TestCase). My testing
works great, as long as I put all my data into initial_data.json.

Is there anything that would prevent other *.json fixtures from
loading? My testcase had no setUp() method, but just in case, I added
one and it still had no effect.

Don


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CSS Basics

2006-12-20 Thread donarb



hasan_aljudy wrote:

I'm quite new to Django and I ran into this situation yesterday .. in
the end, I went with the {% include "style.css" %} trick, which seems
to be the best solution, because it's the simplest one, and I don't see
any drawbacks to it.


That will work fine. The only drawback is that the css will always be
included in your html file. Even if your css file is small, it prevents
the user's browser from caching the information, so it will have to be
downloaded and reinterpreted every time, including when a user goes
from page to page on your site. If your website is popular, those small
files add up to thousands and thousands of extra bytes.

Don


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CSS Basics

2006-12-20 Thread donarb


cwurld wrote:

So when one says "Serve from Django" does that mean use the "view
django.views.static.serve"?

The documentation says that is not secure. Does anyone know what the
security risk is?

Thanks,
Chuck



It's insecure because of the way that dynamic servers behave versus
static servers. With a dynamic server such as Django, you can abstract
the url away from the location of the script that creates the content.
Static servers are usually designed where the URL maps to part of the
file system. You asked earlier why static files (such as css and image
files) should not be stored alongside the scripts. This is because a
clever hacker could guess where you have stored your scripts and trick
the static server into returning them (such as a hacker asking for
/static/css/../../../settings.py, whoops he just got your database
username and password!).

There are ways to prevent this using file permissions and Apache
settings, but out of the box, Django cannot know how your particular
server is set up, so the best they can do is to provide warnings that
this is not a good idea.

As I said before, this is not specifically a Django thing, but this
sort of information can be found online or in any book on Apache/web
server security.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---