Re: Error running Django tutorial

2016-03-19 Thread Ruth
I am getting the very same problem, despite adding include to my 
mysite\urls.py file.
I am using Python 2.7.6, Django 1.9.4 and Ubuntu 14.04.3 LTS
Could it be a python 2.7 problem?
Thanks,
Ruth

On Saturday, February 27, 2016 at 11:50:39 AM UTC-8, Mike Kipling wrote:
>
> I am working through the Django tutorial *Writing your first Django app, 
> part 1.*
> I am using Windows 10, python 3.5.1 and Django 1.9.2 .
>  
> In the *Write your first view* section:  
> after writing the polls/views.py and polls/urls.py files, 
> and modifying the manage/urls.py file, 
> and starting the server,
>  
> When I go to http://localhost:8000/polls/ in the browser I get the 
> following error:
>
> Page not found (404) 
> Request Method: GET 
> Request URL: http://localhost:8000/polls/
>
> Using the URLconf defined in mysite.urls, Django tried these URL 
> patterns, in this order:
>
>1. ^admin/
>
> The current URL, polls/, didn't match any of these.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/68e5fd69-2581-4f56-b413-36bdf57aad2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error running Django tutorial

2016-03-19 Thread Bruno Barbosa
Ruth,

Show me the code!

How is your urls.py? and the views.py?

paste your code in https://gist.github.com/ and reply this email.

--
Bruno Barbosa
Web Developer
*brunobarbosa.com.br *

On Thu, Mar 17, 2016 at 3:50 PM, Ruth 
wrote:

> Hi,
> I am getting the same problem, despite having include in my mysite\urls.py
> file.
> I am using Python 2.7.6, Django 1.9.4 and Ubuntu 14.04.3 LTS.
> Could it by a Python 2.7 problem?
> Thanks,
> Ruth
>
> On Wednesday, March 2, 2016 at 12:19:16 PM UTC-8, jorr...@gmail.com wrote:
>>
>> Glad you got it solved!!
>>
>>
>> On Monday, February 29, 2016 at 10:10:58 PM UTC+1, Mike Kipling wrote:
>>>
>>> I found the problem.
>>>
>>> When the mysite\urls.py file is created, it has this line already in it.
>>>
>>> from django.conf.urls import url
>>>
>>> The tutorial asks you to add the following lines to the file.
>>>
>>> from django.conf.urls import include, url
>>> from django.contrib import admin
>>>
>>> urlpatterns = [
>>> url(r'^polls/', include('polls.urls')),
>>> url(r'^admin/', admin.site.urls),
>>> ]
>>>
>>> I must did not notice that the 'include' was different, and so I had
>>> not placed it into the file.  I changed the file to add the 'include' and
>>> everything worked.
>>>
>>> Thank you for the help.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/c14e04f8-be34-4569-ae42-48e8d4135a2c%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Django ImportError: No module named admin

2016-03-19 Thread addison . slabaugh


As a result of attempting to update admin.py of one of my Django apps, I 
now get a Server Error (500) that has brought my site down. When I import 
admin from django.contrib, I get the following traceback:


Traceback (most recent call last): File 
"/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 
74, in autodiscover_modules import_module('%s.%s' % (app_config.name, 
module_to_search)) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
import_module __import__(name) ImportError: No module named admin

Using print_stack() gives me a little deeper insight:


File "/home/ubuntu/gather/src/foodshop/wsgi.py", line 21, in  
application = get_wsgi_application() File 
"/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 14, in 
get_wsgi_application django.setup() File 
"/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup 
apps.populate(settings.INSTALLED_APPS) File 
"/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in 
populate app_config.ready() File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, 
in ready self.module.autodiscover() File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 
24, in autodiscover autodiscover_modules('admin', register_to=site) File 
"/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 
74, in autodiscover_modules import_module('%s.%s' % (app_config.name, 
module_to_search)) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
import_module __import__(name) File "/home/ubuntu/gather/src/recipes/admin.py", 
line 6, in  class RecipesAdmin(admin.ModelAdmin): File 
"/home/ubuntu/gather/src/recipes/admin.py", line 9, in RecipesAdmin 
traceback.print_stack()

I use this module in several other apps within my project, so I don't 
understand why it's not working for this particular app. You can see my 
very simple Python code below, which is for an admin.


*admin.py*
from django.contrib import admin
from .models import Recipes

class RecipesAdmin(admin.ModelAdmin):
 list_display = ["__unicode__", "title", "rating", "date_modified"]
 prepopulated_fields = {"slug": ("SKU",)}
 class Meta:
 model = Recipes

admin.site.register(Recipes, RecipesAdmin)



*urls.py*

from django.conf import settings from django.conf.urls import include, url from 
django.conf.urls.static import static from django.contrib import admin from 
django.conf.urls import patterns, url, include from djangoratings.views import 
AddRatingFromModel urlpatterns = [ url(r'^$', 'customers.views.home', 
name='home'), url(r'^home/', 'customers.views.home', name='home'), 
url(r'^about/', 'recipes.views.about', name='about'), url(r'^menu/', 
'recipes.views.menu', name='menu'), url(r'^donate/', 'recipes.views.menu', 
name='menu'), # url(r'^contact/', 'recipes.views.contact', name='contact'), 
url(r'^admin/', include(admin.site.urls)), url(r'^about/healthy/', 
'recipes.views.healthy', name='healthy'), url(r'^about/premade/', 
'recipes.views.premade', name='premade'), url(r'^about/exceptional/', 
'recipes.views.exceptional', name='exceptional'), url(r'^accounts/', 
include('registration.backends.default.urls')), url(r'^cart/', 
'cart.views.get_cart', name='get_cart'), url(r'^add/', 'recipes.views.menu', 
name='menu'), # url(r'^add/(?P[-\w]+)/id=(?P[-\w]+)/$', 
'cart.views.add_to_cart', name='shopping-cart-add'), 
url(r'^update/(?P[-\w]+)/$', 'cart.views.specific_qty', 
name='shopping-cart-specify'), url(r'^remove/(?P[-\w]+)/$', 
'cart.views.remove_from_cart', name='shopping-cart-remove'), 
url(r'^subtract/(?P[-\w]+)/$', 'cart.views.subtract_from_cart', 
name='shopping-cart-subtract'), url(r'^clear_cart/', 'cart.views.clear_cart', 
name='shopping-cart-clear'), 
url(r'^contact/$','contact.views.email',name='email'), 
url(r'^feedback/$','contact.views.feedback',name='feedback'), url(r'^thanks/$', 
'contact.views.thanks',name='thanks'), url(r'^profile/$', 'cart.views.profile', 
name='profile'), url(r'^profile/new/$', 'cart.views.new_profile', 
name='new_profile'), url(r'^profile/error/$', 'cart.views.qty_error', 
name='qty_error'), url(r'^profile/cancel/$', 'cart.views.cancel_sub', 
name='cancel_sub'), url(r'^profile/feedback/$', 'recipes.views.feedback', 
name='feedback'), url(r'^rate/(?P\d+)/(?P\d+)/', 
AddRatingFromModel(), { 'app_label': 'recipes', 'model': 'recipes', 
'field_name': 'rating', }), url(r'^charge/$', 'cart.views.charge', 
name='charge'), url(r'^subscription/charge/$', 'cart.views.pay', name='pay'), 
url(r'^frequently_asked/$', 'cart.views.frequently_asked', 
name='frequently_asked'), url(r'^tender/$', 'cart.views.weekly_orders', 
name='weekly_orders'), url(r'^tender_postmates/$', 
'cart.views.tender_postmates', name='tender_postmates') ] + 
static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) if 
settings.DEBUG: urlpatterns += static(settings.STATIC_URL, 
document_root=settings.STATIC_ROOT) urlpatterns += static

