Re: Hi, i'm new to django i need some mini project which contain atleast 4 page for go through how it works

2016-08-29 Thread 'voger' via Django users

Have a look at this guys youtube channel
https://www.youtube.com/user/CodingEntrepreneurs/playlists

There he has some video playlists. The most interesting for you are
trydjango1.9 and trydjango1.8 where he builds two different websites.
I think they fit perfectly with what you asking.

If you prefer dead tree books I recommend "django by example" where the 
author builds various projects presenting django features and 
integration with third party libraries along the way.


They both have the code for thei projects free on github if you want to 
see it


On 29/08/2016 02:26 μμ, rajeshkmr9583 wrote:

Hi,

 i'm new to Django i need some mini project which contain at least 4
page for go through how it works..

Thanks

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
.
To post to this group, send email to django-users@googlegroups.com
.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/bbb64c7f-ea21-4cb8-bfde-b534ca92eaa8%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/9ded7f09-859a-17f3-9cf9-a8a8570151c7%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: How can I capture two slugs in one URL pattern?

2016-08-21 Thread 'voger' via Django users
I barely understand django my self but I hope I am pointing you in the 
right direction.


1. I don't understand what the (?:/(?P[\w\d-]+))?/ part in your 
pattern is supposed to do. My regexp-fu is weak so I can't comment on that


2. Your url will match and pass to the view whatever url you give it. So 
even if you give a pk and slug that don't exist in database, still the 
view will get called as long as the regexp matches.


3. In your view you check the db against the pk and slug and if not 
found __the view__ rises 404.


4. You don't check if category exist in database and you don't rise 404 
if not. In this case it is assumed it is always right.



On 20/08/2016 06:10 μμ, Yunus wrote:

Hello,

I want to two slugs in one URL pattern. These slugs from different
models. I have a model Link with a many to one relationship with a model
category.

Actually these two slugs is working. But one of the slugs is accepting
whatever I write in the category_slug section of the url.

Let's say:I
write 127.0.0.1:8000/there_is_no_name_like_that_in_the_database/pk/slug this.
I am going to this page but there is no category with this name. So,
basically is accepting whatever I write.
*#links/views.py*
|
classLinkDetailView(FormMixin,DetailView):
model =Link
context_object_name ='link'
form_class =CommentForm
success_url =reverse_lazy('home')


defget_object(self,queryset=None):

returnget_object_or_404(Link,pk=self.kwargs['pk'],slug=self.kwargs['slug'])


...
|

*#links/urls.py*
|
urlpatterns =[


...

url(

regex=r'^k/(?P[\w-]+)/(?P\d+)(?:/(?P[\w\d-]+))?/$',
view=views.LinkDetailView.as_view(),
name='link_detail'
),


...
]
|

--
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/0b8482ee-5e64-4ee8-a664-d1d938767bd6%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/c9904d3f-f162-cfa5-c9e7-b53330225742%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: How do I build this ignore pattern for collectstatic?

2016-08-17 Thread 'voger' via Django users
As to what kind of pattern it expects I found it. It expects glob style 
patterns like the shell prompt. Not much matching to be done here.



Still I am curious if there is any clever way to achieve this with 
pattern matching.



On 16/08/2016 11:30 μμ, 'voger' via Django users wrote:

Let's say somewhere inside my /static/ folder I have this tree

$ tree -L 2 -F --dirsfirst
.
├── qooxdoo -> ../../../qooxdoo//
└── qssite/
├── build/
├── source/
├── apache2.conf
├── config.json
├── config.json_orig
├── config.json_test
├── decode-source-uris.js
├── generate.py*
├── Gruntfile.js
├── Manifest.json
├── package.json
├── README.md
└── readme.txt

and let's say that I don't want collectstatic to collect anything except
the folder qssite/build/

Is there any pattern I can use or should I list explicitly everything I
want to be excluded?

Also what kind of patterns does it expect? Is it regular expression or
something else?



--
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/955d0427-51a2-4277-75b1-8088eeb2fc64%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


