Managing multiple user types in Django

2018-05-15 Thread Frankline
Hello Everyone,

I am developing an API based on Django Rest Framework
. Currently I have 4 user types i.e.
Buyer, Merchant, Insurer, and Admin.

The system I'm developing has an *API endpoint* and a *Dashboard* view.

Each of the above user types have different fields and may need to login to
the system at one point, so having one user model is the best way to go.
Note that, a user can only be of one type.

However, only the merchant will be actively using the API endpoint.

My question is then, how will I be able to manage the different user types
in the system?

My current options are:

1.

   1. class BaseUser(AbstractBaseUser):
   2. ...
   3.
   4. class Buyer(BaseUser):
   5. ...
   6.


   1. class Merchant(BaseUser):
   2. ...
   3.


   1. class Insurer(BaseUser):
   2. ...


2.


   1. from django.db import models
   2. from django.contrib.auth.models import User
   3.
   4. class Buyer(models.Model):
   5. user = models.OneToOneField(User)
   6.
   7. class Merchant(models.Model):
   8. user = models.OneToOneField(User)
   9.


   1. class Insurer(models.Model):
   2. user = models.OneToOneField(User)



   1. ...


Which is the most optimal way of handling this?

   1.

-- 
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/CAEAUGdVwB_RrOP_s9Oj5fe6AoOXJ9qpPLUKpE%2BbAO_NLGMRn6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


How to create a custom widget using django for use on external sites

2017-10-02 Thread Frankline
I hava a new site that I am working on. The site will have prior agreement
with eCommerce sites to include add-ons on their website.

Consider the following example:
My website, ABC.com is targeting ecommerce sites.
For every ecommerce site that sells product X, I want them to include an
add-on that gives buyers the option to purchase service Z if they so
desire.
ABC.com will be communicating with the ecommerce sites through a REST API.

My challenge is how to integrate my service as an add-on into the external
ecommerce sites. This I assume will be in the form of a widget, HTML code,
or a bit of javascript. Something similar to the attached image from
Amazon.com. I'm aiming to make a simple integration with the external sites
to avoid having them do too much on their end.

Is there a best practice on how to handle 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEAUGdWP9-ShhoUKoV3orP6wPAVhihHVxsGR7bYPZQn8T0goBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Looking for a good Django Forum

2015-09-04 Thread Frankline
Hi all,

Anyone know of a good forum that integrates nicely with django?
Specifically both the Forum and django app should use the same userbase.
Also something that is easy to integrate and theme.

I have been looking at both LBForum and DjangoBB.

Interested to hear from those who have actually implemented it.

./FO

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


Multiple User Roles design

2015-06-13 Thread Frankline
*Hi all,*

*I am creating a project that will require two different user roles: An
Instructor role and a Student role. Both will use a common login form. An
Instructor can assign a Student to a Course. Both will have access to
different parts of the system.*

*I wish to know the best way to model this. Currently I'm thinking of the
following:*

*1) Use a single User model having a user_type field*

*2) Create Instructor and Student model that both inherit from base User
model.*

*3) Create an Instructor and a Student group and then assign people to the
correct group based on some value at the time of registration.*

*Is there a better way to handle this apart from the above? What are the
best practices to follow in this case? Or perhaps add a UserProfile?*

*Regards,*
*Frankline*

-- 
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/CAEAUGdXR2n0XR6gV1fMbvHxMLAJryvo7n6gJJOE615z%3DVWwpJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to handle model constants

2015-02-23 Thread Frankline
The reason for my strategy here is because I will need to have a
multi-select instead of a single select for choosing the TaskStatus in the
form i.e. A *Task* can have one or more *TaskStatus*.