Re: Forms in Django

2016-03-19 Thread James Bennett
First of all, notice the suggestion was to make the change on your *form*
class, not the model -- forms are where you can specify that a particular
widget + attributes should be used on a particular field.

Though it's also possible to do things in the template itself if you know
your way around the forms API. I've used this handy little library a few
times to do just that (since it knows its way around the forms API and lets
you do quite a bit of rendering customization in the template):

https://pypi.python.org/pypi/django-widget-tweaks

On Fri, Mar 18, 2016 at 11:17 AM, Stanislav Vasko  wrote:

> Ufff, i hope there is another way. Something working so simple like
> passing data from View to Template with direct access like {{ company.name
> }} or {{ company.phone }}. I dont see the point why to modify Model and how
> it helps with styling 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f33ad8b5-af2a-417c-b572-e0b7973e2d4c%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Django Newb Help

2016-03-19 Thread parker smith
Hello,

I am working on the django by example book and in ch. 2 I am having issues 
getting the recipient email to display inside the template tag...

here is the specific line of code that isn't working and what I changed it 
to to get it some what working...

views.py code referencing cd - 

  
  cd = form.cleaned_data
  
 send_mail(subject, message,'ad...@myblog.com',[cd['to']])


code having issues - location is share.html
  
  ...
  "{{ post.title }}" was successfully sent to {{ cd.to }}.
  ...


everything is displaying fine except that the {{ cd.to }} section is just 
blank like this

  
   Post 3 was successfully sent to .


however if I replace it with {{ form.to }} I do see the recipient email 
address but it is floated to the left and is surrounded in in a grey box 
with padding... so that it displays like 

  bl...@email.com Post 3 was successfully sent to .




I hope I am being clear and am hoping to get a better answer on how to get 
it to display properly.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08b93ea3-927b-47c7-bd04-2447eadab001%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Password hasher for vBulletin?

2016-03-19 Thread jorrit787
Thanks for the help!

If anyone looks at this in the future, this is the code I ended up using:

*hashers.py*

class PBKDF2WrappedvBPasswordHasher(PBKDF2PasswordHasher):
algorithm = 'pbkdf2_vB'

def encode_vB_hash(self, vB_hash, salt, iterations=None):
return super(PBKDF2WrappedvBPasswordHasher, self).encode(vB_hash, salt, 
iterations)

def encode(self, password, salt, iterations=None):
vB_hash = hashlib.md5(hashlib.md5(force_bytes(password)).hexdigest() + 
force_bytes(salt)).hexdigest()
return self.encode_vB_hash(vB_hash, salt, iterations)


*settings.py*

PASSWORD_HASHERS = [
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'members.hashers.PBKDF2WrappedvBPasswordHasher',
]


Importing vBulletin password in the Django format, assuming 2 columns for 
vBulletin containing salt and MD5 hash, respectively:

password='pbkdf2_vB' + '$' + row[5] + '$' + row[6],


Upgrading to pbkdf2_vB hash:

hasher = PBKDF2WrappedvBPasswordHasher()
algorithm, salt, vB_hash = user.password.split('$', 2)
user.password = hasher.encode_vB_hash(vB_hash, salt)



On Wednesday, March 16, 2016 at 12:54:18 AM UTC+1, Tim Graham wrote:
>
> I can't think of anything offhand besides implementing your own 
> PBKDF2PasswordHasher subclass which does its own more sophisticated 
> splitting that doesn't get confused by dollar signs in the salt.
>
> On Tuesday, March 15, 2016 at 7:26:59 PM UTC-4, jorr...@gmail.com wrote:
>>
>> Holy crap, you guys have really thought of everything! Love it!
>>
>> Unfortunately this doesn't work on all users because some salts contain 
>> the *$* character which gives the *assert salt and '$' not in salt* 
>> error. Is there a workaround for this?
>>
>>
>> On Tuesday, March 15, 2016 at 4:59:39 PM UTC+1, Tim Graham wrote:
>>>
>>> Take a look at 
>>> https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-upgrading-without-requiring-a-login
>>>
>>> Instead of SHA1PasswordHasher().encode() you'll want to use vBulletin's 
>>> hashing algorithm.
>>>
>>> On Tuesday, March 15, 2016 at 11:54:32 AM UTC-4, jorr...@gmail.com 
>>> wrote:

 I'm converting an old vBulletin 3.8 installation to a Django web app 
 and I'm wondering if I can migrate users over with their passwords intact.

 vBulletin uses *md5(md5(password) + salt)* to hash its passwords, 
 would any of Django's built-in password hashers work with this out of the 
 box?

 Some of the salts also contain the *$* character, I'm guessing that's 
 a big problem?

 I'm wondering if it would be easiest (or even possible) to write a 
 custom password hasher for this or just have everyone reset their 
 passwords 
 once the new site goes live.

 Any thoughts on this would be appreciated!

>>>

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


Re: Forms in Django

2016-03-19 Thread Stanislav Vasko
This is exactly what i was looking for, many thanks! Now i can render form 
i need and like. Now i will test and i hope it will be same easy to write 
data back to db.

Many thanks, Stanley

Dne pátek 18. března 2016 20:50:37 UTC+1 Fred Stluka napsal(a):
>
> Stanislav,
>
> Try these:
>
> {{ form.title.value }}
> {{ form.title.label }}
> {{ form.title.errors }}
> etc.
>
> --Fred 
> --
> Fred Stluka -- mailt...@bristle.com  -- 
> http://bristle.com/~fred/ 
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
> Open Source: Without walls and fences, we need no Windows or Gates. 
> --
> On 3/18/16 2:55 PM, Stanislav Vasko wrote:
>
> This is exactly what im trying. But if i enter *{{ form.title }}* i get 
> not the data to use in form, but whole: 
>
> **
>
> But as i study doc, there is no simple way like Django is providing in 
> other part. So, maybe Fred's way is a good one (but quite strange) and 
> still dont know how i will make Fieldsets and other stuff (i need to work 
> with data and some the result). 
>
> Maybe there is some better Django Form plugin, but i prefer not to use 
> anything outside Django, because noone knows how it will work with new 
> Django versions and how buggy it can be. As beginner i'm glad for solving 
> own bugs not fighting others too :)
>
> You can also do a custom template. So instead of letting Django render the 
> form, you code the html yourself. 
>>
>>
>> This is, instead of:
>>
>> {{ form.as_p }}
>>
>> do something like:
>>
>> {% csrf_token %}
>> 
>> > placeholder="Phone" type="text">
>> > aria-hidden="true">
>> 
>> ...
>> 
>>
>> -- 
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> 
> https://groups.google.com/d/msgid/django-users/bb89aebe-5c3a-41dd-8f58-00acb8d78289%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

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


Re: Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Rafael E. Ferrero
The main Django project website has an amazing good tutorial and
documentation for start.



Rafael E. Ferrero

2016-03-18 6:54 GMT-03:00 Santosh Srinivas :

> Hi Folks,
>
> I'm new to both Python and Django.
> I am looking for high quality video tutorials on Django and Python from
> your experience (paid is also fine).
>
> Please advise.
>
> Thank you.
> Santosh
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aedc789c-f8d7-4314-b52a-ccb764c56edb%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