How do I build this ignore pattern for collectstatic?

2016-08-17 Thread 'voger' via Django users

Let's say somewhere inside my /static/ folder I have this tree

$ tree -L 2 -F --dirsfirst
.
├── qooxdoo -> ../../../qooxdoo//
└── qssite/
├── build/
├── source/
├── apache2.conf
├── config.json
├── config.json_orig
├── config.json_test
├── decode-source-uris.js
├── generate.py*
├── Gruntfile.js
├── Manifest.json
├── package.json
├── README.md
└── readme.txt

and let's say that I don't want collectstatic to collect anything except 
the folder qssite/build/


Is there any pattern I can use or should I list explicitly everything I 
want to be excluded?


Also what kind of patterns does it expect? Is it regular expression or 
something else?


--
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/d07055ec-0698-dae6-5525-1cfb780e04d3%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: Please help me out, I tried to get sync for whole day @@

2014-04-19 Thread voger
If there is a space in front of DATABASES then yes it is wrong. Python 
doesn't forgive lousy indentation


On 04/19/2014 06:11 PM, Toan ComS wrote:




DATABASES = {
 'default': {
 'ENGINE': 'django.db.backends.sqlite3',
 'NAME': 'mysite'),
 }
}


Is it wrong?

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


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


Re: Please help me out, I tried to get sync for whole day @@

2014-04-19 Thread voger
There it says "unexpected indent" and points to the DATABASES in your 
settings.py. Check to see if it is indented properly.


On 04/19/2014 05:02 PM, Toan ComS wrote:




--
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/e0144498-2204-47bf-b3d1-da229dc7f8ed%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


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


How to use custom widgets with dojango?

2014-04-19 Thread voger
I want to move my project from jquery to dojo toolkit and I see that 
there is a dojango project that integrates dojo with django. The 
instructions are simple enough and I already managed to run the sample 
project provided. Unfortunately I need to use some custom dojo widgets 
that I already have made. I don't know how to integrate them in my project.


I found this blog post 
http://uxebu.com/blog/2008/09/09/dojo-namespacing-with-dojango/ but it 
is from 2008 and since then many changes are introduced to both django 
and dojo. That blog post uses many functions that are now deprecated.


Let's assume that my apps directory tree looks like this

├── __init__.py
├── __init__.pyc
├── admin.py
├── models.py
├── models.pyc
├── static
│   └── widgets
│   ├── FloatingWindow.js
│   ├── Taskbar.js
│   ├── css
│   │   ├── floatingwindow.css
│   │   ├── icons
│   │   │   ├── gridcontainer_grip.gif
│   │   │   ├── grip_bg.gif
│   │   │   ├── pixel.gif
│   │   │   ├── resize.png
│   │   │   ├── resizeRtl.png
│   │   │   ├── rotator.png
│   │   │   ├── splitterToggleH.png
│   │   │   └── splitterToggleV.png
│   │   └── taskbar.css
│   ├── images
│   └── templates
│   └── Taskbar.html
├── templates
│   └── index.html
├── tests.py
├── views.py
└── views.pyc

can someone please provide some instructions how to use those custom 
widgets in a django 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/535263C2.6090504%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: Extended profile not being saved django-allauth

2014-03-17 Thread voger

Hi, I tried this in the django shell after I changed the line to
user = models.OneToOneField(User, related_name='userprofile') but I get 
this error.


>>> import userprofile.models
>>> from django.contrib.auth.models import User
>>> u  = User.objects.get(username='test1')
>>> print u
test1
>>> u.userprofile
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/voger/ssite_venv/lib/python2.7/site-packages/django/db/models/fields/related.py", 
line 206, in __get__

self.related.get_accessor_name()))
DoesNotExist: User has no userprofile.



On 03/17/2014 07:33 PM, voger wrote:

Hi, thanks for the reply. I didn't know about the related_name. I tried
it, did a syncdb witch didn't do anything but still the extra fields
don't save.

On 03/17/2014 06:25 PM, Fabio Caritas Barrionuevo da Luz wrote:

Voyager, Have you tried putting related_name in the Foreign Key?

class UserProfile(models.Model):
  # This line is required. Links UserProfile to a User model
instance.
  user = models.ForeignKey(User, unique=True,
*related_name='userprofile'*)







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


Re: Extended profile not being saved django-allauth

2014-03-17 Thread voger
Hi, thanks for the reply. I didn't know about the related_name. I tried 
it, did a syncdb witch didn't do anything but still the extra fields 
don't save.


On 03/17/2014 06:25 PM, Fabio Caritas Barrionuevo da Luz wrote:

Voyager, Have you tried putting related_name in the Foreign Key?

class UserProfile(models.Model):
  # This line is required. Links UserProfile to a User model
instance.
  user = models.ForeignKey(User, unique=True,
*related_name='userprofile'*)

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


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


Extended profile not being saved django-allauth

2014-03-16 Thread voger

I am trying to extend the user profile according to this page
https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#extending-the-existing-user-model

I am using django-allauth for registration. My problem is that when the 
user registers I can't find any new rows in the database. The table is 
empty. Moreover if I do like the documentation says


u = User.objects.get(username='test1')
>>> print u
test1
>> users_data = u.userprofile.gender
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'User' object has no attribute 'userprofile'

Can someone please help me? I trying for a long time to solve this and 
Google confuses me even more.



My model.py is:

from django.contrib.auth.models import User
from django.db import models
from cities_light.models import Country


class UserProfile(models.Model):
# This line is required. Links UserProfile to a User model instance.
user = models.ForeignKey(User, unique=True)

#define a touple with available gender choices
GENDER_CHOICES = (
('m', 'Male'),
('f', 'Female'),
)


# gender can take only one of the GENDER_CHOICES options
gender = models.CharField(max_length=1, choices=GENDER_CHOICES, 
verbose_name='Gender')