Moreover, I will again have to create another class, *SomeClass*, which has
a direct relation to the *Task* model, but can only be associated with only
one *TaskStatus *available from the pool of *TaskStatus*' that were
selected for that *Task*. (Not sure I'm making sense here)

So, YES, the class will be used to compute values based on the stored
constants.

On Mon, Feb 23, 2015 at 2:11 PM, James Schneider <jrschneide...@gmail.com>
wrote:

> For global constants, I would second the strategy that Mike outlined, and
> rename your constants in a more specific way, such as TASK_CANCELLED,
> TASK_COMPLETE, etc. unless of course CANCELLED can apply to more than just
> tasks.
>
> The use of a separate class to store such constants is of course viable,
> but seems like a bit of unnecessary complication if all it does is hold
> values. I wouldn't recommend it unless the class had other purposes such as
> returning computed values based on those stored constants.
>
> I usually store model choices directly in the model, since they don't
> generally apply anywhere else.
>
> Whatever you do, try to keep it consistent.
>
> -James
> On Feb 23, 2015 12:07 AM, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote:
>
>> On 23/02/2015 5:23 PM, Frankline wrote:
>>
>>> Hi all,
>>>
>>> I am getting confused regarding the use of constants and would be keen to
>>> know how the rest of you handle constants in your models. Ofcourse I
>>> could
>>> handle it easily similar to how it has been handled here:
>>> https://docs.djangoproject.com/en/1.7/ref/models/fields/#
>>> django.db.models.Field.choices
>>>
>>>
>> I have many many constants which are used across a number of modules and
>> apps.
>>
>> I store them in the __init__.py file of the namespace in which they are
>> used. Sensible naming of constants is vital of course and I'm careful to
>> store them alphabetically so I can find them easily enough scrolling
>> quickly through the file.
>>
>> At the top of my modules I say ...
>>
>> from  import CONST1, CONST2 etc
>>
>> Works for me
>>
>> Mike
>>
>>  But I wanted to put the constants in a separate class on their own. This
>>> is
>>> what I hav so far:
>>>
>>> models.py
>>>
>>> class TaskStatus(models.Model):
>>>
>>>  CANCELLED = 0
>>>  REQUIRES_ATTENTION = 1
>>>  WORK_IN_PROGRESS = 2
>>>  COMPLETE = 3
>>>
>>>  STATUS_TYPES = (
>>>  (CANCELLED, 'Cancelled'),
>>>  (REQUIRES_ATTENTION, 'Requires attention'),
>>>  (WORK_IN_PROGRESS, 'Work in progress'),
>>>  (COMPLETE, 'Complete'),
>>>  )
>>>
>>>  status = models.IntegerField(choices=STATUS_TYPES,
>>> default=REQUIRES_ATTENTION)
>>>  class Task(models.Model):
>>>  status = models.ManyToManyField(TaskStatus,
>>> default=TaskStatus.REQUIRES_ATTENTION)
>>>
>>>
>>> In my case, a Task can have one or more TaskStatus. I do not wish to
>>> store
>>> the TaskStatus in the database since they are simply constants.
>>>
>>> Does anyone have a better way of how I can approach 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/54EADFC3.3020301%40dewhirst.com.au.
>> 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/CA%2Be%2BciVgDVT2vreL41GjKBUV5MmxDWhwMWSM8Pg92-YCeNM

How to handle model constants

2015-02-22 Thread Frankline
Hi all,

I am getting confused regarding the use of constants and would be keen to
know how the rest of you handle constants in your models. Ofcourse I could
handle it easily similar to how it has been handled here:
https://docs.djangoproject.com/en/1.7/ref/models/fields/#django.db.models.Field.choices

But I wanted to put the constants in a separate class on their own. This is
what I hav so far:

models.py

class TaskStatus(models.Model):

CANCELLED = 0
REQUIRES_ATTENTION = 1
WORK_IN_PROGRESS = 2
COMPLETE = 3

STATUS_TYPES = (
(CANCELLED, 'Cancelled'),
(REQUIRES_ATTENTION, 'Requires attention'),
(WORK_IN_PROGRESS, 'Work in progress'),
(COMPLETE, 'Complete'),
)

status = models.IntegerField(choices=STATUS_TYPES,
default=REQUIRES_ATTENTION)
class Task(models.Model):
status = models.ManyToManyField(TaskStatus,
default=TaskStatus.REQUIRES_ATTENTION)


In my case, a Task can have one or more TaskStatus. I do not wish to store
the TaskStatus in the database since they are simply constants.

Does anyone have a better way of how I can approach 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/CAEAUGdX-eGA9mY5h%2Bj0yDHeFe_cX%3DP_i0ToRjp%2BDbRsDGCPaDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Unable to save object with images while using FormWizard in Django 1.7 and Python 3.4

2015-01-22 Thread Frankline
​Hi all​,
I am having a problem saving a Django form using the *FormWizard
*
while using *Django 1.7* and *Python 3.4*. Below is my code:

*models.py*

...class Advert(models.Model):
... # Some irelevant code removed for brevity
owner = models.ForeignKey(settings.AUTH_USER_MODEL, db_index=True,
blank=False, null=False)
title = models.CharField(_("Title"), max_length=120)
description = models.TextField(_("Description"), default='')
category = models.ForeignKey(AdCategory, db_index=True,
related_name='ad_category', verbose_name=_('Category'))
status = models.IntegerField(choices=ADVERT_STATES, default=0)
adtype = models.IntegerField(choices=ADTYPES, default=1)
price = models.DecimalField(_('Price'), max_digits=12,
decimal_places=2, blank=True, default=0,
help_text=_('Price'),
validators=[MinValueValidator(0)])
...class AdvertImage(models.Model):

def generate_new_filename(instance, filename):
IMAGE_UPLOAD_DIR = "advert_images"
old_fname, extension = os.path.splitext(filename)
return '%s/%s%s' % (IMAGE_UPLOAD_DIR, uuid.uuid4().hex, extension)

advert = models.ForeignKey(Advert, related_name='images')
image = models.ImageField(upload_to=generate_new_filename,
null=True, blank=True)


*forms.py*

from django.forms.models import inlineformset_factoryfrom django
import formsfrom django.forms import ModelForm, RadioSelect, TextInput
from .models import Advert, AdvertImage

class AdvertCategoryForm(ModelForm):

class Meta:
model = Advert
fields = ('category',)

class AdvertDetailsForm(ModelForm):

class Meta:
model = Advert
fields = ('title', 'description', 'location', 'adtype', 'price')

class AdvertImageForm(ModelForm):

class Meta:
model = AdvertImage
fields = ('image',)

AdvertImageFormset = inlineformset_factory(Advert, AdvertImage,
fields=('image',), can_delete=False, extra=3, max_num=3)


FORMS = [("ad_category", AdvertCategoryForm),
 ("ad_details", AdvertDetailsForm),
 ("ad_images", AdvertImageFormset)]

TEMPLATES = {"ad_category": "adverts/advert_category_step.html",
 "ad_details": "adverts/advert_details_step.html",
 "ad_images": "adverts/advert_images_step.html"}


*views.py*

...class AdvertWizard(LoginRequiredMixin, SessionWizardView):

form_list = FORMS
file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT))

def get_template_names(self):
return [TEMPLATES[self.steps.current]]

...

def done(self, form_list, **kwargs):
advert = Advert()
"""for form in form_list:for field, value in
form.cleaned_data.iteritems():setattr(advert, field,
value)"""

form_dict = {}
for form in form_list:
form_dict.update(form.cleaned_data)