static advertisement implementation

2016-03-19 Thread dilkash manghani
Hi,

I want to create portal in which user can submit static advertisement html 
in django form , which can be displayed in website for n seconds before 
loading the front page of website.
This may be easy , i am not sure , in django as i am new in this.


Thanks,
DIlkash


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47450e57-24b0-43ff-8819-e18160da1d73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Newb Help

2016-03-19 Thread parker smith
Hello,

I am working on Django by Example as a newb and am having issues in ch. 2...

we are setting up a commenting system for blog posts and everything works 
except the form stays populated and there is no refresh after successfully 
posting...the page is supposed to refresh and the form be cleared...

views.py



















*...from .models import Commentfrom .forms import CommentForm#a comment was 
postedcomments =post.comments.filter(active=True)if request.method == 
"POST":   # a comment was posted   comment_form 
=CommentForm(data=request.POST)   if comment_form.is_valid():  
new_comment = comment_form.save(commit=False)  new_comment.post = post  
new_comment.save()else:   comment_form = CommentForm()...*


post_detail.html


*{% if new_comment %}   Your comment has been added.{% else %}  
 Add a new comment. {{ 
comment_form.as_p }}  {% csrf_token %} {% endif %} *

the problem is that when displaying the actual page everything works except 
that the form is still populated and can be resubmitted endlessly with the 
same data.


-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c667f3ba-4a68-45cc-b11d-72e4d3f73246%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


PGConf US 2016 - free tickets for Django community members

2016-03-19 Thread Daniele Procida
The organisers of PGConf US 2016, the biggest Postgres conference in the world, 
have offered five full conference tickets worth US$439.00 each to the Django 
community.



Daniele

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


Re: Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Bill Freeman
As far as learning python goes, especially if you already program in
another language, the tutorials at docs.python.org are quite good.  If you
are using python 2 instead of python 3, note the "Docs for other versions"
section in the top of the left hand column.  If you don't already program
in some other language, you might consider a book for python beginners.

On Fri, Mar 18, 2016 at 10:40 AM, Stanislav Vasko  wrote:

> Hello,
>
> i found very usefull general tutorial at Django site:
> https://docs.djangoproject.com/en/1.9/intro/tutorial01/
>
> But you can try DjangoGirls (dont worry, its not just for girls):
> http://tutorial.djangogirls.org
>
> Good Luck!
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e62fffa8-a35d-4e66-a392-15e35566ab87%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Django Newb Help

2016-03-19 Thread parker smith
I can modify position and look of the {{ form.to }} with {{ form.to }} tags and css but I don't 
think that's the intention...

On Wednesday, 16 March 2016 16:45:31 UTC-7, parker smith wrote:
>
> Hello,
>
> I am working on the django by example book and in ch. 2 I am having issues 
> getting the recipient email to display inside the template tag...
>
> here is the specific line of code that isn't working and what I changed it 
> to to get it some what working...
>
> views.py code referencing cd - 
>
>   
>   cd = form.cleaned_data
>   
>  send_mail(subject, message,'ad...@myblog.com',[cd['to']])
>
>
> code having issues - location is share.html
>   
>   ...
>   "{{ post.title }}" was successfully sent to {{ cd.to }}.
>   ...
>
>
> everything is displaying fine except that the {{ cd.to }} section is just 
> blank like this
>
>   
>Post 3 was successfully sent to .
>
>
> however if I replace it with {{ form.to }} I do see the recipient email 
> address but it is floated to the left and is surrounded in in a grey box 
> with padding... so that it displays like 
>
>   bl...@email.com Post 3 was successfully sent to .
>
>
>
>
> I hope I am being clear and am hoping to get a better answer on how to get 
> it to display properly.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/221ec665-043e-4c62-8763-23b5a5bbc54f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Unable to parse connection string: "" when using django cache

2016-03-19 Thread jorrit787
As an aside, it looks like you're including CommonMiddleware twice.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/80e6b310-d6ae-46d2-9268-13006125b248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Newb Help

2016-03-19 Thread parker smith
Okay I figured this one out on my own...I just added the following code...

   new_comment.save()
   comment_form = CommentForm()  - #(I added this line and it's working 
properly now)
else:
   comment_form = CommentForm()




On Wednesday, 16 March 2016 16:45:31 UTC-7, parker smith wrote:
>
> Hello,
>
> I am working on the django by example book and in ch. 2 I am having issues 
> getting the recipient email to display inside the template tag...
>
> here is the specific line of code that isn't working and what I changed it 
> to to get it some what working...
>
> views.py code referencing cd - 
>
>   
>   cd = form.cleaned_data
>   
>  send_mail(subject, message,'ad...@myblog.com',[cd['to']])
>
>
> code having issues - location is share.html
>   
>   ...
>   "{{ post.title }}" was successfully sent to {{ cd.to }}.
>   ...
>
>
> everything is displaying fine except that the {{ cd.to }} section is just 
> blank like this
>
>   
>Post 3 was successfully sent to .
>
>
> however if I replace it with {{ form.to }} I do see the recipient email 
> address but it is floated to the left and is surrounded in in a grey box 
> with padding... so that it displays like 
>
>   bl...@email.com Post 3 was successfully sent to .
>
>
>
>
> I hope I am being clear and am hoping to get a better answer on how to get 
> it to display properly.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c389ec12-00ba-4784-ab5a-ff0e42fa4d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Forms in Django

2016-03-19 Thread Stanislav Vasko
Outstanding answer, many thanks! This is exactly what i thought there must 
be :)