birth_date = models.DateField(verbose_name='Birth Date')
country = models.ForeignKey(Country, verbose_name='Country', 
max_length=50, default="")
post_code = models.CharField(verbose_name="Postal Code", 
max_length=5, default="")
has_accepted_tos = models.BooleanField(default=False, 
verbose_name='I accept site roules')
is_18_or_older = models.BooleanField(default=False, verbose_name='I 
am at least 18 years old')
area_of_residence = models.CharField(verbose_name='Area', 
max_length=50, default='')


# Override the __unicode__() method to return something meaningful!
def __unicode__(self):
return self.user.username

User.profile = property(lambda u: 
UserProfile.objects.get_or_create(user=u)[0])



My forms.py is:

from datetime import date

from django.contrib.auth import get_user_model
from django.forms import CharField, BooleanField, Form, ChoiceField, 
DateField

from django.forms.extras import SelectDateWidget
from django.forms import ModelChoiceField
from django.utils.translation import ugettext as _
from cities_light.models import Country

import utils


yearNow = date.today().year

GENDER_CHOICES = (
('m', _('Male')),
('f', _('Female')),
)


class SignupForm(Form):
has_accepted_tos = BooleanField(
error_messages={'required': _('You must accept the terms and 
conditions')},

label=_('I accept site terms and conditions'),
required=True)
is_18_or_older = BooleanField(
error_messages={'required': _('You must be at least 18 years 
old to use this site')},

label=_('I am at least 18 years old'),
required=True)
gender = ChoiceField(GENDER_CHOICES, label=_('Gender'), required=True)
country = 
ModelChoiceField(queryset=Country.objects.all().order_by('name'), 
label=_('Country'),

   required=True, empty_label=None, initial=89)
post_code = CharField(max_length=5, min_length=5, label=_('Postal 
Code'), required=False)
birth_date = DateField(widget=SelectDateWidget(years=range(yearNow 
- 18, yearNow - 100, -1)), required=True,

   initial="", label=_('Birth Date'))
area_of_residence = CharField(required=False, max_length=50, 
label=_('Area'))


class Meta:
model = get_user_model()
# model = UserProfile

def save(self, user):
print user
user.has_accepted_tos = self.cleaned_data['has_accepted_tos']
user.is_18_or_older = self.cleaned_data['is_18_or_older']
user.gender = self.cleaned_data['gender']
user.country = self.cleaned_data['country']
user.post_code = self.cleaned_data['post_code']
user.birth_date = self.cleaned_data['birth_date']
user.area_of_residence = self.cleaned_data['area_of_residence']
user.save(force_update=True)


def clean(self):
cleaned_data = super(SignupForm, self).clean()
country = cleaned_data.get('country')
post_code = cleaned_data.get('post_code')
area = cleaned_data.get('area_of_residence')

error_msg = _(u"Location not found")

if utils.verify_signup_location(country=country.code2, 
area=area, post_code=post_code) is False:

self._errors["post_code"] = self.error_class([error_msg])
self._errors["area_of_residence"] = 
self.error_class([error_msg])


del cleaned_data["post_code"]
del cleaned_data["area_of_residence"]

return cleaned_data


and in my settings.py I have

AUTHENTICATION_BACKENDS = DEFAULT_SETTINGS.AUTHENTICATION_BACKENDS + (
"guardian.backends.ObjectPermissionBackend",
# Needed to login by username in Django admin, regardless of `allauth`

Re: Can please someone explain this code from the docs?

2014-03-14 Thread voger

On 03/14/2014 11:49 PM, Shawn Milochik wrote:

That's just the syntax for calling a method on the base class.

1. MultiEmailField is a subclass of forms.Field.
2. forms.Field has a method named validate.
3. MultiEmailField also has a method named validate, so it overrides the
one on forms.Field.



Thank you. It seemed odd that the calling class name is used to call the 
parent but the more I think about it the more it makes sense. super in 
it self is a function that returns the parent of a given class. So it is 
logical to include class in arguments list.


--
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/53237CB9.4080105%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Can please someone explain this code from the docs?

2014-03-14 Thread voger
Hi, I was reading the form validation section here 
https://docs.djangoproject.com/en/dev/ref/forms/validation/ and the very 
first example is this code


from django import forms
from django.core.validators import validate_email

class MultiEmailField(forms.Field):
def to_python(self, value):
"Normalize data to a list of strings."

# Return an empty list if no input was given.
if not value:
return []
return value.split(',')

def validate(self, value):
"Check if value consists only of valid emails."

# Use the parent's handling of required fields, etc.
super(MultiEmailField, self).validate(value)  #<---What is this?

for email in value:
validate_email(email)

so the validate function calls super(MultiEmailField, 
self).validate(value) so essentially calls itself? Why? And how is this 
not ending in infinite recursion?


--
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/53237879.8090604%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.


Re: [ELI5] how to deploy django

2014-03-04 Thread voger
Hi, I am using Debian Wheezy and this is my configuration. This is the 
content of /etc/apache2/sites-available/mysitedomain.com. I made this 
file following the official django docs.


Keep in mind that this is a deployed for testing purposes site so both 
static files and django files are served from the same server, against 
django guidelines. I am posting it here just to give you an example.


I am using the wsgi.py file created by startproject and I don't know if 
I can keep it when I go live. For that maybe we can get some experienced 
advice.


Also I had to rename the /etc/apache2/sites-available/default. 
to default.bak so apache wouldn't default to that.


No need for httpd.conf file. I couldn't find any in my server anyway.

The project is named ssite and the projects folder is simply it's parent 
folder.


Hope this helps

Alias /robots.txt /home/voger/projects/ssite/static/robots.txt
Alias /favicon.ico /home/voger/projects/ssite/static/favicon.ico

AliasMatch ^/([^/]*\.css) /home/voger/projects/ssite/static/styles/$1

Alias /media/ /home/voger/projects/ssite/media/
Alias /static/ /home/voger/projects/ssite/static/


Order deny,allow
Allow from All



Order deny,allow
Allow from All


WSGIDaemonProcess mysitedomain.com 
python-path=/home/voger/projects/ssite:/home/voger/ssite_venv/lib/python2.7/site-packages

WSGIProcessGroup mysitedomain.com

WSGIScriptAlias / /home/voger/projects/ssite/ssite/wsgi.py



Order allow,deny
Allow from All




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


Should I keep used email confirmations?

2014-02-06 Thread voger
Hi, I am using django-allauth to register and authenticate users in my 
site. I am a little bit confused with the way it handles email 
verifications. After the message is sent to the user and the user 
confirms his email the confirmation stays available on the site. I saw 
the source code for the ConfirmEmailView(TemplateResponseMixin, View) 
class and there in the comments, after it logins the user right after 
the confirmation, it says


# Simply logging in the user may become a security issue. If you
# do not take proper care (e.g. don't purge used email
# confirmations), a malicious person that got hold of the link
# will be able to login over and over again and the user is
# unable to do anything about it. Even restoring his own mailbox
# security will not help, as the links will still work. For
# password reset this is different, this mechanism works only as
# long as the attacker has access to the mailbox. If he no
# longer has access he cannot issue a password request and
# intercept it. Furthermore, all places where the links are
# listed (log files, but even Google Analytics) all of a sudden
# need to be secured. Purging the email confirmation once
# confirmed changes the behavior -- users will not be able to
# repeatedly confirm (in case they forgot that they already
# clicked the mail).

I have already overridden that class so it doesn't auto login the user 
after successful confirmation and it deletes the used confirmation. If 
the user needs a new confirmation it generates a new one and sends it.


My question is, why allauth keeps the used confirmation even if it says 
it must be purged? Is there any reason to keep the used confirmation and 
am I doing something wrong by deleting it?


--
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/52F3F5F4.70701%40yahoo.gr.
For more options, visit https://groups.google.com/groups/opt_out.


Seperate fields for SelectDateWidget in template

2014-01-06 Thread voger
I have Googled a lot but I can't find an answer. I want to use 
SelectDateWidget in one of my forms but I want the select boxes in 
separate divs so I can use them with Zurb Foundation. With all the other 
widgets it is easy. For example I can do



{{ form.username.label_tag }}{{ form.username }}{{ 
form.username.errors }}



but with SelectDateWidget I want to do something like

{{ form.birth_date.label_tag }}

{{ form.birth_date_month }}


{{ form.birth_date_day }}


{{ form.birth_date_year }}

 {{ form.birth_date.errors }}

so I can use it with Foundation's grid system. I even looked at 
SelectDateWidget source but I couldn't understand how to do it.


--
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/52CAD82F.1090906%40yahoo.gr.
For more options, visit https://groups.google.com/groups/opt_out.


SelectDateWidget doesn't work after reload

2013-12-15 Thread voger
I am trying to make a sign up form and there I want to get the users 
birth date. I want to use the select date widget. in my models.py I have 
set a model field:


birth_date = models.DateField(verbose_name='Birth Date')

and my forms.py looks like this:

from django import forms
from django.forms.extras import SelectDateWidget
from models import UserProfile
import datetime

yearNow = datetime.date.today().year


class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile

localized_fields = ('gender', 'birth_date', 'has_accepted_tos', 
'is_18_or_older')

widgets = {
'birth_date': SelectDateWidget(years=reversed(range(yearNow 
- 100, yearNow - 18)))

}

The problem is that I don't always get a list of years. The first time I 
access the form it works fine. If I reload the form I get a list for the 
months, for the days but the list of the years just shows a '---'.


How can I fix this?

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


Re: How to build the Django book?

2013-11-10 Thread voger

On 11/10/2013 12:57 AM, Russell Keith-Magee wrote:


On Sun, Nov 10, 2013 at 12:05 AM, voger <vogernewslett...@yahoo.gr
<mailto:vogernewslett...@yahoo.gr>> wrote:

The django book was my first contact with django but as the website
itself states it is way out of date (covering django 1.0 and
mentioning here and there 1.4). The same website suggests their
github page

https://github.com/jacobian/__djangobook.com
<https://github.com/jacobian/djangobook.com>

  where the book updates are work in progress attempting to keep it
up to date with more recent versions of Django. The thing is, how do
I read this book? How can I compile the code to produce helpful
readable format? I am using Linux.


Hi Voger,

The Django Book is written in using Sphinx. Sphinx is a tool you can
install from PyPI --

pip install sphinx

Once you've got Sphinx installed, you can use "make" to control the
build; run

make html

to make a HTML target; the front page of the book will be put in
_build/html/index.html.

You can also build epub, texinfo, and a variety of other formats if you
need to.

Yours,
Russ Magee %-)



Thanks. 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/527F4DAA.6010603%40yahoo.gr.
For more options, visit https://groups.google.com/groups/opt_out.


How to build the Django book?

2013-11-09 Thread voger
The django book was my first contact with django but as the website 
itself states it is way out of date (covering django 1.0 and mentioning 
here and there 1.4). The same website suggests their github page


https://github.com/jacobian/djangobook.com

 where the book updates are work in progress attempting to keep it up 
to date with more recent versions of Django. The thing is, how do I read 
this book? How can I compile the code to produce helpful readable 
format? I am using Linux.


--
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/527E5D2E.4070702%40yahoo.gr.
For more options, visit https://groups.google.com/groups/opt_out.


Is there a tutorial for django-allauth?

2013-09-16 Thread voger
Hi, I want to use django-allauth in my project and I would like to to 
use it both for local registrations and registrations using Facebook. 
Unfortunately every tutorial I find describes how to use it with various 
providers but nothing is being said about local registrations. As this 
is my very first project and I am starting from registration I am kind 
of lost as to where to begin looking.


--
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: ImportError No module named django.core

2013-09-07 Thread voger
Hi, I am as noob as you so maybe this is a case of blind leading blind. 
From what I hear it is considered best practice to first create a 
virtualenv and then install django and any other packages inside that 
virtualenv. Read here for virtualenv 
http://dabapps.com/blog/introduction-to-pip-and-virtualenv-python/?=J7crUq_PM4XFtAaM7IHoCw?=AFQjCNEjUbnsJfGho1bGo4exJlT99Aod2Q?=aac8nwmTkJdYsk_TVCRf5g?=bv.51773540,d.Yms


After you created your virtualenv in let's say ~/env then you do

$ source /env/bin/activate

and your prompt becomes (env)[your normal prompt]$

then you do

(env)$ pip install django

and after that you start playing with django.



On 09/07/2013 07:42 PM, pzul wrote:

Hello,
I just installed Django-1.5.2 in a server (using command : python
setup.py install)
But now, as I'm expecting to create a new project (django-admin.py
startproject mysite ), I have this message :
ImportError No module named django.core

What can I do ?
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 http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


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


Re: [SOLVED] NoReverseMatch at /polls/

2013-09-07 Thread voger
Problem solved. I missed a step in the tutorial where name spacing in 
the root URLconf was discussed. I still don't understand it completely 
but the bottom line is that the line number 4 in the file index.html 
should be replaced with


{{ poll.question }}

On 09/07/2013 11:29 PM, voger wrote:

The previous message was delivered as a garbage due to html formating. I
am sending it again as plain text.


Hi everyone. I am trying to walk through the polls tutorial. I am stuck
at the part 4 after the change of the views from function based to class
based. A search in Google brought plenty results but none of them seems
to be related exactly to this situation or maybe it is over my head to
understand what is going on.
When I visit http://127.0.0.1:8000/polls/ i get

NoReverseMatch at /polls/

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}'
not found.

Request Method: GET
Request URL: http://127.0.0.1:8000/polls/
Django Version: 1.5.2
Exception Type: NoReverseMatch
Exception Value:

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}'
not found.

...

In template
/home/voger/PycharmProjects/mysite/polls/templates/polls/index.html,
error at line 4
Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}'
not found.
1 {% if latest_poll_list %}
2 
3 {% for poll in latest_poll_list %}
4 {{ poll.question }}
5 {% endfor %}
6 
7 {% else %}
8 No polls are available.
9 {% endif %}

The offending line is line number 4. The classes used are

class IndexView(generic.ListView):
 template_name = 'polls/index.html'
 context_object_name = 'latest_poll_list'

 def get_queryset(self):
 """Return the last five published polls."""
 return Poll.objects.order_by('-pub_date')[:5]

class DetailView(generic.DetailView):
 model = Poll
 template_name = 'polls/detail.html'

and in /polls/urls.py the urls are

urlpatterns = patterns('',
 url(r'^$', views.IndexView.as_view(), name='index'),
 url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'),
 url(r'^(?P\d+)/results/$', views.ResultsView.as_view(),
name='results'),
 url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
)

Can someone please explain what is wrong?



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


Re: NoReverseMatch at /polls/

2013-09-07 Thread voger
The previous message was delivered as a garbage due to html formating. I 
am sending it again as plain text.



Hi everyone. I am trying to walk through the polls tutorial. I am stuck 
at the part 4 after the change of the views from function based to class 
based. A search in Google brought plenty results but none of them seems 
to be related exactly to this situation or maybe it is over my head to 
understand what is going on.

When I visit http://127.0.0.1:8000/polls/ i get

NoReverseMatch at /polls/

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' 
not found.


Request Method: GET
Request URL: http://127.0.0.1:8000/polls/
Django Version: 1.5.2
Exception Type: NoReverseMatch
Exception Value:

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' 
not found.


...

In template 
/home/voger/PycharmProjects/mysite/polls/templates/polls/index.html, 
error at line 4
Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' 
not found.

1 {% if latest_poll_list %}
2 
3 {% for poll in latest_poll_list %}
4 {{ poll.question }}
5 {% endfor %}
6 
7 {% else %}
8 No polls are available.
9 {% endif %}

The offending line is line number 4. The classes used are

class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'latest_poll_list'

def get_queryset(self):
"""Return the last five published polls."""
return Poll.objects.order_by('-pub_date')[:5]

class DetailView(generic.DetailView):
model = Poll
template_name = 'polls/detail.html'

and in /polls/urls.py the urls are

urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P\d+)/results/$', views.ResultsView.as_view(), 
name='results'),

url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
)