advert.owner = self.request.user
advert.save()
redirect(advert)


​The problem occurs in the done method while saving the form:

ValueError at /ads/new

dictionary update sequence element #0 has length 3; 2 is required

Request Method:POSTRequest URL:http://localhost:8000/ads/newDjango Version:
1.7.1Exception Type:ValueErrorException Value:

dictionary update sequence element #0 has length 3; 2 is required

Exception 
Location:/home/frank/Projects/python/django/pet_store/src/petstore/apps/adverts/views.py
in done, line 147Python Executable:
/home/frank/.virtualenvs/petstore/bin/pythonPython Version:3.4.0

   -
   
/home/frank/Projects/python/django/pet_store/src/petstore/apps/adverts/views.py
in done
   1.

  form_dict.update(form.cleaned_data)

  ...
   ▶ Local vars 

However, when I replace the following code:

form_dict = {}
for form in form_list:
form_dict.update(form.cleaned_data)

with this one

for form in form_list:
for field, value in form.cleaned_data.iteritems():
setattr(advert, field, value)

I now get the following error:

AttributeError at /ads/new

'dict' object has no attribute 'iteritems'

Request Method:POSTRequest URL:http://localhost:8000/ads/newDjango Version:
1.7.1Exception Type:AttributeErrorException Value:

'dict' object has no attribute 'iteritems'

Exception 
Location:/home/frank/Projects/python/django/pet_store/src/petstore/apps/adverts/views.py
in done, line 140Python Executable:
/home/frank/.virtualenvs/petstore/bin/pythonPython Version:3.4.0Python Path:

['/home/frank/Projects/python/django/pet_store/src/petstore',
 '/home/frank/.virtualenvs/petstore/lib/python3.4',
 '/home/frank/.virtualenvs/petstore/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/frank/.virtualenvs/petstore/lib/python3.4/lib-dynload',
 '/usr/lib/python3.4',
 '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/home/frank/.virtualenvs/petstore/lib/python3.4/site-packages'


Re: Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Frankline
Nicely answered.

Thanks Andreas.

On Thu, Dec 18, 2014 at 3:27 PM, Andreas Kuhne <andreas.ku...@suitopia.com>
wrote:
>
> Hi Frankline,
>
> You can only reference variables in the templates directly with the
> blocktrans tag. See
> https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#blocktrans-template-tag.
> So you have to use the "with" statement on blocktrans to access properties
> of a class.
>
> Regards,
>
> Andréas
>
> 2014-12-18 13:16 GMT+01:00 Frankline <fraogo...@gmail.com>:
>
>> Hi all,
>>
>> I recently had a weird problem in my django templates regarding
>> evaluating variables within a blocktrans, but I finally figured it out. I
>> guess I just want to know the reason why it worked, an explanation sort of.
>>
>> THIS DID NOT WORK
>> {% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %}
>>
>> HOWEVER, THIS WORKED
>> {% blocktrans with objects.count as objects_count%}Approve all {{
>> objects_count }} users{% endblocktrans %}
>>
>> Can someone explain to me the reason behind why the last code statement
>> worked as opposed to the first one?
>>
>> Thanks.
>>
>> With Regards,
>> Frankline
>>
>> --
>> 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/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> 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/CALXYUbkfrmAUShH_VSbw8s0ih-8V21zWQ3FfwQCHVcaDum91qg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CALXYUbkfrmAUShH_VSbw8s0ih-8V21zWQ3FfwQCHVcaDum91qg%40mail.gmail.com?utm_medium=email_source=footer>
> .
> 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/CAEAUGdVpUOHS%2Br2EuH6BYTawdPvhPuLvcGe7xxc5P-p7rHZe5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Evaluating variables in a blocktrans block within templates

2014-12-18 Thread Frankline
Hi all,

I recently had a weird problem in my django templates regarding evaluating
variables within a blocktrans, but I finally figured it out. I guess I just
want to know the reason why it worked, an explanation sort of.

THIS DID NOT WORK
{% blocktrans %}Approve all {{ objects.count }} users{% endblocktrans %}

HOWEVER, THIS WORKED
{% blocktrans with objects.count as objects_count%}Approve all {{
objects_count }} users{% endblocktrans %}

Can someone explain to me the reason behind why the last code statement
worked as opposed to the first one?

Thanks.

With Regards,
Frankline

-- 
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/CAEAUGdX5it8Z3kLGKOspGZj%3DY%3DkstNeLHLvySGtogLXEOO58HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Making a field Read-Only in Django

2014-11-16 Thread Frankline
Hi all,

I'm running Django 1.7 and Python 3.4. I'm trying to make the username
field of my custom model to be read-only. I think this is usually set in
the form. Below is what I currently have in my *forms.py*

class AuthUserChangeForm(UserChangeForm):
"""
A form for updating users. Includes all the fields on the user, but
replaces the password field with admin's password hash display field.
"""
password = ReadOnlyPasswordHashField(label="password",
 help_text="""Raw passwords are not
stored, so there is no way to see this
 user's password, but you can
change the password using 
 this form""")

class Meta:
model = AuthUser
fields = ('username', 'email', 'password', 'is_active', 'is_staff',
'is_superuser', 'user_permissions')
widgets = {
'username': TextInput( attrs={'readonly':'readonly'} ),
'email': TextInput(),
}

def clean_username(self):
# Regardless of what the user provides, reset field to initial value
# Not appropriate to change usernames once set.
return self.initial["username"]

def clean_password(self):
# Regardless of what the user provides, return the initial value.
# This is done here, rather than on the field, because the field
does
# not have access to the initial value
return self.initial["password"]


What I'm I missing here?

-- 
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/CAEAUGdVbcmJcLp-j292v8c%2BNA9PS7z%3DN5kAKST84hC9jHfb0cQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


AUTH_USER_MODEL does not accept sub application

2014-10-27 Thread Frankline
I am having problems with my custom user model while using Django 1.7.1 and
Python 3.4.
I have declared a Custom user model in an apps.users.AuthUser. I then have
another application (apps.pets) that will use the AuthUser as a ForeignKey
in a Pet model. See below:

class Pet(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, db_index=True,
blank=False, null=False)

This is my scenario:

In my INSTALLED_APPS I have: "apps.users"

If I set AUTH_USER_MODEL="apps.users.AuthUser" the exception is raised when
I run 'runserver':
  File
"/home/frank/.virtualenvs/myproj/lib/python3.4/site-packages/django/contrib/auth/checks.py",
line 12, in check_user_model
cls = apps.get_model(settings.AUTH_USER_MODEL)
  File
"/home/frank/.virtualenvs/myproj/lib/python3.4/site-packages/django/apps/registry.py",
line 201, in get_model
app_label, model_name = app_label.split('.')
ValueError: too many values to unpack (expected 2)


If I set AUTH_USER_MODEL="users.AuthUser" the exception is raised when I
run migrate:
  File
"/home/frank/.virtualenvs/myproj/lib/python3.4/site-packages/django/db/migrations/state.py",
line 89, in render
model=lookup_model,
ValueError: Lookup failed for model referenced by field pets.Pet.owner:
users.AuthUser

Similar issue reported here I guess:
https://code.djangoproject.com/ticket/19845


Does this mean that in AUTH_USR_MODEL setting I have to use
'app_label.model_name' instead of 'apps.app_label.model_name.'? Is there a
workaround for 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/CAEAUGdWox3RoTRMvY2CxU94RCe3bRzUKPFKWx1ERderyVL9f8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django 1.7 User login via Email or Username

2014-10-15 Thread Frankline
Hi all,

Just started looking at Django 1.7. I've followed the tutorials on
https://docs.djangoproject.com/en/1.7/.

However, I find myself in a position where I need to login users based on
either email or username, AND NOT just the username. I want my users to
register using email addresses. This presents some issues with the standard
Django user implementation since the authentication backend is still going
to look for the username when logging in.

I am keen to know how developers here implement this in their own Django
1.7 projects. And also what user models are preferable: AbstractUser or
AbstractBaseUser.

Any links to example tutorials will also be greatly appreciated.

Regards,
Frankline

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


How to implement chained/related dropdown lists in a page

2014-10-07 Thread Frankline
I am interested in knowing how other developers implement chained dropdown
lists that are dependent on one another. As an example, I have a page/form
that has two dropdown lists. When I select a value from the first select, I
want the second dropdown to be populated by records related to the first
one. This is more of a Country/City situation. Below is how my models look
like.

#models.py
class Category(models.Model):
description = models.CharField(max_length=100)

class SubCategory(models.Model):
description = models.CharField(max_length=100)
category = models.ForeignKey(Category)

I am guessing I will have to involve ajax in one way or the other. Anyone
has an idea on how to implement 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/CAEAUGdVbxWnRRf%2BPuvzNDNei0yinKL__9f_DWekprM_9HRSMfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Forcing Django to use INNER JOIN instead of LEFT OUTER JOIN

2014-07-24 Thread Frankline
I have implemented search in my Django application to allow searching by
more than one field. This results in Django always using a LEFT OUTER JOIN,
which in my case generates the wrong results. However, when I change the
SQL generated from a LEFT OUTER JOIN to an INNER JOIN, it returns the
correct result.

I am thinking it has to do with the way Q object in my code below.

from django.db import models, transaction...def construct_search(field_name):
if field_name.startswith('^'):
return "%s__istartswith" % field_name[1:]
elif field_name.startswith('='):
return "%s__iexact" % field_name[1:]
elif field_name.startswith('@'):
return "%s__search" % field_name[1:]
else:
return "%s__icontains" % field_name

class CoreSearchMixin(object):
"""Subclasses must define search_fields = [field_1, ...field_n]
where the field is a string, the name of a field, and can contain
the following prefix characters:

'^': the search field must start with the search term, case insensitive
'=': the search field must exactly equal the search term, case insensitive
'@': full-text search

If no prefix is given, any string that contains the search field will match.
"""
search_fields = None
search_form_class = SearchForm

@cachedproperty
def search_form(self):
return self.search_form_class(getattr(self.request,
self.request.method))

def get_query_help_message(self):
"""Returns a comma separated list of fields that are used in
the search, to help the user
create a search.
"""
fields = []
if self.search_fields:
for search_field in self.search_fields:
field = get_field_from_path(self.model, search_field)
fields.append(field.verbose_name.title())
return ",".join(fields)

def get_filtered_queryset(self, queryset):
if self.search_form.is_valid():
self.query = self.search_form.cleaned_data['q']
else:
self.query = None
if self.search_fields and self.query:
orm_lookups =
(construct_search(str(search_field).replace('.', '__'))
   for search_field in self.search_fields)
chained_or_queries = None
for bit in self.query.split():
or_queries = (models.Q(**{orm_lookup: bit})
  for orm_lookup in orm_lookups)
if chained_or_queries:
chained_or_queries =
itertools.chain(chained_or_queries, or_queries)
else:
chained_or_queries = or_queries
return queryset.filter(reduce(operator.or_, chained_or_queries))
else:
return queryset

def get_context_data(self, **kwargs):
return super(CoreSearchMixin, self).get_context_data(
search_form=self.search_form,
query_help_message=self.get_query_help_message(),
search_fields=self.search_fields,
**kwargs
)

How can I ensure that an INNER JOIN is used instead of a LEFT OUTER JOIN in
the case of my code above?


http://stackoverflow.com/questions/24927062/forcing-django-to-use-inner-join-instead-of-left-outer-join

-- 
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/CAEAUGdVL7sJQsmh8WEC%3Dp031dL%3D-YF8mg5c_kvFyjCSAPwVxNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: looking for a good tutorial for creating user with fb,tw,google login

2014-07-19 Thread Frankline
Have you tried django-allauth?

http://django-allauth.readthedocs.org/en/latest/


On Sun, Jul 20, 2014 at 6:25 AM, Bussiere  wrote:

> I am looking for a good tutorial on how to log user with fb,tw, google and
> record them in db.
>
> I've tried python-social-auth and this tutorial but it's a pain and it's
> not recording user
>
> https://www.artandlogic.com/blog/2014/04/tutorial-adding-facebooktwittergoogle-authentication-to-a-django-application/
>
> i'am near nervous brekdown and it's a pain in the ash.
>
> Regards
> Bussiere
>
>  --
> 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/2769cb04-3bcc-4129-a695-65e7704fa9e4%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/CAEAUGdU-a4aWDVi9n3gNdhjc0_uBXn9FTB%3DNw23YcE6mzWYmww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Instantiating a ModelForm with initial values in CBVs

2014-06-14 Thread Frankline
I am a Django newbie working with Django CBVs and having difficulty setting
initial values for my ModelForm. To give an overview, I am trying to learn
by creating a simple messaging app.

Here is my code:

models.py
-

import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone

class Message(models.Model):
subject = models.CharField(_("Subject"), max_length=100)
body = models.TextField(_("Body"))
sender = models.ForeignKey(User, db_index=True,
related_name='sent_messages')
recipient = models.ForeignKey(User, db_index=True,
related_name='received_messages')
parent_msg = models.ForeignKey('self', related_name='next_messages',
null=True, blank=True)


forms.py
---

from django.forms import ModelForm
from .models import Message

class MessageForm(ModelForm):
class Meta:
model = Message
exclude = ('sender', 'recipient', 'parent_msg',)


views.py
--

class MessageCreateView(CreateView):
form_class = MessageForm
model = Message
template_name = 'messages/compose.html'

def form_valid(self, form):
form.instance.sender = self.request.user
return super(MessageCreateView, self).form_valid(form)

urls.py
---

...
url(r'^compose/(?P[\w.@+-]+)/$', MessageCreateView.as_view(),
name='messages_compose_to'),
...

As you can see from the urls.py file, I am using the 'recipient' parameter
as such: http://localhost:8000/members/compose/someusername

Now my problem is that I wish to open the compose message view, and
initialize the recipient field by getting the username from the URL, then
using the username from the url to get User with that particular username,
and instantiate the form with it.

Where do I do this, in the view itself or in the form? Unless their is a
better way of how to handle 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/CAEAUGdUGugEimEjjV%3DN-ue1403m3XBF67FEwijKUzQVSJ31T_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django authentication by email

2014-05-15 Thread Frankline
Hi all,

I am thinking of developing a web application where users will have to
login by their email address instead of using their usernames.

Now I know I can do this by writing my own auth backend, but I'm just
curious how the rest of you handle this. Do you normally use third party
packages to handle this instead of writing a custom backend? If so, what
packages would you recommend that are actively maintained?

Any disadvantages to writing my own custom backend?

Thanks.

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


Re: Digging Up Django Class-based Views

2014-02-16 Thread Frankline
Hi Leo,

I have struggled to understand CBVs before and avoided using them most of
the time. I looked into your posts and it has been very useful. Written in
clear simple English. Now I can't wait to use them in my current and next
projects.

:-)