Dne sobota 19. března 2016 2:43:31 UTC+1 Fred Stluka napsal(a):
>
> Stanislav (aka Stanley?),
>
> As my company motto says:  "Glad to be of service!".
>
> I'm very impressed with Django.  It's a mature product that does
> a good job of:
> "Making simple things easy, and complex things possible"
> It has good simple default behaviors, but also hooks that you
> can use to drill down to more detail when necessary.
>
>
> For example, in my Django templates, I sometimes use:
>
> {{form}}
>
> but sometimes have to resort to:
>
> {{ form.first_name }}
> {{ form.last_name }}
> {{ form.phone }}
>
> and occasionally even:
>
> {{ form.first_name.value }}
> {{ form.first_name.label }}
> {{ form.first_name.errors }}
>
> {{ form.last_name.value }}
> {{ form.last_name.label }}
> {{ form.last_name.errors }}
>
> {{ form.phone.value }}
> {{ form.phone.label }}
> {{ form.phone.errors }}
>
>
> Similarly, in my Django ModelForms, I sometimes use:
>
> class PersonModelForm(forms.ModelForm):
> class Meta:
> model=Person
>
> but sometimes have to resort to:
>
> class PersonModelForm(forms.ModelForm):
> class Meta:
> model=Person
> fields = ['first_name', 'last_name', 'phone',]
>
> and occasionally even:
>
> class PersonModelForm(forms.ModelForm):
> class Meta:
> model=Person
> exclude = ['middle_name',]
>
> or take over a field explicitly as:
>
> phone = forms.CharField(
> required   = True,
> max_length = 50,
> label  = u'',
> widget = forms.TextInput(
> attrs={
> 'class'   : 'form-control',
> 'id'  : 'my_custom_HTML_id',
> 'placeholder' : 'Phone',
> }
> ),
> )
>
> or even give up on doing it all declaratively and do something
> more dynamic in the __init__() of the Form, as:
>
> def set_placeholders_from_labels(form):
> for field in form.fields.itervalues():
> field.widget.attrs['placeholder'] = field.label
>
> class PersonForm(forms.Form):
> def __init__(self, *args, **kwargs):
> super(Donate2Form, self).__init__(*args, **kwargs)
>
> set_placeholders_from_labels(self)
> self.fields['amount'].widget.attrs['placeholder'] = ""
>
> if some_special_reason():
> self.fields['amount'].initial = "100"
>
> keep_enabled = ['first_name','last_name']
> if some_mode_where_we_need_some_fields_disabled():
> for field in self.fields:
> if field not in keep_enabled:
> self.fields[field].widget.attrs['disabled'] = True
>
>
> And with validation of user-entered data, I can declare many 
> validation rules on the declarations of the fields, and can do 
> validation programmatically in the clean_field_name() methods 
> and the overall clean() method.  Or can even use the clean() 
> method of the Model instead of the clean() method of the form.
>
>
> The ORM has similar hooks.  I can use it simply, to get() and 
> save() models from and to the DB.  Or can do fancier queries.
> Or can drop down into raw SQL if necessary.
>
>
> And I can use middleware to inject all sorts of useful functionality
> into the HTTP request/response cycle, to change or add to the 
> default behavior, add caching of DB data, Django templates, 
> and fully assembled Django pages, etc.
>
>
> And I can hook into Django "signals" for more sophisticated
> needs.
>
>
> Very powerful!
>
> And I've found the community to be extraordinarily friendly and
> helpful also.
>
> Enjoy!
> --Fred 
> --
> Fred Stluka -- mailt...@bristle.com  -- 
> http://bristle.com/~fred/ 
> Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
> Open Source: Without walls and fences, we need no Windows or Gates. 
> --
> On 3/18/16 3:54 PM, Stanislav Vasko wrote:
>
> This is exactly what i was looking for, many thanks! Now i can render form 
> i need and like. Now i will test and i hope it will be same easy to write 
> data back to db.
>
> Many thanks, Stanley
>
> Dne pátek 18. března 2016 20:50:37 UTC+1 Fred Stluka napsal(a): 
>>
>> Stanislav,
>>
>> Try these:
>>
>> {{ form.title.value }}
>> {{ form.title.label }}
>> {{ form.title.errors }}
>> etc.
>>
>> --Fred 
>> --
>> Fred Stluka -- mailt...@bristle.com -- http://bristle.com/~fred/ 
>> Bristle Software, Inc -- http://bristle.com -- Glad to be of service! 
>> Open Source: Without walls and fences, we need no Windows or Gates. 
>> --
>> On 3/18/16 2:55 PM, Stanislav Vasko wrote:
>>
>> This is exactly what im trying. But if i enter *{{ form.title }}* i get 
>> not the data to use in form, but whole: 
>>
>> **
>>
>> But as i study doc, there is no simple way like Django is providing in 
>> other part. So, maybe Fred's way is a good one (but quite strange) and 
>> still dont know how i w

Django per-view cache to database error

2016-03-19 Thread Sanjay Ortiz


I was learning how to implement django cache framework in my simple web 
application.

I've used postgresql database and i've created my_cache_table. I tried 
using "per-view cache" technique but it doesn't work. No database entries 
at my_cache_table have been created.


#settings.py
MIDDLEWARE_CLASSES = 
['django.middleware.security.SecurityMiddleware','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',]
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'shopprsense',
'USER': 'shopprsense',
'PASSWORD': 'password',
'HOST': 'localhost',
'PORT': '',
}}

CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'my_cache_table',
'TIMEOUT': 3600,
'OPTIONS': {
'MAX_ENTRIES': 1000
}
}}
#urls.py
urlpatterns = [
url(r'^$', views.search_form),
url(r'^s', cache_page(60 * 60)(views.search)),
]
#views.pyfrom .scraper import scrapefrom django.views.decorators.cache import 
cache_page
def search_form(request):
return render(request, 'scraper/search_form.html')
def search(request):
 q = request.GET["k"]
 ftitles, fprices, furls = scrape(q)
 context = {'ftitles': ftitles, 'fprices': fprices , 'furls': furls , 'q': q}
 return render(request, 'scraper/output.html', context)


This is how my web app works -

1.User enters keyword to search

2.Keyword is sent to the script "scrape.py" and processed and output is 
rendered and displayed in a page output.html.

My QUESTION -

   - 
   
   It would be great if i could cache the search view response so that a 
   hefty process that happens in the search view can be avoided.
   - 
   
   So when user searches for the same keyword that has been cached, the 
   response can be displayed from cache avoiding the process.
   - 
   
   I tried using per-view caching in urls but it doesn't work
   - 
   
   Please point out what am i missing here .
   
Any help is appreciated.

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


Re: advanced beginner / early intermediate Django users

2016-03-19 Thread René Fleschenberg
Hi,

On Friday 18 March 2016 11:35:13 Becka R. wrote:
> Some of the issues I really struggled with, and had blocks on included:
> -  deployment

There are many different ways to deploy Django (or actually, Python/WSGI) 
applications. You have to chose the one that suits your case best. It might 
be a good idea to use a PaaS like Heroku or Pythonanywhere, so you can focus 
your time on actual development.

> - switching to Postgres

I recommend to use Postgres from day 1, also for local development. That 
said, Django's dumpdata / loaddata commands can often be used to easily 
migrate data to a different database. Did you try dumpdata / loaddata and 
run into trouble?

> -  allowing a user to edit data in a modelform where there was a foreign
> key

I am not sure what exactly your problem was here. By default, you should get 
a ModelChoiceField, and it should just work. If you want to edit objects on 
the other side of the relationship, you can use an inline formset:

https://docs.djangoproject.com/en/1.9/topics/forms/modelforms/#django.forms.models.BaseInlineFormSet

> I'm guessing these are all very common use cases, and that there are more
> which could be better documented.  I'm interested in helping to make it
> easier for people at my level to find resources and code samples,and I
> have two questions for the group:
> 
> 1.  What are some of the common use cases you've struggled with?
> 2. What resources, beyond the docs and official tutorial have you found to
> be helpful, accurate, and up to date with Django 1.9 (or 1.8) and
> associated packages?

To be honest, most of the time, my problem was that I did not take the time 
to read the official documentation carefully enough :) If you have 
suggestions on how to improve the documentation, it would be great if you 
open a pull request on Github, or maybe initiate a discussion here or on 
django-developers.

I also keep a small list of blog posts that cover some less common cases 
that the official docs don't mention.

For "advanced" things, the IRC channel #django on freenode can also be quite 
helpful.

The Django Girls tutorial is also very good. 
http://tutorial.djangogirls.org/

-- 
René

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1876650.cbAOxi8mRP%40rex.
For more options, visit https://groups.google.com/d/optout.


Re: Django Forms vs Angularjs

2016-03-19 Thread bobhaugen
Questions interspersed below:

On Friday, March 18, 2016 at 11:38:59 AM UTC-5, Gorkem Tolan wrote:
>
> I am a new comer to Django. Last four weeks I have been working on web 
> application purely created with Django framework. 
> I realized that Django forms are very cumbersome to use. 
>

What is cumbersome about them? Can you post some of your form code that you 
find cumbersome? Maybe you are doing something that is more complicated 
than it needs to be.

My experience with Django forms is that they get something up and running 
very quickly and very easily and run into problems when I try to do 
something more complicated. And then the main problem for me is if I have a 
lot of forms on the same page: the page starts to render very slowly. But 
the code is still fairly simple.
 