Can someone please explain what is wrong?

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


NoReverseMatch at /polls/

2013-09-07 Thread voger
Hi everyone. I am trying to walk through the polls tutorial. I am stuck 
at the part 4 after the change of the views from function based to class 
based. A search in Google brought plenty results but none of them seems 
to be related exactly to this situation or maybe it is over my head to 
understand what is going on.

When I visit http://127.0.0.1:8000/polls/ i get


 NoReverseMatch at /polls/

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found.

Request Method: GET
Request URL:http://127.0.0.1:8000/polls/
Django Version: 1.5.2
Exception Type: NoReverseMatch
Exception Value:

Reverse for 'detail' with arguments '(1,)' and keyword arguments '{}' not found.

...

In 
template|/home/voger/PycharmProjects/mysite/polls/templates/polls/index.html|, 
error at line*4*



 Reverse for 'detail' with arguments '(1,)' and keyword arguments
 '{}' not found.

1   {% if latest_poll_list %}
2   
3   {% for poll in latest_poll_list %}
4   {{ poll.question }}
5   {% endfor %}
6   
7   {% else %}
8   No polls are available.
9   {% endif %}


The offending line is line number 4. The classes used are

class IndexView(generic.ListView):
template_name = 'polls/index.html'
context_object_name = 'latest_poll_list'

def get_queryset(self):
"""Return the last five published polls."""
return Poll.objects.order_by('-pub_date')[:5]

class DetailView(generic.DetailView):
model = Poll
template_name = 'polls/detail.html'

and in /polls/urls.py the urls are

urlpatterns = patterns('',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P\d+)/$', views.DetailView.as_view(), name='detail'),
url(r'^(?P\d+)/results/$', views.ResultsView.as_view(), 
name='results'),

url(r'^(?P\d+)/vote/$', views.vote, name='vote'),
)

Can someone please explain what is wrong?

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