Thank you.

Frank


On Fri, Feb 14, 2014 at 4:11 PM, Leonardo Giordani <
giordani.leona...@gmail.com> wrote:

> Hi all,
>
> the third issue of the small series "Digging Up Django Class-based Views"
> is out.
> This latest post is about form views.
>
> You find the whole series here
>
> http://lgiordani.github.io/blog/categories/django/
>
> I hope you will find it interesting and useful.
>
> Cheers,
>
> Leo
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
> --
> 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/CAEhE%2BO%3Db8ApXRSwLEmMXf%3D_XMtRDv78uZO-SMr1jzcUQuYsqjw%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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


Re: No settings file in Django tutorial.

2013-09-23 Thread Frankline
You are trying to change directory through a file i.e. settings.py. This is
obviously not a directory but a file. In any case, it does not exist within
that directory level.

What you need to do is:
$ cd winker
$ ls

And you will see your setting file

I am assuming your directory structure is as follows:

winker
|
|- manage.py
|- winker
|
|- settings.py
|- urls.py
|- wsgi.py

Note that there are two winker directories. Pay attention to the current
directory that you are located in.


On Mon, Sep 23, 2013 at 1:09 PM, Avril Lang  wrote:

> Newb needs some help making the tutorial go
>
> As you can see here I can create a new project and run the server but the
> only file in my project is manage.py. Where is "settings.py" and how can I
> get it in the proper location?
>
> Last login: Mon Sep 23 09:19:47 on ttys000
> new-host:~ avrillang$ django-admin.py startproject winker
> new-host:~ avrillang$ winker/
> -bash: winker/: is a directory
> new-host:~ avrillang$ cd winker
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ python manage.py runserver
> Validating models...
>
> 0 errors found
> September 23, 2013 - 04:28:51
> Django version 1.5.4, using settings 'winker.settings'
> Development server is running at http://127.0.0.1:8000/
> Quit the server with CONTROL-C.
> [23/Sep/2013 04:28:59] "GET / HTTP/1.1" 200 1957
> ls winker
> ^Cnew-host:winker avrillang$
> new-host:winker avrillang$ ls
> manage.pywinker
> new-host:winker avrillang$ cd settings.py
> -bash: cd: settings.py: No such file or directory
>
> --
> 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: ANNOUNCE: Django 1.6 alpha 1 released