> I'd rather have DRF (rest framework) and just angularjs form. I am sure 
> alot users will bombard me tons of oppositions. 
>

DRF is awesome!  If you are more familiar with Angular than Django, it 
might be a good way for you to go.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/47b6e71e-d19c-49be-bf10-b50dd616b3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


The way to remove UNIQUE of username field, user_auth table

2016-03-19 Thread toyamalee3
Hi.
I have a question.

I use python-social-auth.
When I registered my facebook account on my APP, username field of 
user_auth got my name like "johnlennon".
But it is said that username has to be UNIQUE.
So, if someone who also has the name, johnlennon, the person cannot sigh up 
my APP.
I tried to remove UNIQUE property through Agminer but it was prohibited.
How can I register users who have same names ?

Thank you.

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


Re: PGConf US 2016 - free tickets for Django community members

2016-03-19 Thread Asif Saifuddin
The member should be a US citizen?

On Thursday, March 17, 2016 at 5:45:27 AM UTC+6, Daniele Procida wrote:
>
> The organisers of PGConf US 2016, the biggest Postgres conference in the 
> world, have offered five full conference tickets worth US$439.00 each to 
> the Django community. 
>
>  
>
> Daniele 
>
>

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


Re: unhashable type: 'dict'

2016-03-19 Thread Deepanshu Sagar
hello guys, 

On clicking "*Click here to login*  " I was 
able to move my webpage to http://localhost:8000/login/ with 

"from django.contrib.auth.views.login"


by entering the username and password, I am getting below error. 
"AttributeError: 'Manager' object has no attribute 'games_for_user'"


user/views.py contains: 

from tictactoe.models import Game


@login_required
def home(request):
my_games = Game.objects.games_for_user(request.user)
active_games = my_games.filter(status="A")
finished_games = my_games.exclude(status="A")
waiting_games = active_games.filter(next_to_move=request.user)
other_games = active_games.exclude(next_to_move=request.user)
context = {'other_games': other_games,
   'waiting_games': waiting_games,
   'finished_games': finished_games}
return render(request, "user/home.html", context)


So, Game is not getting imported with: 

from tictactoe.models import Game


below is my directory tree: 


any help is appreciated. 

thanks
Deepanshu

On Wednesday, March 16, 2016 at 6:42:45 PM UTC+5:30, Deepanshu Sagar wrote:

> Yes, I got that working, thanks.  :)
>
> On Tuesday, March 15, 2016 at 7:54:02 PM UTC+5:30, Bruno Barbosa wrote:
>>
>> you forgot the function name auth_views.logout as a second parameter as 
>> mentioned above.
>>
>> try it:
>> url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'}, 
>> name='boardgames_logout'),
>>
>> --
>> Bruno Barbosa
>> Web Developer
>> *brunobarbosa.com.br *
>>
>> On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar  
>> wrote:
>>
>>> yes, thank you for the prompt reply, I am using 
>>>
>>> from django.contrib.auth import views as auth_views
>>>
>>> I need to redirect my webpage to "board_games" main page when the user 
>>> logs out. 
>>> can you please direct me to the correct way to do that? 
>>>
>>> Thanks in advance. 
>>>
>>>
>>>
>>> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:
>>>
 You are correct, your problem is in logout url , because you need to 
 pass a function not a duct as second parameter.

 Are you using django auth views ?



 https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout


 El martes, 15 de marzo de 2016, Deepanshu Sagar  
 escribió:
 > Hello,
 > i am getting below error while accessing http://localhost:8000/login/
 .
 > 
 
 >
 > Below are the chaining codes.
 > boardgames\urls.py
 > 
 
 > boardgames\templates\login.html
 > 
 
 >
 > NOTE: before adding "
 >
 > url(r'^logout/', {'next_page': 'boardgames_home'}, 
 name='boardgames_logout')
 >
 > to boardgames\urls.py. the access was working fine.
 > below is the settings.py
 >
 > """
 > Django settings for boardgames project.
 >
 > For more information on this file, see
 > https://docs.djangoproject.com/en/1.6/topics/settings/
 >
 > For the full list of settings and their values, see
 > https://docs.djangopro ect.com/en/1.6/ref/settings/
 > """
 >
 > # Build paths inside the project like this: os.path.join(BASE_DIR, 
 ...)
 > import os
 > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 >
 >
 > # Quick-start development settings - unsuitable for production
 > # See 
 https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
 >
 > # SECURITY WARNING: keep the secret key used in production secret!
 > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
 >
 > # SECURITY WARNING: don't run with debug turned on in production!
 > DEBUG = True
 >
 >
 > ALLOWED_HOSTS = []
 >
 >
 > # Application definition
 >
 > INSTALLED_APPS = (
 > 'django.contrib.admin',
 > 'django.contrib.auth',
 > 'django.contrib.contenttypes',
 > 'django.contrib.sessions',
 > 'django.contrib.messages',
 > 'django.contrib.staticfiles',
 > 'main',
 > 'tictactoe',
 > )
 >
 > MIDDLEWARE_CLASSES = (
 > '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',
 > )
 >
 > ROOT_URLCONF = 'boardgames.urls'
 >
 > TEMPLATES = [
 > {
 > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
 > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
 > 'APP_DIRS': True,
 > 'OPTIONS': {
 > 'context_processors': [
 > 'django.core.context_processors.request',
 > 'django.template.context_processors.debug',
 > 'django.template.context_processors.request',

advanced beginner / early intermediate Django users

2016-03-19 Thread Becka R.
Hi there, 

This is less about solving a specific coding issue in Django, and more 
asking for input from other people who have hit walls in Django.  I hope 
this is within the scope of what this list is used for, and if it isn't I 
apologize. 

I've now written a couple of Django CRUD applications, and I keep running 
into walls in Django which I suspect are quite common to advanced beginners 
or early intermediate users.  I'm in the process of organizing a sprint, 
and am hoping to start working with people on gathering and creating 
resources for people who are beyond the core basics, but still learning 
some of the fundamentals. 

Some of the issues I really struggled with, and had blocks on included:
-  deployment 
- switching to Postgres
-  allowing a user to edit data in a modelform where there was a foreign key

I'm guessing these are all very common use cases, and that there are more 
which could be better documented.  I'm interested in helping to make it 
easier for people at my level to find resources and code samples,and I have 
two questions for the group:

1.  What are some of the common use cases you've struggled with? 
2. What resources, beyond the docs and official tutorial have you found to 
be helpful, accurate, and up to date with Django 1.9 (or 1.8) and 
associated packages?

Thanks so much for your ideas. 

Becka

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3d7448a1-2d8d-4333-ad4a-9396f552b346%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Different choices values for a single field in inherited class

2016-03-19 Thread MadEng
Hello Moogly,

$ wine/models.py:


class ColorBase(models.Model): 
class Meta: 

abstract = true

COLORS_CHOICHES = (
("Red","Red"), 
("Blue",   "Blue"), 
 )  

   
tone= models.CharField(max_length = 32, choices = COLORS_CHOICHES) 

  
class RedColor(ColorBase):  

COLORS_CHOICHES = ( 
 ("Light red", 
   "light red"),   
   ("Dark red", "dark red") 

)  

   
   
   
 
class WhiteColor(ColorBase):

COLORS_CHOICHES = ( 
   ("Light white",  
"light 
white"),   
 ("Dark white",   "dark white") 

)  
    
   

Now in your $ wine/admin.py:

class ColorBaseAdmin(admin.ModelAdmin):
 model = ColorBase
  def formfield_for_dbfield(self, db_field, **kwargs):

if db_field.name == 'status':

kwargs.update(

{'choices':self.model. COLORS_CHOICHES}

)
#I THINK THIS IS NOT REQUIRED BECAUSE AUTOMATICALLY YOU HAVE 
MODEL UPDATED.. you can omit these two lines

if settings.DEBUG self.model == ColorBase:

logger.warning("Please set the model in your model admin to 
display correct status' choices")

return super(ColorBaseAdmin, self).formfield_for_dbfield(

db_field, **kwargs)

class RedColorAdmin(ColorBaseAdmin):
model=RedColor
class WhiteColorAdmin(ColorBaseAdmin):
model=WhiteColor

admin.site.register(RedColor, RedColorAdmin)
admin.site.register(WhiteColor, WhiteColorAdmin)

If you need choices in your frontend form you have to pass 
YourColor.COLOR_CHOICES choices to your form field in your form's __init__ 
function
#HOPE THIS WORKS BUT I DIDN'T TEST IT

class BaseColorForm(forms.ModelForm):

def __init__(self, **kwargs):
self.base_fields['tone'].choices=self.Meta.model.COLOR_CHOICES

super(BaseColorForm, self).__init__(*args, **kwargs)

class RedColorForm(BaseColorForm):
class Meta:
model = RedColor

class WhiteColorForm(BaseColorForm):
class Meta:
model = WhiteColor





Hope this helps

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7a5f665-6ffa-42ba-be12-39868ce726c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Forms in Django

2016-03-19 Thread Stanislav Vasko
This is exactly what im trying. But if i enter *{{ form.title }}* i get not 
the data to use in form, but whole: 

**

But as i study doc, there is no simple way like Django is providing in 
other part. So, maybe Fred's way is a good one (but quite strange) and 
still dont know how i will make Fieldsets and other stuff (i need to work 
with data and some the result). 

Maybe there is some better Django Form plugin, but i prefer not to use 
anything outside Django, because noone knows how it will work with new 
Django versions and how buggy it can be. As beginner i'm glad for solving 
own bugs not fighting others too :)

You can also do a custom template. So instead of letting Django render the 
form, you code the html yourself.
>
>
> This is, instead of:
>
> {{ form.as_p }}
>
> do something like:
>
> {% csrf_token %}
> 
>  placeholder="Phone" type="text">
>  aria-hidden="true">
> 
> ...
> 
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb89aebe-5c3a-41dd-8f58-00acb8d78289%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: unhashable type: 'dict'

2016-03-19 Thread Deepanshu Sagar
Yes, I got that working, thanks.  :)

On Tuesday, March 15, 2016 at 7:54:02 PM UTC+5:30, Bruno Barbosa wrote:
>
> you forgot the function name auth_views.logout as a second parameter as 
> mentioned above.
>
> try it:
> url(r'^logout/$', *auth_views.logout*, {'next_page': 'boardgames_home'}, 
> name='boardgames_logout'),
>
> --
> Bruno Barbosa
> Web Developer
> *brunobarbosa.com.br *
>
> On Tue, Mar 15, 2016 at 10:32 AM, Deepanshu Sagar  > wrote:
>
>> yes, thank you for the prompt reply, I am using 
>>
>> from django.contrib.auth import views as auth_views
>>
>> I need to redirect my webpage to "board_games" main page when the user 
>> logs out. 
>> can you please direct me to the correct way to do that? 
>>
>> Thanks in advance. 
>>
>>
>>
>> On Tuesday, March 15, 2016 at 5:45:07 PM UTC+5:30, luisza14 wrote:
>>
>>> You are correct, your problem is in logout url , because you need to 
>>> pass a function not a duct as second parameter.
>>>
>>> Are you using django auth views ?
>>>
>>>
>>>
>>> https://docs.djangoproject.com/en/1.9/topics/auth/default/#django.contrib.auth.logout
>>>
>>>
>>> El martes, 15 de marzo de 2016, Deepanshu Sagar  
>>> escribió:
>>> > Hello,
>>> > i am getting below error while accessing http://localhost:8000/login/.
>>> > 
>>> 
>>> >
>>> > Below are the chaining codes.
>>> > boardgames\urls.py
>>> > 
>>> 
>>> > boardgames\templates\login.html
>>> > 
>>> 
>>> >
>>> > NOTE: before adding "
>>> >
>>> > url(r'^logout/', {'next_page': 'boardgames_home'}, 
>>> name='boardgames_logout')
>>> >
>>> > to boardgames\urls.py. the access was working fine.
>>> > below is the settings.py
>>> >
>>> > """
>>> > Django settings for boardgames project.
>>> >
>>> > For more information on this file, see
>>> > https://docs.djangoproject.com/en/1.6/topics/settings/
>>> >
>>> > For the full list of settings and their values, see
>>> > https://docs.djangopro ect.com/en/1.6/ref/settings/
>>> > """
>>> >
>>> > # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
>>> > import os
>>> > BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
>>> >
>>> >
>>> > # Quick-start development settings - unsuitable for production
>>> > # See 
>>> https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
>>> >
>>> > # SECURITY WARNING: keep the secret key used in production secret!
>>> > SECRET_KEY = '_p4ga=y!6rbqqv3&4)v7a*qtjb*8tedegd3=8#(p-2dl6a@3#v'
>>> >
>>> > # SECURITY WARNING: don't run with debug turned on in production!
>>> > DEBUG = True
>>> >
>>> >
>>> > ALLOWED_HOSTS = []
>>> >
>>> >
>>> > # Application definition
>>> >
>>> > INSTALLED_APPS = (
>>> > 'django.contrib.admin',
>>> > 'django.contrib.auth',
>>> > 'django.contrib.contenttypes',
>>> > 'django.contrib.sessions',
>>> > 'django.contrib.messages',
>>> > 'django.contrib.staticfiles',
>>> > 'main',
>>> > 'tictactoe',
>>> > )
>>> >
>>> > MIDDLEWARE_CLASSES = (
>>> > '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',
>>> > )
>>> >
>>> > ROOT_URLCONF = 'boardgames.urls'
>>> >
>>> > TEMPLATES = [
>>> > {
>>> > 'BACKEND': 'django.template.backends.django.DjangoTemplates',
>>> > 'DIRS': [os.path.join(BASE_DIR, 'templates')],
>>> > 'APP_DIRS': True,
>>> > 'OPTIONS': {
>>> > 'context_processors': [
>>> > 'django.core.context_processors.request',
>>> > 'django.template.context_processors.debug',
>>> > 'django.template.context_processors.request',
>>> > 'django.contrib.auth.context_processors.auth',
>>> > 'django.contrib.messages.context_processors.messages',
>>> > ],
>>> > },
>>> > },
>>> > ]
>>> >
>>> >
>>> > WSGI_APPLICATION = 'boardgames.wsgi.application'
>>> >
>>> >
>>> > # Database
>>> > # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
>>> >
>>> > DATABASES = {
>>> > 'default': {
>>> > 'ENGINE': 'django.db.backends.sqlite3',
>>> > 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
>>> > }
>>> > }
>>> >
>>> > # Internationalization
>>> > # https://docs.djangoproject.com/en/1.6/topics/i18n/
>>> >
>>> > LANGUAGE_CODE = 'en-us'
>>> >
>>> > TIME_ZONE = 'UTC'
>>> >
>>> > USE_I18N = True
>>> >
>>> > USE_L10N = True
>>> >
>>> > USE_TZ = True
>>> >
>>> >
>>> > # Static files (CSS, JavaScript, Images)
>>> > # https://docs.djangoproject.com/en/1.6/howto/static-files/
>>> >
>>> > STATIC_URL = '/static/'
>>> > STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
>>> >
>>> > LOGIN_URL = 'boardgames_login'
>>> > LOGOUT_URL = 'boardgames_logout'
>>> > LOGIN_REDIRECT_URL = 'user_home'
>>> >
>>> > I am new to Django learning.
>>> > Please let me know if more details are required.
>>> > Regards
>>> > Deepanshu
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google 
>>> Grou

Re: Deploy Django to Heroku - Push rejected

2016-03-19 Thread Andreas Kuhne
Hi,

You haven't created the app in the correct heroku way. You have to have a
base django project structure. So the following changes I would suggest:

1. Use the standard layout for settings. So a settings.py file with the
PRODUCTION settings in and it will find that file. Also make sure you have
staticfiles setup the way heroku wants (see
https://devcenter.heroku.com/articles/django-assets). Also install
"whitenoise" following the guide on that page.
2. requirements.txt cannot be anywhere else but in the root. That's one of
the ways heroku decides to create a python application for your application.
3. Add a runtime.txt file containing the python version you are using for
your application (see https://devcenter.heroku.com/articles/python-runtimes)

If you follow these steps the application will be found and all your
dependencies will be installed and it will work.

Regards,

Andréas

2016-03-18 21:09 GMT+01:00 Bernardo Garcia :

> I am trying deploy my Django application to heroku and I get an error when
> I perform git push heroku master command
>
> Do you know the reason which I get this error?
>
>
> uleague) ➜ pickapp git:(master) ✗ git push heroku masterCounting objects: 
> 195, done.Delta compression using up to 8 threads.Compressing objects: 100% 
> (92/92), done.Writing objects: 100% (195/195), 516.34 KiB | 0 bytes/s, 
> done.Total 195 (delta 93), reused 195 (delta 93)
> remote: Compressing source files... done.
> remote: Building source:
> remote:
> remote:
> remote: ! Push rejected, no Cedar-supported app detected
> remote: HINT: This occurs when Heroku cannot detect the buildpack
> remote: to use for this application automatically.
> remote: See https://devcenter.heroku.com/a...
> remote:
> remote: Verifying deploy...
> remote:
> remote: !   Push rejected to shielded-crag-57385.
> remote: To https://git.heroku.com/shielde...! [remote rejected] master -> 
> master (pre-receive hook declined)
> error: failed to push some refs to 'https://git.heroku.com/shielde...
> (uleague) ➜ pickapp git:(master) ✗
>
> I have the following structures directory:
>
> 
>
>
> I follow the getting started tutorial for deploy in heroku web page
> 
>  and
> in their samples, the requirements.txt and the settings.py were as a
> isolated files in the root project and not nested under folders as a
> settings/ folder or a requirements /folder
>
> This have related for my error of push rejected ?
>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/37fec548-9274-4383-8a72-04f55f9e2ed6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


widget form

2016-03-19 Thread Tony Peña
hi,

if i got a form for example with 2 charfield, and bottom a check box 
how can i do if that checkbox is true appears the next other 2
charfields ?(maybe hide)
this exist with some function on django-admin ?

thanxs


-- 
perl -le 's ffSfs.s fSf\x54\x6F\x6E\x79 \x50\x65\x6e\x61f.print'

Secure email with PGP 0x8B021001 available at https://pgp.mit.edu

Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALBaCdvsUseRk%3DAb1ES2z9B9xvBOzO_nL%3DX2N4Ai6-VuGOE0BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: variable inside @media screen

2016-03-19 Thread stefania . demurtas
Actually It works, but there was somethin wrong in media query sizes.

thx

Rose

Il giorno venerdì 11 marzo 2016 14:03:05 UTC+1, Rose ha scritto:
>
> Hi, 
>
> I need to use "@media screen" to display different background image sizes. 
> I was able to reproduce the correct output by using this code with wagtail 
> tags:
>
> 
> {% image block.value width-1450 as carouselimagedata %}
> @media screen and (min-width:1450px){
> .img { background:url('{{ MEDIA_URL }}{{ carouselimagedata.url }}') 
> no-repeat center center; background-size: cover;}
> }
> {% image block.value width-1200 as carouselimagedata %}
> @media screen and (min-width:1200px){
> .img { background:url('{{ MEDIA_URL }}{{ carouselimagedata.url }}') 
> no-repeat center center; background-size: cover;}
> } ...
> 
>
> output:
>
>
> 
> 
> @media screen and (min-width:1450px){
> .img { background:url('/media/images/albergo_DPbX2EO.width-1450.jpg') 
> no-repeat center center; background-size: cover;}
> }
> 
> @media screen and (min-width:1200px){
> .img { background:url('/media/images/albergo_DPbX2EO.width-1200.jpg') 
> no-repeat center center; background-size: cover;}
> }
> 
> @media screen and (min-width:992px){
> .img { background:url('/media/images/albergo_DPbX2EO.width-992.jpg') 
>  no-repeat center center; background-size: cover;}
> }
> 
> @media screen and (min-width:768px){
> .img { background:url('/media/images/albergo_DPbX2EO.width-800.jpg') 
>  no-repeat center center; background-size: cover;}
> }
> 
> @media screen and (min-width:767px){
> .img { background:url('/media/images/albergo_DPbX2EO.width-550.jpg') 
>  no-repeat center center; background-size: cover;}
> }
> 
>
> I can see background image but it doesn't change in responsive layout 
> view. It always seems to pick up the last image size, in my case 550.jpg. 
>
> Any ideas?
>
> Thx, 
> Rose
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e453bac2-d58c-48d5-bc74-3a2f658eb556%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Santosh Srinivas
Hi Folks,

I'm new to both Python and Django.
I am looking for high quality video tutorials on Django and Python from 
your experience (paid is also fine).

Please advise.

Thank you.
Santosh

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aedc789c-f8d7-4314-b52a-ccb764c56edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: MySql Memory tables doubt...

2016-03-19 Thread René Fleschenberg
Hi,

On Wednesday 16 March 2016 12:58:17 Jose Galvan wrote:
> I am developing a web site to make queries and create new entries  in a
> old Mysql order entry system so I need to use the Raw SQL django
> functionality more than ORM.

Are you sure that you cannot use the ORM? Maybe you can just use unmanaged 
models?

https://docs.djangoproject.com/ja/1.9/ref/models/options/#managed

> In the process I need to use a temporary mysql table ( like a memory table
> that  is alive while the session is active), my question is : In order to
> manipulate it, Do I need to declare this table in the models.py like any
> other table ?

Take a look at Django's multi-database support:

https://docs.djangoproject.com/en/1.9/topics/db/multi-db/

Yes, you should probably write models for the temporary table.

-- 
René

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2528117.tGycDJ9xjI%40rex.
For more options, visit https://groups.google.com/d/optout.


custom FORMAT_SETTINGS

2016-03-19 Thread Erik Stein


hello --

I'd like to extend Django's localized formats by my own defaults, using 
the FORMAT_MODULE_PATH setting, e.g. to have those:


SHORT_DAY_ONLY_FORMAT = 'd.'
SHORT_DAYMONTH_FORMAT = 'd.N.'
DATE_RANGE_SEPARATOR = '–'

Sadly, in django.utils.formats.get_format Django checks the hard coded 
list of possible FORMAT_SETTINGS and returns the placeholder string if 
it doesn't know the format.


Do I missing something or is it just not possible currently to extend 
the default formats?


best
-- erik

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


Re: MySql Memory tables doubt...

2016-03-19 Thread Jose Galvan
Thanks for your Answer Rene, Well you see.. tables were designed without Id 
primary key on it, instead tables use composed keys, ORM queries in Django 
are mostly based on an unique Id  feature as Pk, this was the main reason 
for not to use ORM. And yes, tables are declared as manage=false, in fact 
when I did execute migrate command django got all DB phisical structures 
and automatically created models in models.py and added the feature you 
mention..manage= "FALSE" as a metadata in each model

Anyway, regarding temporary tables  I was testing and it seems to be not 
necessary to declare it on models.py, the error I had was for another 
reason.

Thanks very much man ! 



El sábado, 19 de marzo de 2016, 5:57:00 (UTC-5), René Fleschenberg escribió:
>
> Hi, 
>
> On Wednesday 16 March 2016 12:58:17 Jose Galvan wrote: 
> > I am developing a web site to make queries and create new entries  in a 
> > old Mysql order entry system so I need to use the Raw SQL django 
> > functionality more than ORM. 
>
> Are you sure that you cannot use the ORM? Maybe you can just use unmanaged 
> models? 
>
> https://docs.djangoproject.com/ja/1.9/ref/models/options/#managed 
> 
>  
>
> > In the process I need to use a temporary mysql table ( like a memory 
> table 
> > that  is alive while the session is active), my question is : In order 
> to 
> > manipulate it, Do I need to declare this table in the models.py like any 
> > other table ? 
>
> Take a look at Django's multi-database support: 
>
> https://docs.djangoproject.com/en/1.9/topics/db/multi-db/ 
>
> Yes, you should probably write models for the temporary table. 
>
> -- 
> René 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2dc506ad-be90-4681-afa4-8710d66f6e02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Forms in Django

2016-03-19 Thread Fred Stluka

Stanislav,

Try these:

{{ form.title.value }}
{{ form.title.label }}
{{ form.title.errors }}
etc.

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 3/18/16 2:55 PM, Stanislav Vasko wrote:
This is exactly what im trying. But if i enter *{{ form.title }}* i 
get not the data to use in form, but whole:


**


But as i study doc, there is no simple way like Django is providing in 
other part. So, maybe Fred's way is a good one (but quite strange) and 
still dont know how i will make Fieldsets and other stuff (i need to 
work with data and some the result).


Maybe there is some better Django Form plugin, but i prefer not to use 
anything outside Django, because noone knows how it will work with new 
Django versions and how buggy it can be. As beginner i'm glad for 
solving own bugs not fighting others too :)


You can also do a custom template. So instead of letting Django render 
the form, you code the html yourself.



This is, instead of:

{{ form.as_p }}

do something like:

{% csrf_token %}




...


--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb89aebe-5c3a-41dd-8f58-00acb8d78289%40googlegroups.com 
.

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


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


Re: Error running Django tutorial

2016-03-19 Thread Ruth
Hi,
I am getting the same problem, despite having include in my mysite\urls.py 
file.
I am using Python 2.7.6, Django 1.9.4 and Ubuntu 14.04.3 LTS.
Could it by a Python 2.7 problem?
Thanks,
Ruth

On Wednesday, March 2, 2016 at 12:19:16 PM UTC-8, jorr...@gmail.com wrote:
>
> Glad you got it solved!!
>
>
> On Monday, February 29, 2016 at 10:10:58 PM UTC+1, Mike Kipling wrote:
>>
>> I found the problem.
>>
>> When the mysite\urls.py file is created, it has this line already in it.
>>
>> from django.conf.urls import url
>>
>> The tutorial asks you to add the following lines to the file.
>>
>> from django.conf.urls import include, url
>> from django.contrib import admin
>>
>> urlpatterns = [
>> url(r'^polls/', include('polls.urls')),
>> url(r'^admin/', admin.site.urls),
>> ]
>>
>> I must did not notice that the 'include' was different, and so I had not 
>> placed it into the file.  I changed the file to add the 'include' and 
>> everything worked.
>>
>> Thank you for the help.
>>
>

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


Re: Forms in Django

2016-03-19 Thread Fred Stluka

Stanislav,

Look at how you defined the fields of your Form class.

You probably defined the phone field as something like:

phone = forms.CharField(
required   = True,
max_length = 50,
label  = u'Phone',
)

Change it to:

phone = forms.CharField(
required   = True,
max_length = 50,
label  = u'',
widget = forms.TextInput(
attrs={
'class'   : 'form-control',
'id'  : 'inputSuccess5',
'placeholder' : 'Phone',
}
),
)

--Fred

Fred Stluka -- mailto:f...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

On 3/18/16 10:53 AM, Stanislav Vasko wrote:

Hello,

as a noob in Django, i will ask noob question about Forms, because i 
cant find.


I have working app, based on Bootstrap with theme and custom css. 
Rather than Django admin i want to create/edit data from my fields. I 
tried to use Django forms, but no luck. It looks... bad :) Its simple, 
but i have no controll over the result:


{% for field in form %}

{{ field.errors }}
{{ field.label_tag }} {{ field }}
{% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}

{% endfor %}


Insted of simple form i found form.as_p(), form.as_ul() aso, but it 
doesnt solve my problem too, just gives me little changed result. I 
need to be able insert and read data from my own tem plate, like:








Please, can you help me how to get clean data and after update put 
them back? Thanks for any tips or direct link.

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/541fd731-d2b9-4fbd-807a-420ba5d21d3e%40googlegroups.com 
.

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


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


Re: Django Newbie - Tutorial Recommendations?

2016-03-19 Thread Anthony W Smith


On Friday, March 18, 2016 at 8:31:56 AM UTC-4, Santosh Srinivas wrote:
>
> Hi Folks,
>
> I'm new to both Python and Django.
> I am looking for high quality video tutorials on Django and Python from 
> your experience (paid is also fine).
>
> Please advise.
>
> Thank you.
> Santosh
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4a7a68f0-dab1-4901-bcb0-8702b9758f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: The way to remove UNIQUE of username field, user_auth table

2016-03-19 Thread monoBOT
usernames should be unique. that is common sense

You should somehow differentiate one user from the other using his email
address as username for example. this is a common approach you may have
seen sometimes in the past.


2016-03-16 11:37 GMT+00:00 :

> Hi.
> I have a question.
>
> I use python-social-auth.
> When I registered my facebook account on my APP, username field of
> user_auth got my name like "johnlennon".
> But it is said that username has to be UNIQUE.
> So, if someone who also has the name, johnlennon, the person cannot sigh
> up my APP.
> I tried to remove UNIQUE property through Agminer but it was prohibited.
> How can I register users who have same names ?
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1cca0666-b5d4-4089-8ab3-7d96ddf4782b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*monoBOT*
Visite mi sitio(Visit my site): monobotsoft.es/blog/

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BxOsGBJhvoHUxr6f3CgRbEC8uHy%3DzmnJeCeuhRdwc9ajh0N8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Forms in Django

2016-03-19 Thread Stanislav Vasko
Ufff, i hope there is another way. Something working so simple like passing 
data from View to Template with direct access like {{ company.name }} or {{ 
company.phone }}. I dont see the point why to modify Model and how it helps 
with styling 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f33ad8b5-af2a-417c-b572-e0b7973e2d4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.