2013-05-26 Thread Frankline
Swt!


On Mon, May 27, 2013 at 7:30 AM, Jacob Kaplan-Moss wrote:

> Hi folks --
>
> I'm pleased to announce that we've just released Django 1.6 alpha 1,
> the first in our series of preview releases leading up to Django 1.6
> (due in August).
>
> More information can be found on our blog:
>
> https://www.djangoproject.com/weblog/2013/may/26/django-16-alpha-1/
>
> And in the release notes:
>
> https://docs.djangoproject.com/en/dev/releases/1.6/
>
> Thanks!
>
> Jacob
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Creating a Djang Webpage

2013-04-16 Thread Frankline
Google is your friend.

An example:
http://stackoverflow.com/questions/5871730/need-a-minimal-django-file-upload-example


On Tue, Apr 16, 2013 at 3:48 PM, Augusto Santos
wrote:

> Hey guys,
>
> So, I am new in Django framework and I would know how to make a simple
> page with this powerful tool. I have alredy read part of the tutorial at
> django's site and read a little bit of the documentation. However, a friend
> of mine told me that the latest version of Django, that is 1.5.1, have
> little documentation, so I started using 1.4.5.
> What I need is to make a simple webpage for my final project and I need a
> page that have just one button to make uploads, the code that would be
> uploaded will be compiled and the user who is uploading would received an
> image of the file compiled. About the compilation is with me :)
> The problem that I am facing is that I am not finding any document
> straightfoward to what I want. I don't want to use a template of a blog.
> Actually, I nedd a simple template that I would put a button to make an
> upload. What do you advice me to do? What should I read? I downloaded the
> ebook "Sam teached you Django in 24hours" Is it good? I really need help!!!
> I need to make it faster!
>
> I am grateful for your help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Webfaction vs DigitalOcean

2013-04-03 Thread Frankline
I love the simplicity of Webfaction and I'm happy with it.


On Wed, Apr 3, 2013 at 1:10 PM, frocco  wrote:

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

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




Re: What are the steps to build a website?

2013-03-25 Thread Frankline
My advice: Stop making resolutions and just start something. You will be
happier if you do. Along the way, you'll have gained an understanding of
your project to so much more. That is how I learned.

Do not be afraid to make mistakes along the way.

On Mon, Mar 25, 2013 at 2:58 PM, Tim Cook  wrote:

> You obviously have a lot of questions, with a lot of variability in the
> answers.
> I highly recommend: https://django.2scoops.org/
>
> --Tim
>
>
> On Mon, Mar 25, 2013 at 8:17 AM, Benjamin Marsili
>  wrote:
> > Hey everyone,
> >
> > I am trying to design a website from scratch using django, it's my first
> > time using it and I read the basic tutorials. Now it's time to get things
> > done and I wonder where to begin. I don't want to make design mistakes.
> >
> > Let's take an internet website for example. There would be a planning and
> > user accounts (at least).
> >
> > 1) Should I create 2 apps, one for user accounts and one for the
> planning?
> > If yes, the rest of the code (templates, login page and other basic
> pages)
> > should go in the project and not in an app?
> >
> > 2) Should I start by creating templates for the look of the website? Or
> > should I populate and test the DB models first?
> >
> > 3) Where would the generic code go? For example if I want to share a
> > function that will return the HTML header, do I have to copy it in each
> app?
> >
> > If you have guidelines to get a project going around django please share
> > them here!
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> 
> Timothy Cook, MSc   +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Django Framework Biginer guide please

2013-01-30 Thread Frankline
Just a question:

How is Putty and OpenERP relevant to the question?

In the meantime, you can start here: https://docs.djangoproject.com/en/1.4/

On Wed, Jan 30, 2013 at 12:49 PM, Vikas Yewale  wrote:

> I am new in Django-Python.so want guide to develope web based application
> using Django framework.
>
> I Have  :
>   OS- UBUNTU , Putty  , Open ERP.
>   so please guide me Softwre requirement to develope django web
> based Apps.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Django hosting companies

2013-01-29 Thread Frankline
Have you tried webfaction? Very easy to setup.

On Tue, Jan 29, 2013 at 4:30 PM, Gustavo Andres Angulo wrote:

> There is a similar solution to Heroku, called nuagehq.com
>
>
>
> regards
>
> On Tue, Jan 29, 2013 at 8:17 AM, francislutalo 
> wrote:
> > Anyone with an idea of which are the best companies to host my django
> > applications?
> >
> >
> >
> > Thank you,
> > Regards
> > francislutalo
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users?hl=en.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: webhosting for django projects with SQLite

2013-01-25 Thread Frankline
+1 for Webfaction. Simple to use. Though I'm using Postgres, SQLite can
also be used IMO.

On Sat, Jan 26, 2013 at 8:31 AM, william ratcliff <
william.ratcl...@gmail.com> wrote:

> I'll second webfaction, but just curious--why SQLite?   They make Postgres
> not so hard to set up...
>
>
> On Sat, Jan 26, 2013 at 12:02 AM, Carlos Daniel Ruvalcaba Valenzuela <
> clsdan...@gmail.com> wrote:
>
>> I can only speak for what I have tried, Webfaction can be an option
>> that supports what you want and is a simple as regular hosting, if you
>> are going for the cheap vps route any will do as you have direct
>> control over the python install, modules or virtualenv in the server.
>>
>> Regards,
>> Carlos Ruvalcaba
>>
>> On Fri, Jan 25, 2013 at 9:44 PM, Dandan  wrote:
>> > Which webhosting services support django and SQLite?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/django-users?hl=en.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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




Re: Django CRM Tool

2013-01-15 Thread Frankline
I've just seen the koalixcrm. Nice interface.

On Wed, Jan 16, 2013 at 12:05 AM, scaphilo  wrote:

> Hi
> Well this thread is a bit outdated but as you have not had any answers yet.
>
> Insted of starting from scratch you could perhaps start with
> www.koalix.org
> https://github.com/scaphilo/koalixcrm
> Its open source and under BSD licsense. So you can use it, modify it and
> sell it.
>
>
>
>
> Am Samstag, 2. Juni 2012 19:00:49 UTC+2 schrieb Zeeshan Syed:
>
>> Hey everyone,
>>
>> I've been asked to create a CRM tool using Django. Just wondering what
>> route I should take. Would it be wise to start from scratch? Should I
>> play around with Django admin and mess around with that? I've looked
>> at the django-crm project, has anyone had any experience with that?
>>
>> Any help is much appreciated.
>>
>> Thanks,
>> Zee
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/V9NsFL6ObhwJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Happy new year

2013-01-01 Thread Frankline
Happy new year from Kenya.
On Jan 2, 2013 9:41 AM, "Vibhu Rishi"  wrote:

> Happy new year from India !
>
> Keep Djangoing !
>
> V.
>
> On Wed, Jan 2, 2013 at 4:56 AM, Elena Williams  wrote:
>
>> Happy New Year from to all the Djangonauts from stonking hot Australia!
>>
>> I hope everyone's Django projects are awesome and plentiful this year!
>>
>> Go you smart, creative Django folk!
>> ---
>> Elena :)
>> @elequ
>>
>> On Wed, Jan 2, 2013 at 4:30 AM, Sultan Imanhodjaev <
>> sultan.imanhodj...@gmail.com> wrote:
>>
>>> Жаңы жылыңыздар менен!
>>>
>>>
>>>
>>> Sultan, Bishkek Kyrgyzstan.
>>>
>>>
>>> On Tue, Jan 1, 2013 at 10:33 PM, Mark Phillips <
>>> m...@phillipsmarketing.biz> wrote:
>>>
 Happy New Year from Arizona!

 Mark
 On Jan 1, 2013 9:25 AM, "Amirouche" 
 wrote:

> Bonne année, paix et prosperités!
>
> Amirouche from Paris, FRANCE.
>
> On Monday, December 31, 2012 10:42:13 PM UTC+1, cingusoft wrote:
>>
>> Happy new year from spain to all django lovers.
>> I wish you a new year with tons of django projects.
>>
>> Cheers
>> Cingusoft
>> BlackBerry de movistar, allí donde estés está tu oficin@
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/He2t7vHzrBAJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To post to this group, send email to django-users@googlegroups.com.
 To unsubscribe from this group, send email to
 django-users+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/django-users?hl=en.

>>>
>>>
>>>
>>> --
>>> Kind regards,
>>> Sultan Imanhodjaev
>>> +996 559 06 76 06
>>> PGP 0x4E357296
>>> http://imanhodjaev.com
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> --
> Simplicity is the ultimate sophistication. - Leonardo da Vinci
> Life is really simple, but we insist on making it complicated. - Confucius
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Problem with django sitemap

2012-12-17 Thread Frankline
But the sites framework has already been installed, as you can see from my
settings file.

On Tue, Dec 18, 2012 at 10:44 AM, Sandeep kaur <mkaurkha...@gmail.com>wrote:

> On Sun, Dec 16, 2012 at 10:55 PM, Frankline <fraogo...@gmail.com> wrote:
> >
> > I'm having a problem implementing the sitemaps in my application. I'm
> 
> >
> > ImportError at /sitemap.xml
> >
> > No module named django.contrib.sitemaps
> >
> > Request Method: GET
> > Request URL: http://localhost:8000/sitemap.xml
> > Django Version: 1.4.2
> > Exception Type: ImportError
> > Exception Value:
> >
> > No module named django.contrib.sitemaps
> >
> > Exception Location:
> > /home/frank/Projects/python/django/
> techjobsea.com/baseline27/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.py
> > in import_module, line 35
> > Python Executable:
> > /home/frank/Projects/python/django/techjobsea.com/baseline27/bin/python
> > Python Version: 2.7.3
> >
>
> Are you sure, you followed all the installation steps, especially step 3
> in :
>
> https://docs.djangoproject.com/en/dev/ref/contrib/sitemaps/
>
>
> --
> Sandeep Kaur
> E-Mail: mkaurkha...@gmail.com
> Blog: sandymadaan.wordpress.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Problem with django sitemap

2012-12-17 Thread Frankline
Anyone???

On Sun, Dec 16, 2012 at 8:25 PM, Frankline <fraogo...@gmail.com> wrote:

> I'm having a problem implementing the sitemaps in my application. I'm
> using Virtualenv, django 1.4 and Python 2.7. I would appreciate if you
> can help me resolve this.
>
> This is what I have done:
>
> 1. In my *urls.py*
>
> from sitemap import JobPostSitemap
> sitemaps = {
> 'jobs': JobPostSitemap,
> }
> ... # Removed other urls
> url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
> {'sitemaps': sitemaps}),
>
> 2. Then in my *sitemap.py* file
>
> from django.contrib.sitemaps import Sitemap
> from jobs.models import JobPost
>
> class JobPostSitemap(Sitemap):
> changefreq = "never"
> priority = 0.5
>
> def items(self):
> return JobPost.objects.filter(approved=True)
>
> def lastmod(self, obj):
> return obj.pub_date
>
>
> 3. My *settings.py* file is as follows:
>
> ...
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.sitemaps',
> 'jobs',
> )
> ...
>
> Now when I open my browser and navigate to *http://localhost**
> :8000/sitemap.xml* , I get the following error:
>
>
> ImportError at /sitemap.xml
>
> No module named django.contrib.sitemaps
>
>  Request Method: GET  Request URL: http://localhost:8000/sitemap.xml  Django
> Version: 1.4.2  Exception Type: ImportError  Exception Value:
>
> No module named django.contrib.sitemaps
>
>  Exception Location: /home/frank/Projects/python/django/
> techjobsea.com/baseline27/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.pyin
>  import_module, line 35  Python
> Executable: /home/frank/Projects/python/django/
> techjobsea.com/baseline27/bin/python  Python Version: 2.7.3

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



Using Emails to authenticate

2012-11-04 Thread Frankline
Hi all,

I guess this question has been asked here a couple of times but I'm going
to ask it anyway.

I'm developing a Django application/website and I have a need to use the
email for authentication instead of username. I'm more keen to find out how
you handle the following:

- The default length of the email field
- Ensuring that the email field remain unique
- Making/Synchronizing the changes with the database

I'm more biased towards handling this myself rather than using the
available packages out there.

Does any one have a pointer to a link on how this is handled?

Thanks.

Regards,
F. O. O.

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



Re: To Use or Not to Use the admin backend

2012-09-03 Thread Frankline
An example use case is if I need an admin backend with features for reports
and graphs, aside from other site configurations.


On Tue, Sep 4, 2012 at 4:48 AM, Barry Morrison <bdmorri...@gmail.com> wrote:

> My $.02 cents.  It's great to have around while you're working, but my
> n00b experience taught me it left a lot to be desired so I rolled my own
> for the last two projects I built.
>
> FWIW, a local dev gave this quick presentation, and they did an incredible
> job on hacking the default admin
> https://speakerdeck.com/u/pamelafox/p/django-admin-widgetry-and-witcherybut 
> she has also said that she's working on a custom admin
>
> So my advice. Use it as the tool that it is. Build what it can't do, don't
> spend more time on it than you have to.
>
> On Monday, September 3, 2012 8:38:24 AM UTC-7, Frankline wrote:
>>
>> Hi,
>>
>> I'm creating a site in Python/Django and feel that the admin backend, as
>> good as it is, may not be a one-fit-for-all situations.
>>
>> My question is this:
>>
>> Have any of you ever had a need to have a custom admin backend?
>>
>> In what example situations would one create his/her own admin backend
>> rather than using the default admin panel that ships with Django?
>>
>> What are the disadvantages of rewriting your own backend?
>>
>> Regards,
>> Frank
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/edKRzxuuHaIJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



To Use or Not to Use the admin backend

2012-09-03 Thread Frankline
Hi,

I'm creating a site in Python/Django and feel that the admin backend, as
good as it is, may not be a one-fit-for-all situations.

My question is this:

Have any of you ever had a need to have a custom admin backend?

In what example situations would one create his/her own admin backend
rather than using the default admin panel that ships with Django?

What are the disadvantages of rewriting your own backend?

Regards,
Frank

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



Starting a Django Project the Right Way

2012-07-26 Thread Frankline
Hi all,

I found this on the internet and thought I should share it.

http://www.jeffknupp.com/blog/2012/02/09/starting-a-django-project-the-right-way/

By the end of it all, you should have:

1. A fully functional Django project
2. All resources under source control (with git)
3. An environment independet install of your project (using virtualenv)
4. Automated deployment and testing (using Fabric)
5. Automatic database migrations (using South)
6. A solid start to your new site


Regards,
Frankline

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



Re: Advices on what web programming language used in template?

2012-07-03 Thread Frankline
Hi Yu,

Your question is not really clear. Perhaps take a look at this:
https://docs.djangoproject.com/en/dev/topics/templates/

Since you have mentioned JSP, I'm thinking you are looking at Python/Django
alternatives. If that is the case, then you have the following alternatives:

- Ruby on Rails
- PHP
- Java/JSP/Spring or Struts and even JSF

But then again, it would help if you were more clear on what you need. This
is 'mostly' a Django forum.

Regards,
Frankline

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



Re: New to Django, need help starting

2012-06-20 Thread Frankline
Have you tried 'python django-admin.py startproject iFriends'

Make sure your python path installation can be found.

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



Re: I need a programmer Python Django

2012-06-14 Thread Frankline
It would be best if you listed the requirements or at the very least what
the app is all about.

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



Re: Django-registration tutorial + code

2012-05-16 Thread Frankline
This link should provide a few pointers, though a bit old.

http://www.djangobook.com/en/beta/chapter12/

F.O.O

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



Re: Help - Which IDE is best to use.

2012-05-16 Thread Frankline
@yati : True. I believe the following links should answer and, hopefully,
 close the discussion:

http://stackoverflow.com/questions/126753/is-there-a-good-free-python-ide-for-windows

http://stackoverflow.com/questions/81584/what-ide-to-use-for-python

Regards,
F.O.O.

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