Django Logical Deletes on Models

2015-08-04 Thread psychok7


So i decided to fork pinax-models because i need the capability of soft 
deleting objects and their related (setting a flag but not really deleting 
them). This is a project that seems to be unmaintained , so i diged into 
the code and i am trying to make some improvements.


It basically fetched the objects, looks for its related and then saves the 
date_removed to fake the deletion.

It still has some issues and one of them which i am trying to solve is that 
it always "cascades" the deletes of the related but it should only do it if 
the related field is not nullable. if its nullable then it should not 
delete the related field.


I have 2 question regarding this matter ( i  am using Django 1.7):

1- How can i improve this code below to support that feature? I know it has 
something to do with _meta, thought about using 
`obj._meta.get_fields_with_model` but i am afraid it does not do 
`options.concrete_fields 
+ options.many_to_many + options.virtual_fields`. i was thinking about 
getting  all the existing fields in a model an then evaluate if its a 
foreign key to a certain model class and then check if 
`obj._meta.get_field('something').null`. Is this the right approach??


2 - The original author is using self._meta.get_all_related_objects() but 
in the _metadocumentation i saw other functions like for example 
get_all_related_many_to_many_objectsso do i need to add that validation to 
the code as well or self._meta.get_all_related_objects() is enough ??


I am trying to improve this and push it to my pinax-models fork so any help 
would be appreciated.

code:


class CustomLogicalDeleteModel(LogicalDeleteModel):

def delete(self):
# Fetch related models
related_objs = [
relation.get_accessor_name()
for relation in self._meta.get_all_related_objects()
]

for objs_model in related_objs:

if hasattr(self, objs_model):
local_objs_model = getattr(self, objs_model)
if hasattr(local_objs_model, 'all'):
# Retrieve all related objects
objs = local_objs_model.all()

for obj in objs:
# Checking if inherits from logicaldelete
if not issubclass(obj.__class__, LogicalDeleteModel):
break
obj.delete()
else:
obj = local_objs_model

if not issubclass(obj.__class__, LogicalDeleteModel):
break
obj.delete()

# Soft delete the object
self.date_removed = datetime.datetime.now()
self.save()

class Meta:
abstract = True

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


django-tastypie REST update or delete resource with username

2013-05-16 Thread psychok7


Hi there i am using django tastypie and i can update (PUT) a resource if i 
provide an id like this :

http://mysite.com:8000/api/v1/user/1/

But my question is, can i do an update without the id (pk) but with a 
username instead? And if yes, how can i do that? It would be something like 
this :

http://mysite.com:8000/api/v1/user/username/

-- 
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 resource with django-tastypie

2013-04-08 Thread psychok7
GOT IT WORKING. It was a problem with the default tastypie read only 
authorization

On Monday, April 8, 2013 12:00:35 PM UTC+1, psychok7 wrote:
>
> it was a quoting problem.. but now i get another error:
>
> HTTP/1.0 401 UNAUTHORIZED
>
> curl --dump-header - -H "Content-Type: application/json" -X POST --data 
> '{"city": "/api/smart/city/35/", "comment": "teste do php", "id": "4", 
> "resource_uri": "/api/smart/rating/4/", "rating": "3","user_id": 
> "/api/smart/auth/user/2/"}' http://localhost:8000/api/smart/rating/ HTTP/1.0 
> 401 UNAUTHORIZED Date: Mon, 08 Apr 2013 10:52:44 GMT Server: WSGIServer/0.1 
> Python/2.7.3 Access-Control-Allow-Origin: * Access-Control-Allow-Methods: 
> POST,GET,OPTIONS,PUT,DELETE Content-Type: text/html; charset=utf-8 
> Access-Control-Allow-Headers: Content-Type,* 
> Access-Control-Allow-Credentials: true
>
> On Monday, April 8, 2013 11:41:11 AM UTC+1, psychok7 wrote:
>>
>> guys i am having problems creating a new resource with django tastypie. i 
>> get the following error:
>>
>> class RatingResource(ModelResource):
>> city = fields.ForeignKey(CityResource, 'city')
>> user_id = fields.ForeignKey(UserResource, 'user')
>> class Meta:
>> queryset = Rating.objects.all()
>> resource_name = 'rating'
>> #authentication = BasicAuthentication()
>> #authorization = DjangoAuthorization()
>>
>> curl --dump-header - -H "Content-Type: application/json" -X POST --data 
>> '{city: "/api/smarturbia/city/35/", comment: "teste do php", id: "4", 
>> resource_uri: "/api/smarturbia/rating/4/", rating: "3",user_id: 
>> "/api/smarturbia/auth/user/2/"}' http://127.0.0.1:8000/api/smarturbia/rating/
>> HTTP/1.0 <http://127.0.0.1:8000/api/smarturbia/rating/HTTP/1.0> 500 INTERNAL 
>> SERVER ERROR
>> Date: Mon, 08 Apr 2013 10:36:34 GMT
>> Server: WSGIServer/0.1 Python/2.7.3
>> Access-Control-Allow-Origin: *
>> Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
>> Content-Type: application/json
>> Access-Control-Allow-Headers: Content-Type,*
>> Access-Control-Allow-Credentials: true
>>
>> {"error_message": "Expecting property name: line 1 column 1 (char 1)", 
>> "traceback": "Traceback (most recent call last):\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 202, 
>> in wrapper\nresponse = callback(request, *args, **kwargs)\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 440, 
>> in dispatch_list\nreturn self.dispatch('list', request, **kwargs)\n\n  
>> File \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 
>> 472, in dispatch\nresponse = method(request, **kwargs)\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 1325, 
>> in post_list\ndeserialized = self.deserialize(request, 
>> request.raw_post_data, format=request.META.get('CONTENT_TYPE', 
>> 'application/json'))\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 389, 
>> in deserialize\ndeserialized = self._meta.serializer.deserialize(data, 
>> format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 
>> 205, in deserialize\ndeserialized = getattr(self, \"from_%s\" % 
>> desired_format)(content)\n\n  File 
>> \"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 
>> 359, in from_json\nreturn simplejson.loads(content)\n\n  File 
>> \"/usr/lib/python2.7/dist-packages/simplejson/__init__.py\", line 413, in 
>> loads\nreturn _default_decoder.decode(s)\n\n  File 
>> \"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 402, in 
>> decode\nobj, end = self.raw_decode(s, idx=_w(s, 0).end())\n\n  File 
>> \"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 418, in 
>> raw_decode\nobj, end = self.scan_once(s, idx)\n\nJSONDecodeError: 
>> Expecting property name: line 1 column 1 (char 1)\n"}
>>
>>
>> any ideas?
>>
>>

-- 
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 resource with django-tastypie

2013-04-08 Thread psychok7
it was a quoting problem.. but now i get another error:

HTTP/1.0 401 UNAUTHORIZED

curl --dump-header - -H "Content-Type: application/json" -X POST --data 
'{"city": "/api/smart/city/35/", "comment": "teste do php", "id": "4", 
"resource_uri": "/api/smart/rating/4/", "rating": "3","user_id": 
"/api/smart/auth/user/2/"}' http://localhost:8000/api/smart/rating/ HTTP/1.0 
401 UNAUTHORIZED Date: Mon, 08 Apr 2013 10:52:44 GMT Server: WSGIServer/0.1 
Python/2.7.3 Access-Control-Allow-Origin: * Access-Control-Allow-Methods: 
POST,GET,OPTIONS,PUT,DELETE Content-Type: text/html; charset=utf-8 
Access-Control-Allow-Headers: Content-Type,* 
Access-Control-Allow-Credentials: true

On Monday, April 8, 2013 11:41:11 AM UTC+1, psychok7 wrote:
>
> guys i am having problems creating a new resource with django tastypie. i 
> get the following error:
>
> class RatingResource(ModelResource):
> city = fields.ForeignKey(CityResource, 'city')
> user_id = fields.ForeignKey(UserResource, 'user')
> class Meta:
> queryset = Rating.objects.all()
> resource_name = 'rating'
> #authentication = BasicAuthentication()
> #authorization = DjangoAuthorization()
>
> curl --dump-header - -H "Content-Type: application/json" -X POST --data 
> '{city: "/api/smarturbia/city/35/", comment: "teste do php", id: "4", 
> resource_uri: "/api/smarturbia/rating/4/", rating: "3",user_id: 
> "/api/smarturbia/auth/user/2/"}' http://127.0.0.1:8000/api/smarturbia/rating/
> HTTP/1.0 <http://127.0.0.1:8000/api/smarturbia/rating/HTTP/1.0> 500 INTERNAL 
> SERVER ERROR
> Date: Mon, 08 Apr 2013 10:36:34 GMT
> Server: WSGIServer/0.1 Python/2.7.3
> Access-Control-Allow-Origin: *
> Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
> Content-Type: application/json
> Access-Control-Allow-Headers: Content-Type,*
> Access-Control-Allow-Credentials: true
>
> {"error_message": "Expecting property name: line 1 column 1 (char 1)", 
> "traceback": "Traceback (most recent call last):\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 202, 
> in wrapper\nresponse = callback(request, *args, **kwargs)\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 440, 
> in dispatch_list\nreturn self.dispatch('list', request, **kwargs)\n\n  
> File \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 
> 472, in dispatch\nresponse = method(request, **kwargs)\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 1325, 
> in post_list\ndeserialized = self.deserialize(request, 
> request.raw_post_data, format=request.META.get('CONTENT_TYPE', 
> 'application/json'))\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 389, 
> in deserialize\ndeserialized = self._meta.serializer.deserialize(data, 
> format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 205, 
> in deserialize\ndeserialized = getattr(self, \"from_%s\" % 
> desired_format)(content)\n\n  File 
> \"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 359, 
> in from_json\nreturn simplejson.loads(content)\n\n  File 
> \"/usr/lib/python2.7/dist-packages/simplejson/__init__.py\", line 413, in 
> loads\nreturn _default_decoder.decode(s)\n\n  File 
> \"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 402, in 
> decode\nobj, end = self.raw_decode(s, idx=_w(s, 0).end())\n\n  File 
> \"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 418, in 
> raw_decode\nobj, end = self.scan_once(s, idx)\n\nJSONDecodeError: 
> Expecting property name: line 1 column 1 (char 1)\n"}
>
>
> any ideas?
>
>

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




creating resource with django-tastypie

2013-04-08 Thread psychok7
guys i am having problems creating a new resource with django tastypie. i 
get the following error:

class RatingResource(ModelResource):
city = fields.ForeignKey(CityResource, 'city')
user_id = fields.ForeignKey(UserResource, 'user')
class Meta:
queryset = Rating.objects.all()
resource_name = 'rating'
#authentication = BasicAuthentication()
#authorization = DjangoAuthorization()

curl --dump-header - -H "Content-Type: application/json" -X POST --data '{city: 
"/api/smarturbia/city/35/", comment: "teste do php", id: "4", resource_uri: 
"/api/smarturbia/rating/4/", rating: "3",user_id: 
"/api/smarturbia/auth/user/2/"}' http://127.0.0.1:8000/api/smarturbia/rating/
HTTP/1.0 500 INTERNAL SERVER ERROR
Date: Mon, 08 Apr 2013 10:36:34 GMT
Server: WSGIServer/0.1 Python/2.7.3
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Content-Type: application/json
Access-Control-Allow-Headers: Content-Type,*
Access-Control-Allow-Credentials: true

{"error_message": "Expecting property name: line 1 column 1 (char 1)", 
"traceback": "Traceback (most recent call last):\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 202, in 
wrapper\nresponse = callback(request, *args, **kwargs)\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 440, in 
dispatch_list\nreturn self.dispatch('list', request, **kwargs)\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 472, in 
dispatch\nresponse = method(request, **kwargs)\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 1325, in 
post_list\ndeserialized = self.deserialize(request, request.raw_post_data, 
format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/resources.py\", line 389, in 
deserialize\ndeserialized = self._meta.serializer.deserialize(data, 
format=request.META.get('CONTENT_TYPE', 'application/json'))\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 205, 
in deserialize\ndeserialized = getattr(self, \"from_%s\" % 
desired_format)(content)\n\n  File 
\"/usr/local/lib/python2.7/dist-packages/tastypie/serializers.py\", line 359, 
in from_json\nreturn simplejson.loads(content)\n\n  File 
\"/usr/lib/python2.7/dist-packages/simplejson/__init__.py\", line 413, in 
loads\nreturn _default_decoder.decode(s)\n\n  File 
\"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 402, in 
decode\nobj, end = self.raw_decode(s, idx=_w(s, 0).end())\n\n  File 
\"/usr/lib/python2.7/dist-packages/simplejson/decoder.py\", line 418, in 
raw_decode\nobj, end = self.scan_once(s, idx)\n\nJSONDecodeError: Expecting 
property name: line 1 column 1 (char 1)\n"}


any ideas?

-- 
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: Call Class based view from another class based view

2013-02-19 Thread psychok7
Thats it, it now works. thanks a bunch

On Tuesday, February 19, 2013 12:26:35 PM UTC, JirkaV wrote:
>
> You have
>
> ShowAppsView.as_view()(self.request)
>
> at the end of the code you pasted below. That means that you get result of 
> the ShowAppsView which gets immediatelly discarded ("forgotten") because 
> you don't do anything with it.
>
> You probably want 
>
> return ShowAppsView.as_view()(self.request)
>
> but that's just a wild guess, I have not read your code thoroughly nor I 
> use CBV's myself.
>
>   HTH
>
> Jirka
>
>

-- 
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: Call Class based view from another class based view

2013-02-19 Thread psychok7
What do you mean not returnig?? i have a return statement. how should i do 
it?

> if u.username == username: 
> > 
> cities_list=City.objects.filter(user_id__exact=self.current_user_id(request)).order_by('-kms')
>  
>
> > allcategories = Category.objects.all() 
> > allcities = City.objects.all() 
> > rating_list = Rating.objects.filter(user=u) 
> > totalMiles = 0 
> > for city in cities_list: 
> > totalMiles = totalMiles + city.kms 
> > return {'totalMiles': totalMiles , 
> > 'cities_list':cities_list,'rating_list':rating_list,'allcities' : 
> allcities, 
> > 'allcategories':allcategories} 
> > 
> > @method_decorator(csrf_exempt) 
> > def dispatch(self, *args, **kwargs): 
> > return super(ShowAppsView, self).dispatch(*args, **kwargs) 
> > 
> > def get(self, request, username, **kwargs): 
> > return self.render_to_response(self.compute_context(request,username)) 
> > 
> > class ManageAppView(LoginRequiredMixin, CheckTokenMixin, 
> > CurrentUserIdMixin,TemplateView): 
> > template_name = "accounts/smarturbia.html" 
> > 
> > def compute_context(self, request, username): 
> > action = request.GET.get('action') 
> > city_id = request.GET.get('id') 
> > u = get_object_or_404(User, pk=self.current_user_id(request)) 
> > if u.username == username: 
> > if request.GET.get('action') == 'delete': 
> > #some logic here and then: 
> > ShowAppsView.as_view()(self.request) 
> > 
> > What am i doing wrong guys? 
> > 
>
> You're not returning the response created by calling the ShowAppsView 
> CBV, you just discard it. After that, control flows back in to the 
> ManageAppView CBV. 
>
> Cheers 
>
> Tom 
>

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




Call Class based view from another class based view

2013-02-19 Thread psychok7
hi, i am trying to call a class based view and i am able to do it, but for 
some reason i am not getting the context of the new class

class ShowAppsView(LoginRequiredMixin, CurrentUserIdMixin, TemplateView):
template_name = "accounts/thing.html"

def compute_context(self, request, username):
u = get_object_or_404(User, pk=self.current_user_id(request))
 if u.username == username:
cities_list=City.objects.filter(user_id__exact=self.current_user_id(request)).order_by('-kms')
allcategories = Category.objects.all()
allcities = City.objects.all()
rating_list = Rating.objects.filter(user=u)
totalMiles = 0
for city in cities_list:
totalMiles = totalMiles + city.kms
 return {'totalMiles': totalMiles , 
'cities_list':cities_list,'rating_list':rating_list,'allcities' : 
allcities, 'allcategories':allcategories}

@method_decorator(csrf_exempt)
def dispatch(self, *args, **kwargs):
return super(ShowAppsView, self).dispatch(*args, **kwargs)

def get(self, request, username, **kwargs):
return self.render_to_response(self.compute_context(request,username))

class ManageAppView(LoginRequiredMixin, CheckTokenMixin, 
CurrentUserIdMixin,TemplateView):
template_name = "accounts/smarturbia.html"

def compute_context(self, request, username):
action = request.GET.get('action')
city_id = request.GET.get('id')
u = get_object_or_404(User, pk=self.current_user_id(request)) 
 if u.username == username:
if request.GET.get('action') == 'delete':
#some logic here and then:
ShowAppsView.as_view()(self.request)

What am i doing wrong guys?

-- 
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: sort cache

2013-01-08 Thread psychok7
hi there. redis does seem like a better solution than the cache.

i need redis (or the cache) because of performance reasons. i know they are 
faster for the insert and retrieve that i need in a FIFO order. Found this 
http://rediscookbook.org/implement_a_fifo_queue.html and it seems it will 
do the trick

thanks for your time

On Tuesday, January 8, 2013 12:45:07 PM UTC, psychok7 wrote:
>
> Hi guys, just wondering if its possible to sort a django cache? I need to 
> add data with an auto increment id to the cache and sort it in reverse 
> order to get it back. I no this can be easily accomplished with the normal 
> mysql database but since the cache is faster i would like to do it there
>
> thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/BhIxefC4e-IJ.
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.



sort cache

2013-01-08 Thread psychok7
Hi guys, just wondering if its possible to sort a django cache? I need to 
add data with an auto increment id to the cache and sort it in reverse 
order to get it back. I no this can be easily accomplished with the normal 
mysql database but since the cache is faster i would like to do it there

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/x6xxD_1QICIJ.
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 Celery FIFO ORDER

2012-12-17 Thread psychok7
ok i see your point.. Well i am going to use my redis db already used by 
celerey to do the sorting then. hope its fast enough.

Thanks for your time to help me out ;)

On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/bvwtkC89v2kJ.
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 Celery FIFO ORDER

2012-12-15 Thread psychok7
hey Nikolas, it looks like a solution that would work in fact, but there 
are some limitations in terms of performance (i need my app to be 
scalable). If for each request i sort my database it will eventually become 
slow for 10.000 requests, so i was actually looking for a more scalable 
solution.

For know i can work with your idea, but wouldn't want it to be long term. 
If you have any more ideas please share.

On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/dmZ0utouw48J.
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 Celery FIFO ORDER

2012-12-14 Thread psychok7
Ok i am going to detail what i want to do a little further:

So i have this django app, and when i press submit after i fill in the form 
my celery worker wakes up and takes care of taking that submitted data and 
posting to a remote server. This i can do without problems.

Now, imagine that my internet goes down at that exact time, my celery 
worker keeps retrying to send until it is successful  But imagine i do 
another submit before my previous data is submitted, my data wont be 
consistent on the other remote server.

Now that is my problem. I am not able to make this requests FIFO with the 
retry option given by celery so i that's were i need some help figuring 
that out.


On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/9uZtJG0v85UJ.
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 Celery FIFO ORDER

2012-12-11 Thread psychok7
I got the named queues working with 1 worker, but i am not able to make it 
FIFO.. Its only fifo for the tasks that were rescheduled, but my latest 
task runs and i only want that to happen after the other ones get executed..

any more ideas?

On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/1Ud3yLDgjicJ.
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 Celery FIFO ORDER

2012-12-11 Thread psychok7
thanks guys you pointed me in the write path now ill try to figure it out 
by myself.


cheers

On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/bcrBdWk1ARkJ.
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 Celery FIFO ORDER

2012-12-11 Thread psychok7
i need to get my queue back from the worker when i need to add a new task 
to the queue (if it isn't yet executed) in order to keep a FIFO order, i 
read somewhere that i cant do that and that its not a good idea.

do you have a solution? my i am just thinking about this the wrong way, 
please let me know.

On Monday, December 10, 2012 4:20:52 PM UTC, psychok7 wrote:
>
> So I have this 2 applications connected with a REST API (json messages). 
> One written in Django and the other in Php. I have an exact database 
> replica on both sides (using mysql).
>
> When i press "submit" on one of them, i want that data to be saved on the 
> current app database, and start a cron job with celery/redis to update the 
> remote database for the other app using rest.
>
> *My question is, how do i attribute the same worker to my tasks in order 
> to keep a FIFO order?*
>
> I need my data to be consistent and FIFO is really important.
>

-- 
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/-/QlYhBqPjSvUJ.
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.



Django Celery FIFO ORDER

2012-12-10 Thread psychok7


So I have this 2 applications connected with a REST API (json messages). 
One written in Django and the other in Php. I have an exact database 
replica on both sides (using mysql).

When i press "submit" on one of them, i want that data to be saved on the 
current app database, and start a cron job with celery/redis to update the 
remote database for the other app using rest.

*My question is, how do i attribute the same worker to my tasks in order to 
keep a FIFO order?*

I need my data to be consistent and FIFO is really important.

-- 
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/-/1JR6HYArsgQJ.
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 synchronize database over REST

2012-12-06 Thread psychok7
Thanks for the answer.. but what I. Could have synchronous replication? What do 
you advise over a rest interface?

-- 
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/-/lFAW5Zt-Cg4J.
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.



django synchronize database over REST

2012-12-05 Thread psychok7


So I have this 2 applications connected with a REST API (json messages). 
One written in Django and the other in Php. I have an exact database 
replica on both sides (using mysql).

My question is, how can i keep this 2 applications databases synchronized?

In other words, when i press "submit" on one of them, i want that data to 
be saved on the current app database, and on the remote database for the 
other app using rest.

Is there a django app that does that? i read about django-synchro but 
didn't see anything REST related.

And i would like to keep things asynchronous, in other words the user must 
be able to keep using the app while this process is running on the 
background and keeping data consistent.

-- 
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/-/xaT0SZLptucJ.
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 ajax Post returns empty message

2012-10-24 Thread psychok7
got it, the problem was that i had to change this request.GET.get('type','') to 
thisrequest.POST.get('type','')

On Wednesday, October 24, 2012 9:56:15 PM UTC+1, psychok7 wrote:
>
> using django 1.4, I can Post but the Post response comes (undefined) empty 
> but GET works fine. i am using the csrf checks not sure if the problem also 
> comes from there
>
> my django view:
>
> @csrf_protect
> def edit_city(request,username):
> conditions = dict()
>
> #if request.is_ajax():
> if request.method == 'GET':
> conditions = request.method
> #based on http://stackoverflow.com/a/3634778/977622 
> for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
> ('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
> 'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
> ('area_name', 'area_name'), ('action', 'action')):
> value = request.GET.get(form_key, None)
> if value:
> conditions[filter_key] = value
> print filter_key , conditions[filter_key]
>
> elif request.method == 'POST':
> print "TIPO" , request.GET.get('type','')   
> #based on http://stackoverflow.com/a/3634778/977622 
> for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
> ('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
> 'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
> ('area_name', 'area_name'), ('action', 'action')):
> value = request.GET.get(form_key, None)
> if value:
> conditions[filter_key] = value
> print filter_key , conditions[filter_key]
>
> #Test.objects.filter(**conditions)
> city_json = json.dumps(conditions)
>
> return HttpResponse(city_json, mimetype='application/json')
>
> here is my javascript code :
>
> function getCookie(name) {
> var cookieValue = null;
> if (document.cookie && document.cookie != '') {
> var cookies = document.cookie.split(';');
> for (var i = 0; i < cookies.length; i++) {
> var cookie = jQuery.trim(cookies[i]);
> // Does this cookie string begin with the name we want?
> if (cookie.substring(0, name.length + 1) == (name + '=')) {
> cookieValue = decodeURIComponent(cookie.substring(name.length 
> + 1));
> break;
> }
> }
> }
> return cookieValue;
> }
> var csrftoken = getCookie('csrftoken');
>
> function csrfSafeMethod(method) {
> // these HTTP methods do not require CSRF protection
> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> }
> function sameOrigin(url) {
> // test that a given url is a same-origin URL
> // url could be relative or scheme relative or absolute
> var host = document.location.host; // host + port
> var protocol = document.location.protocol;
> var sr_origin = '//' + host;
> var origin = protocol + sr_origin;
> // Allow absolute or scheme relative URLs to same origin
> return (url == origin || url.slice(0, origin.length + 1) == origin + '/') 
> ||
> (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin 
> + '/') ||
> // or any other URL that isn't scheme relative or absolute i.e 
> relative.
> !(/^(\/\/|http:|https:).*/.test(url));
> }
> $.ajaxSetup({
> beforeSend: function(xhr, settings) {
> if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
> // Only send the token to relative URLs i.e. locally.
> xhr.setRequestHeader("X-CSRFToken",
>  $('input[name="csrfmiddlewaretoken"]').val());
> }
> }
> });
>
> $.post(url,{ type : type , city: cityStr, pois: poisStr, poisdelete: 
> poisDeleteStr, kmz: kmzStr,kmzdelete : kmzDeleteStr,limits : limitsStr, 
> area_nameStr : area_nameStr , limitsdelete : 
> limitsDeleteStr},function(data,status){
> alert("Data: " + data + "\nStatus: " + status);
> console.log("newdata" + data.kmz)
> });
>
> what am i missing?
>

-- 
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/-/gmNfKhGU6_EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django ajax Post returns empty message

2012-10-24 Thread psychok7
 it seems like its not posting propely, irequest.GET.get('type','') but it 
prints empty string and the Post response comes (undefined) empty but GET 
works fine.

On Wednesday, October 24, 2012 9:56:15 PM UTC+1, psychok7 wrote:
>
> using django 1.4, I can Post but the Post response comes (undefined) empty 
> but GET works fine. i am using the csrf checks not sure if the problem also 
> comes from there
>
> my django view:
>
> @csrf_protect
> def edit_city(request,username):
> conditions = dict()
>
> #if request.is_ajax():
> if request.method == 'GET':
> conditions = request.method
> #based on http://stackoverflow.com/a/3634778/977622 
> for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
> ('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
> 'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
> ('area_name', 'area_name'), ('action', 'action')):
> value = request.GET.get(form_key, None)
> if value:
> conditions[filter_key] = value
> print filter_key , conditions[filter_key]
>
> elif request.method == 'POST':
> print "TIPO" , request.GET.get('type','')   
> #based on http://stackoverflow.com/a/3634778/977622 
> for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
> ('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
> 'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
> ('area_name', 'area_name'), ('action', 'action')):
> value = request.GET.get(form_key, None)
> if value:
> conditions[filter_key] = value
> print filter_key , conditions[filter_key]
>
> #Test.objects.filter(**conditions)
> city_json = json.dumps(conditions)
>
> return HttpResponse(city_json, mimetype='application/json')
>
> here is my javascript code :
>
> function getCookie(name) {
> var cookieValue = null;
> if (document.cookie && document.cookie != '') {
> var cookies = document.cookie.split(';');
> for (var i = 0; i < cookies.length; i++) {
> var cookie = jQuery.trim(cookies[i]);
> // Does this cookie string begin with the name we want?
> if (cookie.substring(0, name.length + 1) == (name + '=')) {
> cookieValue = decodeURIComponent(cookie.substring(name.length 
> + 1));
> break;
> }
> }
> }
> return cookieValue;
> }
> var csrftoken = getCookie('csrftoken');
>
> function csrfSafeMethod(method) {
> // these HTTP methods do not require CSRF protection
> return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
> }
> function sameOrigin(url) {
> // test that a given url is a same-origin URL
> // url could be relative or scheme relative or absolute
> var host = document.location.host; // host + port
> var protocol = document.location.protocol;
> var sr_origin = '//' + host;
> var origin = protocol + sr_origin;
> // Allow absolute or scheme relative URLs to same origin
> return (url == origin || url.slice(0, origin.length + 1) == origin + '/') 
> ||
> (url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin 
> + '/') ||
> // or any other URL that isn't scheme relative or absolute i.e 
> relative.
> !(/^(\/\/|http:|https:).*/.test(url));
> }
> $.ajaxSetup({
> beforeSend: function(xhr, settings) {
> if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
> // Only send the token to relative URLs i.e. locally.
> xhr.setRequestHeader("X-CSRFToken",
>  $('input[name="csrfmiddlewaretoken"]').val());
> }
> }
> });
>
> $.post(url,{ type : type , city: cityStr, pois: poisStr, poisdelete: 
> poisDeleteStr, kmz: kmzStr,kmzdelete : kmzDeleteStr,limits : limitsStr, 
> area_nameStr : area_nameStr , limitsdelete : 
> limitsDeleteStr},function(data,status){
> alert("Data: " + data + "\nStatus: " + status);
> console.log("newdata" + data.kmz)
> });
>
> what am i missing?
>

-- 
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/-/mtINoYH01X8J.
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.



django ajax Post returns empty message

2012-10-24 Thread psychok7


using django 1.4, I can Post but the Post response comes (undefined) empty 
but GET works fine. i am using the csrf checks not sure if the problem also 
comes from there

my django view:

@csrf_protect
def edit_city(request,username):
conditions = dict()

#if request.is_ajax():
if request.method == 'GET':
conditions = request.method
#based on http://stackoverflow.com/a/3634778/977622 
for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
('area_name', 'area_name'), ('action', 'action')):
value = request.GET.get(form_key, None)
if value:
conditions[filter_key] = value
print filter_key , conditions[filter_key]

elif request.method == 'POST':
print "TIPO" , request.GET.get('type','')   
#based on http://stackoverflow.com/a/3634778/977622 
for filter_key, form_key in (('type',  'type'), ('city', 'city'), 
('pois', 'pois'), ('poisdelete', 'poisdelete'), ('kmz', 'kmz'), ('kmzdelete', 
'kmzdelete'), ('limits', 'limits'), ('limitsdelete', 'limitsdelete'), 
('area_name', 'area_name'), ('action', 'action')):
value = request.GET.get(form_key, None)
if value:
conditions[filter_key] = value
print filter_key , conditions[filter_key]

#Test.objects.filter(**conditions)
city_json = json.dumps(conditions)

return HttpResponse(city_json, mimetype='application/json')

here is my javascript code :

function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 
1));
break;
}
}
}
return cookieValue;
}
var csrftoken = getCookie('csrftoken');

function csrfSafeMethod(method) {
// these HTTP methods do not require CSRF protection
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}
function sameOrigin(url) {
// test that a given url is a same-origin URL
// url could be relative or scheme relative or absolute
var host = document.location.host; // host + port
var protocol = document.location.protocol;
var sr_origin = '//' + host;
var origin = protocol + sr_origin;
// Allow absolute or scheme relative URLs to same origin
return (url == origin || url.slice(0, origin.length + 1) == origin + '/') ||
(url == sr_origin || url.slice(0, sr_origin.length + 1) == sr_origin + 
'/') ||
// or any other URL that isn't scheme relative or absolute i.e relative.
!(/^(\/\/|http:|https:).*/.test(url));
}
$.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
// Only send the token to relative URLs i.e. locally.
xhr.setRequestHeader("X-CSRFToken",
 $('input[name="csrfmiddlewaretoken"]').val());
}
}
});

$.post(url,{ type : type , city: cityStr, pois: poisStr, poisdelete: 
poisDeleteStr, kmz: kmzStr,kmzdelete : kmzDeleteStr,limits : limitsStr, 
area_nameStr : area_nameStr , limitsdelete : 
limitsDeleteStr},function(data,status){
alert("Data: " + data + "\nStatus: " + status);
console.log("newdata" + data.kmz)
});

what am i missing?

-- 
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/-/rq4EbSg0dWcJ.
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.



django_multiuploader Uncaught TypeError: Object [object Object] has no method 'fileupload'

2012-10-13 Thread psychok7


i am using django_multiuploader in my app, and even thou i can upload the 
image, the fancy jquery eye candy is not happening (js,css), and after it 
finishes uploading it doesn't show me my image, only some json text info 
about the image. What am i doing wrong? i am getting this error when i 
inspect element:

Uncaught TypeError: Object [object Object] has no method 'fileupload'

here is my code:

MEDIA_ROOT = os.path.join(BASE_DIR, 'site_media/')
MEDIA_URL = '/site_media/'
STATIC_ROOT = os.path.join(BASE_DIR, '/static/')
STATIC_URL = '/static/'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
'admin',  
'sorl.thumbnail',
'multiuploader', 
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
)

didnt change anything in the multiuploader app that i clone from
https://github.com/garmoncheg/django_multiuploader my media/multiuploader 
is under my site_media/multiuploader (MEDIA ROOT) like the README says. and 
i have sorl.thumbnail installed and pillow. and i adder the urls also.

-- 
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/-/EgLi9jlwShAJ.
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 socialauth username not showing correctly

2012-10-09 Thread psychok7
yes you are right. i deleted the same name user and it works. but how can i 
control this with oauth users and users that register normally?

On Tuesday, October 9, 2012 4:49:21 PM UTC+1, Stefano Tranquillini wrote:
>
> Django put numbers because you already have in the db a user with the fb 
> username. 
> check it.
>
> On Tuesday, October 9, 2012 5:19:00 PM UTC+2, psychok7 wrote:
>>
>> hey thanks for the reply. Can you point out some examples here i can get 
>> do all that in the right way?
>>
>> On Tuesday, October 9, 2012 3:15:13 PM UTC+1, Daniel Molina Wegener wrote:
>>>
>>> On 09/10/12 10:52, psychok7 wrote: 
>>> > So i am using django socialauth and its working fine, except for the 
>>> > part where my usernames do not match my Facebook or twitter accounts 
>>> > after i log in. In other words for example if i my username is 'john', 
>>> > after i log in in my app it shows 'john820579c6960e4677'. What am i 
>>> > doing wrong? how can i make it look exactly like my Facebook account? 
>>>
>>>You muse the GraphAPI service with the provided Access Token (code) 
>>> to access the Facebook Profile and get the real name. The Django 
>>> SocialAuth package just provides access services. Also, you must add 
>>> some special permissions to access certain profile data. 
>>>
>>> > 
>>> > -- 
>>>  > [SNIP] 
>>>
>>> Kind regards, 
>>> -- 
>>> Daniel Molina Wegener [dmw at coder dot cl] 
>>> @damowe | http://coder.cl/ | https://github.com/dmw 
>>>
>>

-- 
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/-/3RyJKocJPRMJ.
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 socialauth username not showing correctly

2012-10-09 Thread psychok7
hey thanks for the reply. Can you point out some examples here i can get do 
all that in the right way?

On Tuesday, October 9, 2012 3:15:13 PM UTC+1, Daniel Molina Wegener wrote:
>
> On 09/10/12 10:52, psychok7 wrote: 
> > So i am using django socialauth and its working fine, except for the 
> > part where my usernames do not match my Facebook or twitter accounts 
> > after i log in. In other words for example if i my username is 'john', 
> > after i log in in my app it shows 'john820579c6960e4677'. What am i 
> > doing wrong? how can i make it look exactly like my Facebook account? 
>
>You muse the GraphAPI service with the provided Access Token (code) 
> to access the Facebook Profile and get the real name. The Django 
> SocialAuth package just provides access services. Also, you must add 
> some special permissions to access certain profile data. 
>
> > 
> > -- 
>  > [SNIP] 
>
> Kind regards, 
> -- 
> Daniel Molina Wegener [dmw at coder dot cl] 
> @damowe | http://coder.cl/ | https://github.com/dmw 
>

-- 
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/-/HZQbygXaPYIJ.
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.



django socialauth username not showing correctly

2012-10-09 Thread psychok7
So i am using django socialauth and its working fine, except for the part 
where my usernames do not match my Facebook or twitter accounts after i log 
in. In other words for example if i my username is 'john', after i log in 
in my app it shows 'john820579c6960e4677'. What am i doing wrong? how can i 
make it look exactly like my Facebook account? 

-- 
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/-/vkirtfhwQnQJ.
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.



Sending post request from Django to Couchdb remote server

2012-08-28 Thread psychok7
So, i have a fully operational django project with postgresql to manage its 
contents.   Nevertheless i decided to create a second database using 
couchdb to keep just one part of that data. Should i use *urllib2* and send 
post requests to my couchdb to save the new data or this is just bad 
programming (not secure,etc) and i should use something else?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/otajjOwR5HUJ.
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.



help with Can't pickle : attribute lookup __builtin__.instancemethod failed

2012-07-13 Thread psychok7
i there, i am getting a Can't pickle : attribute 
lookup __builtin__.instancemethod failed 

*Traceback:*
*File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" 
in get_response*
*  188. response = middleware_method(request, response)*
*File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/middleware.py" 
in process_response*
*  36. request.session.save()*
*File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/db.py" 
in save*
*  52. 
session_data=self.encode(self._get_session(no_load=must_create)),*
*File 
"/usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/base.py"
 
in encode*
*  79. pickled = pickle.dumps(session_dict, pickle.HIGHEST_PROTOCOL)
*
*
*
*Exception Type: PicklingError at /loggedin/*
*Exception Value: Can't pickle : attribute lookup 
__builtin__.instancemethod failed*

i think its related to the fact i am using sessions, and i am trying the 
save a list that has a models.FileField to it. I read somewhere that was 
not possible with sessions, is there a workaround for my problem?


-- 
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/-/q2Q2jwiuZ9sJ.
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: dashboard for user profile

2012-07-13 Thread psychok7
yes i understand that, but i am asking if there is a pluggable app that 
does that for us with some jquery and stuff. 

as i said theres is django-profiles, but i think its poorly documented and 
i am not able to figure it out

On Friday, July 13, 2012 8:33:04 AM UTC+1, somecallitblues wrote:
>
> This should be really easy. Google something like "extending user profile" 
> with user being a foreign key to your model. The you can grab the use from 
> the request in you view and get the info from db and just spit it out on 
> the screen.
>
> M 
> On Jul 13, 2012 11:58 AM, "psychok7"  wrote:
>
>> i there,
>> i am trying to write a dashboard page to present after user login. i have 
>> been searching google and only found *django-admin-tools . won*dering if 
>> there is something like that for a user profile page (tried django-profiles 
>> with no luck)
>>
>> thanks
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/Ffs1FOqrQXoJ.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kxB3pqw3JzcJ.
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.



dashboard for user profile

2012-07-12 Thread psychok7
i there,
i am trying to write a dashboard page to present after user login. i have 
been searching google and only found *django-admin-tools . won*dering if 
there is something like that for a user profile page (tried django-profiles 
with no luck)

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Ffs1FOqrQXoJ.
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 with rss feed ImproperlyConfigured

2012-07-07 Thread psychok7
anyone??

On Saturday, July 7, 2012 3:52:52 AM UTC+1, psychok7 wrote:
>
> hi, i am trying to implement the syndicate feed framework simple rss with 
> my program, but i get a ImproperlyConfigured at /latest/feed/
>
> Give your Debt class a get_absolute_url() method, or define an item_link() 
> method in your Feed class.
>
> I know i am supposed to create a get_absolute_url in my Debt model, but i 
> dont know how to do it (already seen tutorials but cant make it work)
>
> model: 
>
> class Debt (models.Model): 
>
>  user = models.ForeignKey(User) 
>
>  debt_name = models.TextField() 
>
>  creation_date = models.DateTimeField('date created') 
>
>  due_date = models.DateTimeField('due date') 
>
>  info = models.TextField() 
>
>  is_owing = models.BooleanField() 
>
>  is_payed = models.BooleanField()
>
>  def __unicode__(self):
> return self.debt_name
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/QTr8HDaFi6AJ.
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 with rss feed ImproperlyConfigured

2012-07-06 Thread psychok7
on my feed.py i have 

class LatestEntriesFeed(Feed):
title = "Chicagocrime.org site news"
link = "/blog/"
description = "Recent Posts"

def items(self):
return Debt.objects.all().order_by('-creation_date')[:10]


can anyone help me?

On Saturday, July 7, 2012 3:52:52 AM UTC+1, psychok7 wrote:
>
> hi, i am trying to implement the syndicate feed framework simple rss with 
> my program, but i get a ImproperlyConfigured at /latest/feed/
>
> Give your Debt class a get_absolute_url() method, or define an item_link() 
> method in your Feed class.
>
> I know i am supposed to create a get_absolute_url in my Debt model, but i 
> dont know how to do it (already seen tutorials but cant make it work)
>
> model: 
>
> class Debt (models.Model): 
>
>  user = models.ForeignKey(User) 
>
>  debt_name = models.TextField() 
>
>  creation_date = models.DateTimeField('date created') 
>
>  due_date = models.DateTimeField('due date') 
>
>  info = models.TextField() 
>
>  is_owing = models.BooleanField() 
>
>  is_payed = models.BooleanField()
>
>  def __unicode__(self):
> return self.debt_name
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Q8HyQT5lnWoJ.
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.



help with rss feed ImproperlyConfigured

2012-07-06 Thread psychok7
hi, i am trying to implement the syndicate feed framework simple rss with 
my program, but i get a ImproperlyConfigured at /latest/feed/

Give your Debt class a get_absolute_url() method, or define an item_link() 
method in your Feed class.

I know i am supposed to create a get_absolute_url in my Debt model, but i dont 
know how to do it (already seen tutorials but cant make it work)

model: 

class Debt (models.Model): 

 user = models.ForeignKey(User) 

 debt_name = models.TextField() 

 creation_date = models.DateTimeField('date created') 

 due_date = models.DateTimeField('due date') 

 info = models.TextField() 

 is_owing = models.BooleanField() 

 is_payed = models.BooleanField()

 def __unicode__(self):
return self.debt_name


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/cs2jbuw6zaAJ.
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 simple backend help

2012-05-28 Thread psychok7
i followed your tips and  got my answer here 
http://stackoverflow.com/questions/3441436/the-next-parameter-redirect-django-contrib-auth-login
 

thanks ;)

On Monday, May 28, 2012 9:43:34 PM UTC+1, Rafael Durán Castañeda wrote:
>
>  El 28/05/12 22:13, Rafael Dur�n Casta�eda escribi�: 
>
> El 28/05/12 21:28, psychok7 escribi�: 
>
> yes i read that part before posting, but i just dont understand the 
> beahaviour of the normal login that redirects me somewhere and the login 
> after registration that redirects me elsewhere. wich one should i use?
>
> On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Dur�n Casta�eda 
> wrote: 
>>
>>  El 28/05/12 20:18, psychok7 escribi�: 
>>
>> anyone?
>>
>> On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote: 
>>>
>>> hi there i am writing an app using django-registration 0.8 installed 
>>> from pip and using the simple-backend 
>>>
>>>  my problem is, when i register a new user it logs me in after 
>>> inserting in the db and redirects me to /users// but if i login 
>>> normally using the�django.contrib.auth it redirects me to 
>>> accounts/profile.
>>>
>>>  my question is, how do i unify this redirect since it should take me 
>>> to the same place?
>>>
>>>  thanks
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.
>> 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.
>>
>> From django-registration docs:
>>
>> Upon successful registration, the default redirect is to the URL 
>> specified by the get_absolute_url() method of the newly-created Userobject; 
>> by default, this will be 
>> /users//, although it can be overridden in either of two ways:
>>
>>1. Specify a custom URL pattern for the 
>> register()<http://docs.b-list.org/django-registration/0.8/views.html#registration.views.register>view,
>>  passing the keyword argument 
>>success_url. 
>>2. Override the default get_absolute_url() of the User model in your 
>>Django configuration, as covered in Django�s settings 
>> documentation<http://docs.djangoproject.com/en/dev/ref/settings/#absolute-url-overrides>
>>. 
>>
>> http://docs.b-list.org/django-registration/0.8/simple-backend.html
>>  HTH
>>  
> -- 
> 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/-/T_tBN05Lbk4J.
> 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.
>
> Django, by default, redirects you to LOGIN_URL after successful login 
> unless next is given as query string (see 
> https://docs.djangoproject.com/en/dev/topics/auth/#the-login-required-decorator),
>  
> accounts/profile in your case, and registration backend is redirecting you 
> to /users/. So you can change LOGIN_URL or override registration 
> redirects as docs explain.
>
> Bye
>
> I've just realized, my las message is wrong, LOGIN_REDIRECT is where users 
> are redirected by default (
> https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url) 
> and I didn't mention that also depends of your login view (but I think not 
> in this case).
>
> Bye
>  

-- 
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/-/2WA0uQWMDKEJ.
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 simple backend help

2012-05-28 Thread psychok7
yes i read that part before posting, but i just dont understand the 
beahaviour of the normal login that redirects me somewhere and the login 
after registration that redirects me elsewhere. wich one should i use?

On Monday, May 28, 2012 8:15:28 PM UTC+1, Rafael Durán Castañeda wrote:
>
>  El 28/05/12 20:18, psychok7 escribió: 
>
> anyone?
>
> On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote: 
>>
>> hi there i am writing an app using django-registration 0.8 installed from 
>> pip and using the simple-backend 
>>
>>  my problem is, when i register a new user it logs me in after inserting 
>> in the db and redirects me to /users// but if i login normally 
>> using the django.contrib.auth it redirects me to accounts/profile.
>>
>>  my question is, how do i unify this redirect since it should take me to 
>> the same place?
>>
>>  thanks
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.
> 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.
>
> From django-registration docs:
>
> Upon successful registration, the default redirect is to the URL specified 
> by the get_absolute_url() method of the newly-created User object; by 
> default, this will be /users//, although it can be overridden 
> in either of two ways:
>
>1. Specify a custom URL pattern for the 
> register()<http://docs.b-list.org/django-registration/0.8/views.html#registration.views.register>view,
>  passing the keyword argument 
>success_url. 
>2. Override the default get_absolute_url() of the User model in your 
>Django configuration, as covered in Django’s settings 
> documentation<http://docs.djangoproject.com/en/dev/ref/settings/#absolute-url-overrides>
>. 
>
> http://docs.b-list.org/django-registration/0.8/simple-backend.html
>  HTH
>  

-- 
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/-/T_tBN05Lbk4J.
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 simple backend help

2012-05-28 Thread psychok7
anyone?

On Monday, May 28, 2012 1:54:20 AM UTC+1, psychok7 wrote:
>
> hi there i am writing an app using django-registration 0.8 installed from 
> pip and using the simple-backend
>
> my problem is, when i register a new user it logs me in after inserting in 
> the db and redirects me to /users// but if i login normally using 
> the django.contrib.auth it redirects me to accounts/profile.
>
> my question is, how do i unify this redirect since it should take me to 
> the same place?
>
> thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/okwBS3_w15gJ.
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.



django-registration simple backend help

2012-05-27 Thread psychok7
hi there i am writing an app using django-registration 0.8 installed from 
pip and using the simple-backend

my problem is, when i register a new user it logs me in after inserting in 
the db and redirects me to /users// but if i login normally using 
the django.contrib.auth it redirects me to accounts/profile.

my question is, how do i unify this redirect since it should take me to the 
same place?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/PMGDG1tK1IoJ.
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 with foreignkeys

2012-05-14 Thread psychok7
thanks thats exactly wht i needed ;)

On Monday, May 14, 2012 6:58:47 AM UTC+1, Nikolas Stevenson-Molnar wrote:
>
> When you have a FK to park in your comment model, you automatically get a 
> reference to a list of comments from the park model. E.g:
>
> class Park(models.Model):
> #Park fields here, but no explicit relationship to Comment
>
> class Comment(models.Model):
> park = models.ForeignKey(Park)
> #other comment fields here
>
> def some_view(request, id):
> park = Park.objects.get(pk=id)
> comments = park.comment_set #this is a queryset of all comments associated 
> with the part; it may be empty
> #etc...
>
> Or in a template:
> {% for comment in park.comment_set.all %}
>{{ comment.body }}
> {% endfor %}
>
> Does that make sense? Here are the official docs for this functionality: 
> https://docs.djangoproject.com/en/dev/topics/db/queries/#related-objects
>
> _Nik
>
> On May 13, 2012, at 7:03 PM, psychok7 wrote:
>
> i think you are right :) , i can always get the parks associated comments 
> if i query comments model (im used to only doing it the other way around). 
> gonna try that out
>
> thanks
>
> On Monday, May 14, 2012 2:57:17 AM UTC+1, jondykeman wrote:
>>
>> If all comment have to have a park and user. 
>>
>> I would have a ForeignKey to Park and User in the Comments model, and no 
>> Foreign key in the Parks model.
>>
>> As such a comment will always need to be linked to an existing park and 
>> user object, but a park can be created without needing a comment.
>>
>> JD
>>
>> On Sunday, May 13, 2012 7:53:58 PM UTC-6, psychok7 wrote:
>>>
>>> yes, like a park doesn't have to have comments, but all the comments 
>>> must have an associated park and user all the time.
>>>
>>> what is the django syntax for me to achieve this?
>>>
>>> On Monday, May 14, 2012 2:49:18 AM UTC+1, jondykeman wrote:
>>>>
>>>> As far as I understand it the ForeignKey will have to be unique=True 
>>>> and null=False.
>>>>
>>>> I want to get a better sense of what you are trying to achieve. Is it 
>>>> that you want to link comment and park only some of the time?
>>>>
>>>> JD
>>>>
>>>> On Sunday, May 13, 2012 7:41:39 PM UTC-6, psychok7 wrote:
>>>>>
>>>>> so i have this 2 models (Comment and Park)
>>>>>
>>>>> Comment has a foreign key to USER and PARK
>>>>>
>>>>> PARK has a foreign key to Comment
>>>>>
>>>>> my question is, isn't there going to be a deadlock if i don't have a 
>>>>> comment or a park created? i mean , in order to create a Park i need to 
>>>>> have a comment, and in order to create a comment i need a park and a user.
>>>>>
>>>>> is there a way for me to fix my problem? like allowing the foreign key 
>>>>> to be null or something like that?
>>>>>
>>>>> thanks in advance
>>>>>
>>>>
> -- 
> 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/-/EyGby9pYGwMJ.
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ZcoOvGOXkSwJ.
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 with foreignkeys

2012-05-13 Thread psychok7
i think you are right :) , i can always get the parks associated comments 
if i query comments model (im used to only doing it the other way around). 
gonna try that out

thanks

On Monday, May 14, 2012 2:57:17 AM UTC+1, jondykeman wrote:
>
> If all comment have to have a park and user. 
>
> I would have a ForeignKey to Park and User in the Comments model, and no 
> Foreign key in the Parks model.
>
> As such a comment will always need to be linked to an existing park and 
> user object, but a park can be created without needing a comment.
>
> JD
>
> On Sunday, May 13, 2012 7:53:58 PM UTC-6, psychok7 wrote:
>>
>> yes, like a park doesn't have to have comments, but all the comments must 
>> have an associated park and user all the time.
>>
>> what is the django syntax for me to achieve this?
>>
>> On Monday, May 14, 2012 2:49:18 AM UTC+1, jondykeman wrote:
>>>
>>> As far as I understand it the ForeignKey will have to be unique=True and 
>>> null=False.
>>>
>>> I want to get a better sense of what you are trying to achieve. Is it 
>>> that you want to link comment and park only some of the time?
>>>
>>> JD
>>>
>>> On Sunday, May 13, 2012 7:41:39 PM UTC-6, psychok7 wrote:
>>>>
>>>> so i have this 2 models (Comment and Park)
>>>>
>>>> Comment has a foreign key to USER and PARK
>>>>
>>>> PARK has a foreign key to Comment
>>>>
>>>> my question is, isn't there going to be a deadlock if i don't have a 
>>>> comment or a park created? i mean , in order to create a Park i need to 
>>>> have a comment, and in order to create a comment i need a park and a user.
>>>>
>>>> is there a way for me to fix my problem? like allowing the foreign key 
>>>> to be null or something like that?
>>>>
>>>> thanks in advance
>>>>
>>>

-- 
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/-/EyGby9pYGwMJ.
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 with foreignkeys

2012-05-13 Thread psychok7
yes, like a park doesn't have to have comments, but all the comments must 
have an associated park and user all the time.

what is the django syntax for me to achieve this?

On Monday, May 14, 2012 2:49:18 AM UTC+1, jondykeman wrote:
>
> As far as I understand it the ForeignKey will have to be unique=True and 
> null=False.
>
> I want to get a better sense of what you are trying to achieve. Is it that 
> you want to link comment and park only some of the time?
>
> JD
>
> On Sunday, May 13, 2012 7:41:39 PM UTC-6, psychok7 wrote:
>>
>> so i have this 2 models (Comment and Park)
>>
>> Comment has a foreign key to USER and PARK
>>
>> PARK has a foreign key to Comment
>>
>> my question is, isn't there going to be a deadlock if i don't have a 
>> comment or a park created? i mean , in order to create a Park i need to 
>> have a comment, and in order to create a comment i need a park and a user.
>>
>> is there a way for me to fix my problem? like allowing the foreign key to 
>> be null or something like that?
>>
>> thanks in advance
>>
>

-- 
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/-/PWlOdt96LYwJ.
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.



help with foreignkeys

2012-05-13 Thread psychok7
so i have this 2 models (Comment and Park)

Comment has a foreign key to USER and PARK

PARK has a foreign key to Comment

my question is, isn't there going to be a deadlock if i don't have a 
comment or a park created? i mean , in order to create a Park i need to 
have a comment, and in order to create a comment i need a park and a user.

is there a way for me to fix my problem? like allowing the foreign key to 
be null or something like that?

thanks in advance

-- 
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/-/FklnGDoyGXUJ.
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 with "Key 'timeout' not found in "

2012-05-04 Thread psychok7
by the way kurtis,  i had a bug in the park_id and didn't even notice that 
cause it was working lol, u solve it for me :P

On Friday, May 4, 2012 9:00:43 AM UTC+1, Kurtis wrote:
>
> ahh, okay. Let’s try another approach to see if you can nail down that 
> error. I’m not sure why it’s not working.
>  
> def reserve(request, park_id):
> 
> # Get the User
> # This is different than the method you’re using
> # but I think it may be what you want.
>  
> user = self.request.user
>  
> # Grab that Notification and Park
> # In your method, you were throwing a 404 error. I’m
> # not sure if that’s what you’re actually after (page not found)
> # or if you’d rather give a server error because the user attempted
> # to use a notification or park that didn’t exist.
>  
> # Also, I’m a bit confused by the variable names, haha. I’d think the 
> Park
> # object would take the park_id and the Notification object would use
> # something else.
>  
> notification = Notification.objects.get(pk = park_id)
> park = Park.objects.get(pk = 1)
>  
> # This will check to see if that POST Variable is available.
> if ’timeout’ is in request.POST:
>  
> # Grab the Timeout Variable
> timeout = int(request.POST[’timeout’])
>  
> # Let’s build the Reservation object piece by piece to see what 
> the problem is.
> reservation = Reservation.objects.create()
> reservation.user = user
> # 
> reservation.notification = notification
> reservation.timeout = timeout
> # ...
> reservation.save()
>  
> return HttpResponse(...)
>  
> # This is the error case where the timeout wasn’t POST'ed.
> else:
> raise Exception(”The timeout variable wasn’t posted.”)
>  
> This time, you should see exactly where that error is popping up. Also, 
> ModelForm + CreateView would be a great an easy combination for this exact 
> situation.
>
> Good luck!
> -Kurtis Mullins
>  
> *
> * *Sent:* Thursday, May 03, 2012 4:47:56 PM
> *To:* django-users@googlegroups.com
> *Subject:* Re: help with "Key 'timeout' not found in "
>   
> timeout field is just an INTEGER.. just saying the amount of time the 
> space will be reserved.
>
>  
>
> class Reservation(models.Model):user = models.ForeignKey(User)
> park = models.ForeignKey(Park)notification = 
> models.ForeignKey(Notification)timeout = models.IntegerField()active 
> = models.BooleanField()parked = models.BooleanField()reservation_date 
> = models.DateTimeField('date reserved')
>
>
> On Thursday, May 3, 2012 11:58:19 PM UTC+1, Kurtis wrote:
>>
>> Can we see what your "Reservation" model looks like? Specifically, that 
>> 'timeout' field?
>>
>>
>> hi i have done a succefull query and i converted the results into links 
>>> so i can make a post by clicking on the links to make a reservation.
>>>
>>> my problem is, theres a variable timeout that i want to specify 
>>> manually, but i get a "Key 'timeout' not found in " 
>>>
>>>  
>>> i know i am supposed to pass that variable but i just dont know how. 
>>>
>>>  
>>> my code is :  
>>>
>>>  
>>> def reserve (request,user_id,park_id):
>>> #only works if the user exists in database
>>> u = get_object_or_404(User, pk=user_id)
>>> n = get_object_or_404(**Notification, pk=park_id)
>>> p = get_object_or_404(Park, pk=1)
>>> r = Reservation(user=u ,notification=n, park=p, 
>>> timeout=int(request.POST['**timeout']),active=True,parked=**
>>> False,reservation_date=**datetime.now())
>>> r.save()
>>> return HttpResponse('Spot reserved')
>>>
>>>  
>>> html: 
>>>
>>>  
>>> {% if parks %} You searched for: {{ query }} 
>>> Found {{ parks|length }} park{{ parks|pluralize }}.  {% for park 
>>> in parks %}  
>>> {{ 
>>> park.park_address }} {% endfor %}  {% endif %}
>>>
>>>  
>>> can someone help me? 
>>>
>>>  
>>> -- 
>>> 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/-/**iTBJptqGhyoJ
>>> .
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to django-users+unsubscribe@*
>>> *googlegroups.com .
>>> For more options, visit this group at http://groups.google.com/**
>>> group/django-users?hl=en
>>> .
>>>
>>
>>   
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/KGbfHKRKmrYJ.
> 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:/

Re: help with "Key 'timeout' not found in "

2012-05-04 Thread psychok7
thanks guys it worked. i did a POST from and it worked ;)

cheers

On Friday, May 4, 2012 8:58:58 AM UTC+1, Jani Tiainen wrote:
>
>
> 4.5.2012 1:22, psychok7 kirjoitti: 
> > hi i have done a succefull query and i converted the results into links 
> > so i can make a post by clicking on the links to make a reservation. 
>
> No, you haven't. When you click you'll still send very much standard GET 
> request to server. You can and should verify that by using some 
> debugging console. 
>
> > my problem is, theres a variable timeout that i want to specify 
> > manually, but i get a "Key 'timeout' not found in " 
> > 
> > i know i am supposed to pass that variable but i just dont know how. 
>
> > my code is : 
> > 
> > def reserve (request,user_id,park_id): 
> > #only works if the user exists in database 
> > u = get_object_or_404(User, pk=user_id) 
> > n = get_object_or_404(Notification, pk=park_id) 
> > p = get_object_or_404(Park, pk=1) 
> > r = Reservation(user=u ,notification=n, park=p, 
> > 
> timeout=int(request.POST['timeout']),active=True,parked=False,reservation_date=datetime.now())
>  
>
> > r.save() 
> > return HttpResponse('Spot reserved') 
> > 
> > html: 
> > 
> > {% if parks %} You searched for: {{ query }} 
> > Found {{ parks|length }} park{{ parks|pluralize }}.  {% for 
> > park in parks %}  > id="timeout"> {{ park.park_address }} {% endfor %}  {% endif %} 
> > 
> > can someone help me? 
>
> If above is your true HTML and nothing removed you're just creating list 
> of standard links. 
>
> If you want to pass additional parameters there is few ways to achieve it: 
>
> a) You can modify your sent url by javascript and add timeout manually 
> to get query parameters. 
>
> b) You transform your links to selectable list/dropdown and create real 
> HTML form to send post with real submit button. 
>
> c) Hybrid of a and b. I won't go into details since it would be just a 
> mess. 
>
> -- 
> Jani Tiainen 
>
> - Well planned is half done and a half done has been sufficient before... 
>

-- 
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/-/bRe-Gj-8qJcJ.
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 with "Key 'timeout' not found in "

2012-05-03 Thread psychok7
timeout field is just an INTEGER.. just saying the amount of time the space 
will be reserved.

class Reservation(models.Model):user = models.ForeignKey(User)park 
= models.ForeignKey(Park)notification = models.ForeignKey(Notification)
timeout = models.IntegerField()active = models.BooleanField()parked = 
models.BooleanField()reservation_date = models.DateTimeField('date 
reserved')


On Thursday, May 3, 2012 11:58:19 PM UTC+1, Kurtis wrote:
>
> Can we see what your "Reservation" model looks like? Specifically, that 
> 'timeout' field?
>
>
> hi i have done a succefull query and i converted the results into links so 
>> i can make a post by clicking on the links to make a reservation.
>>
>> my problem is, theres a variable timeout that i want to specify manually, 
>> but i get a "Key 'timeout' not found in "
>>
>> i know i am supposed to pass that variable but i just dont know how.
>>
>> my code is : 
>>
>> def reserve (request,user_id,park_id):
>> #only works if the user exists in database
>> u = get_object_or_404(User, pk=user_id)
>> n = get_object_or_404(Notification, pk=park_id)
>> p = get_object_or_404(Park, pk=1)
>> r = Reservation(user=u ,notification=n, park=p, 
>> timeout=int(request.POST['timeout']),active=True,parked=False,reservation_date=datetime.now())
>> r.save()
>> return HttpResponse('Spot reserved')
>>
>> html: 
>>
>> {% if parks %} You searched for: {{ query }} 
>> Found {{ parks|length }} park{{ parks|pluralize }}.  {% for park 
>> in parks %}  
>> {{ 
>> park.park_address }} {% endfor %}  {% endif %}
>>
>> can someone help me?
>>
>> -- 
>> 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/-/iTBJptqGhyoJ.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KGbfHKRKmrYJ.
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.



help with "Key 'timeout' not found in "

2012-05-03 Thread psychok7
hi i have done a succefull query and i converted the results into links so 
i can make a post by clicking on the links to make a reservation.

my problem is, theres a variable timeout that i want to specify manually, 
but i get a "Key 'timeout' not found in "

i know i am supposed to pass that variable but i just dont know how.

my code is : 

def reserve (request,user_id,park_id):
#only works if the user exists in database
u = get_object_or_404(User, pk=user_id)
n = get_object_or_404(Notification, pk=park_id)
p = get_object_or_404(Park, pk=1)
r = Reservation(user=u ,notification=n, park=p, 
timeout=int(request.POST['timeout']),active=True,parked=False,reservation_date=datetime.now())
r.save()
return HttpResponse('Spot reserved')

html: 

{% if parks %} You searched for: {{ query }} 
Found {{ parks|length }} park{{ parks|pluralize }}.  {% for park 
in parks %}  
{{ 
park.park_address }} {% endfor %}  {% endif %}

can someone help me?

-- 
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/-/iTBJptqGhyoJ.
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: Server push ajax

2012-04-24 Thread psychok7
forget it thats an alpha version just noticed now.

ill give it a go with the servers..

they replace djangos default server ?? or its an addon?

On Tuesday, April 24, 2012 4:33:12 PM UTC+1, psychok7 wrote:
>
> i read and tried to implement all of them with no luck then 
> (mostly dependencies problems)
>
> anyways i noticed i need a diferent server to try them, (with comet 
> support in one case) and im not sure wich one is djangos default, but this 
> one doesnt say anything about "other" servers 
> https://bitbucket.org/cellarosi/django-push 
>
> anyone used this one before? (i havent got it working yet though)
>
> On Tuesday, April 24, 2012 2:17:11 PM UTC+1, Mike Ryan wrote:
>>
>> The vague, open-ended nature of your questions gives me the impression 
>> that you are trying to get the group to do most of the hard work for 
>> you. 
>>
>> Tom's suggestion is right - Pubsub definitely sounds like the way to 
>> go for your project. The TCP protocol doesn't make any specific 
>> reference to AJAX either, but AJAX works rather well over it 
>> nonetheless :-) 
>>
>> As for the two Django packages - download and install them, try them 
>> out, see which one fits your needs best. If you have a specific 
>> problem with one of them and need some assistance, I'm sure people on 
>> this list (or StackOverflow) will be happy to help. 
>>
>> On Apr 24, 2:46 pm, psychok7  wrote: 
>> > i found  django-*push server*  and  django-push<
>> https://www.google.pt/search?hl=en&sa=X&ei=B6CWT9qBBsGv0QWvmJmMDg&ved...> 
>>
>> > 
>> > can anyone tell me if they are very differente, and wich one is easier 
>> (and 
>> > good) to use? 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > On Tuesday, April 24, 2012 12:14:17 PM UTC+1, psychok7 wrote: 
>> > 
>> > > hi, i have to implement  a S 
>> > > erver push with django for a school project. my friend said that its 
>> very 
>> > > hard to make it work, that the software around is still buggy and 
>> all. 
>> > 
>> > > it that true? can you guide me to a easy way to implement this that 
>> works 
>> > > without any problems or workarounds? 
>> > 
>> > > i am still new to django and i dont have a lot of time so if you guys 
>> tell 
>> > > me its gonna take a lot of time ill probably switch to java or so
>
>

-- 
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/-/kvqFo0wrT9UJ.
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: Server push ajax

2012-04-24 Thread psychok7
i read and tried to implement all of them with no luck then 
(mostly dependencies problems)

anyways i noticed i need a diferent server to try them, (with comet support 
in one case) and im not sure wich one is djangos default, but this one 
doesnt say anything about "other" servers 
https://bitbucket.org/cellarosi/django-push 

anyone used this one before? (i havent got it working yet though)

On Tuesday, April 24, 2012 2:17:11 PM UTC+1, Mike Ryan wrote:
>
> The vague, open-ended nature of your questions gives me the impression 
> that you are trying to get the group to do most of the hard work for 
> you. 
>
> Tom's suggestion is right - Pubsub definitely sounds like the way to 
> go for your project. The TCP protocol doesn't make any specific 
> reference to AJAX either, but AJAX works rather well over it 
> nonetheless :-) 
>
> As for the two Django packages - download and install them, try them 
> out, see which one fits your needs best. If you have a specific 
> problem with one of them and need some assistance, I'm sure people on 
> this list (or StackOverflow) will be happy to help. 
>
> On Apr 24, 2:46 pm, psychok7  wrote: 
> > i found  django-*push server*  and  django-push<
> https://www.google.pt/search?hl=en&sa=X&ei=B6CWT9qBBsGv0QWvmJmMDg&ved...> 
> > 
> > can anyone tell me if they are very differente, and wich one is easier 
> (and 
> > good) to use? 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Tuesday, April 24, 2012 12:14:17 PM UTC+1, psychok7 wrote: 
> > 
> > > hi, i have to implement  a S 
> > > erver push with django for a school project. my friend said that its 
> very 
> > > hard to make it work, that the software around is still buggy and all. 
> > 
> > > it that true? can you guide me to a easy way to implement this that 
> works 
> > > without any problems or workarounds? 
> > 
> > > i am still new to django and i dont have a lot of time so if you guys 
> tell 
> > > me its gonna take a lot of time ill probably switch to java or so

-- 
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/-/BqRbxmubJsMJ.
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: Server push ajax

2012-04-24 Thread psychok7
i found  django-*push server*  and  
django-push<https://www.google.pt/search?hl=en&sa=X&ei=B6CWT9qBBsGv0QWvmJmMDg&ved=0CBUQBSgA&q=django-push+server+vs+django-push&spell=1>

can anyone tell me if they are very differente, and wich one is easier (and 
good) to use?

On Tuesday, April 24, 2012 12:14:17 PM UTC+1, psychok7 wrote:
>
> hi, i have to implement  a S

 

> erver push with django for a school project. my friend said that its very 
> hard to make it work, that the software around is still buggy and all.
>
> it that true? can you guide me to a easy way to implement this that works 
> without any problems or workarounds?
>
> i am still new to django and i dont have a lot of time so if you guys tell 
> me its gonna take a lot of time ill probably switch to java or so
>

-- 
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/-/FFfp5oQy-5sJ.
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: Server push ajax

2012-04-24 Thread psychok7
i have searched for ajax before and found very "divergente" comments (most 
of them being related to updates and stuff) so thats why i am asking here, 
i suposed you guys know better and can guide me towards the right way

PS: django-pubsub could work for wht i need, but i didnt see any ajax or 
websockets in the description though

ok so basically i have to develop a game, using django server and 
javascript for the client. i want the django server to update all the 
connected clients thats the state of the game has change.. thats why i need 
my server to push the info the all the clients when he needs to

On Tuesday, April 24, 2012 12:33:35 PM UTC+1, Tom Evans wrote:
>
>
> > hi, i have to implement  a Server push with django for a school project. 
> my
> > friend said that its very hard to make it work, that the software around 
> is
> > still buggy and all.
> >
> > it that true? can you guide me to a easy way to implement this that works
> > without any problems or workarounds?
> >
> > i am still new to django and i dont have a lot of time so if you guys 
> tell
> > me its gonna take a lot of time ill probably switch to java or so
> >
>
> Have you done your research, eg by googling for appropriate existing
> technology. I'd start with "Django pub sub".
>
> Cheers
>
> Tom
>
>

-- 
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/-/kQX-wkSvbdwJ.
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: Server push ajax

2012-04-24 Thread psychok7
what about websockets?? are they better and easier to implement than ajax 
or not?

On Tuesday, April 24, 2012 12:14:17 PM UTC+1, psychok7 wrote:
>
> hi, i have to implement  a Server push with django for a school project. 
> my friend said that its very hard to make it work, that the software around 
> is still buggy and all.
>
> it that true? can you guide me to a easy way to implement this that works 
> without any problems or workarounds?
>
> i am still new to django and i dont have a lot of time so if you guys tell 
> me its gonna take a lot of time ill probably switch to java or so
>

-- 
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/-/xOxA3fxXuTQJ.
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.



Server push ajax

2012-04-24 Thread psychok7
hi, i have to implement  a Server push with django for a school project. my 
friend said that its very hard to make it work, that the software around is 
still buggy and all.

it that true? can you guide me to a easy way to implement this that works 
without any problems or workarounds?

i am still new to django and i dont have a lot of time so if you guys tell 
me its gonna take a lot of time ill probably switch to java or so

-- 
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/-/pHg4ljqCoMwJ.
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: request.is_ajax() not working

2012-04-23 Thread psychok7
i am using Chrome.

to be honest i dont really understand everything you are talking about, so 
ill just try to run your code and see if i can get results 
on the other hand if i use GET instead of POST i dont have to worry about CSRF 
right?

i am not sure you understood my question though, i am getting a 
HTTPRESPONSE, just not the one inside request.is_ajax()

i have read too much documentation on the net (old and new) so i guess 
thats why  i am confused now and just need something that works and only 
after that i will try to understand why does it work

On Monday, April 23, 2012 1:34:16 PM UTC+1, Masklinn wrote:
>
>
> On 2012-04-23, at 13:48 , psychok7 wrote:
>
> > yes i did that now, and still doesnt work.. it still returns false and 
> > doesnt print the line after request.is_ajax()
> > 
>
> I can't reproduce the issue with a trivial repro case (see attached 
> module),
> so with the little information you've provided the only thing my psychic
> debugger yield was "are you using Firefox" as it has a long-standing bug
> of not conserving headers on redirections[0][1], but that would make the 
> entire
> CSRF fail. *Unless* it redirects to a GET request, since you're not 
> checking
> whether the method is GET or POST (which you really should, incidentally)
> this would bypass the CSRF check (even though it'd lose the header), and 
> would
> lose the X-Requested-By header (set by jquery) which Django uses to know
> whether a request "is ajax" or not.
>
> So I'd recommend looking into that, and taking a long look at you 
> javascript
> console's Network tab to see what kind of calls are being sent by the 
> browser
> to django.
>
> [0] https://bugzilla.mozilla.org/show_bug.cgi?id=553888
> [1] On the other hand, it should be fixed in Firefox 7 and above, so you'd
> have to use Firefox *and* use an outdated version of it.
>
>

-- 
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/-/816szwSVDLEJ.
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: request.is_ajax() not working

2012-04-23 Thread psychok7
yes i did that now, and still doesnt work.. it still returns false and 
doesnt print the line after request.is_ajax()

On Monday, April 23, 2012 4:36:06 AM UTC+1, Amao wrote:
>
> dear psychok7:
> You have no data from your ajax post, you should post some data with 
> your ajax post, like this 
> $.post("api/newdoc/", {'user':'your username'}, function(data) {
> alert(data);
> });
> }
>
> 在 2012年4月23日星期一,psychok7 写道:
>
>> hi there i am trying a simple example using AJAX, DJANGO, JQUERY, JSON 
>> and my if request.is_ajax() is not working for some reason.. here is my 
>> code:
>>
>> URLS: (r'api/newdoc/$', 'rose_miracle.views.newdoc'),
>>
>> VIEW:
>> def newdoc(request):
>> # only process POST request
>> print "entrei"
>> if request.is_ajax():
>> print "entrei2" _#this is not working
>> data= dict(request.POST)
>> print data
>> # save data to db
>>
>> return HttpResponse(simplejson.dumps([True]))
>> 
>> return HttpResponse(simplejson.dumps([False]))
>>
>> js:
>> $(document).ready(function(){
>> 
>>
>> alert("ya");
>> $.post("api/newdoc/", function(data) {
>> alert(data);
>> });
>> }
>>
>>
>> i added this in a file as well, dont know how it works though 
>> https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax
>>
>> the print in my request.is_ajax()  is now working, what im i doing wrong??
>>
>>  -- 
>> 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/-/J9sGcOB5wBwJ.
>> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/VLZFfoW8PtAJ.
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.



request.is_ajax() not working

2012-04-22 Thread psychok7
hi there i am trying a simple example using AJAX, DJANGO, JQUERY, JSON and 
my if request.is_ajax() is not working for some reason.. here is my code:

URLS: (r'api/newdoc/$', 'rose_miracle.views.newdoc'),

VIEW:
def newdoc(request):
# only process POST request
print "entrei"
if request.is_ajax():
print "entrei2" _#this is not working
data= dict(request.POST)
print data
# save data to db

return HttpResponse(simplejson.dumps([True]))

return HttpResponse(simplejson.dumps([False]))

js:
$(document).ready(function(){

   
alert("ya");
$.post("api/newdoc/", function(data) {
alert(data);
});
}


i added this in a file as well, dont know how it works 
though https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax

the print in my request.is_ajax()  is now working, what im i doing wrong??

-- 
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/-/J9sGcOB5wBwJ.
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: user registration help please

2012-04-21 Thread psychok7
i upgraded to 0.8 and start doing things your way and it seems to work 
fine. i just have one question, is this code OK or yours is better? if yes 
why is that?

def create_user_profile(sender, instance, created, **kwargs):

if created:

UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)


On Saturday, April 21, 2012 10:51:18 PM UTC+1, Ejah wrote:
>
> No problem. You would need to upgrade to 0.8 to make this work. 
> Enjoy! 
>
> On Apr 21, 11:46 pm, psychok7  wrote: 
> > yes 0.7 , well ill give it a try then :) if i run into problems i will 
> > bother you a little bit further 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Saturday, April 21, 2012 10:33:32 PM UTC+1, Ejah wrote: 
> > 
> > > Hi, 
> > > What version of django-registration are you using? I assume 0.7 
> > > The usage of profile_callback has been removed in 0.8, a very recent 
> > > release actually, looking at the codebase history. 
> > > The finer documentation on the usage of 0.8 is made available at: 
> > >http://docs.b-list.org/django-registration/0.8/ 
> > 
> > > What you are looking for was originally provided for in django- 
> > > profiles, which integrated nicely with django-registration. 
> > 
> > > However, the way to go now is to create a new app, add your user 
> > > profile class there, and connect to the 
> > > registration.signals.user_registered signal. 
> > 
> > > Small example: 
> > 
> > > models.py (in myapp) 
> > > from django.db import models 
> > > from registration.signals import user_registered 
> > > from django.dispatch import receiver 
> > 
> > > class MySuperDuperUserProfile(models.Model): 
> > > user = models.ForeignKey(User) 
> > > whatever = models.CharField(max_length=100) 
> > > wherever = models.CharField(max_length=50) 
> > 
> > > @receiver(user_registered) 
> > > def create_superduper_user_profile(sender, **kwargs): 
> > > new_user = kwargs.pop('user', None) 
> > > data_dict_from_registration_form = kwargs.pop('request', 
> > > None).POST 
> > > sdup = MySuperDuperUserProfile() 
> > > sdup.user = new_user 
> > > sdup.whatever = data_dict_from_registration_form['whatever'] 
> > > sdup.wherever = data_dict_from_registration_form['wherever'] 
> > > sdup.save() 
> > 
> > > That's all folks. No messing around with existing code. You can create 
> > > a custom registration form in which you add your profile fields, that 
> > > you pass to the registration view via de url, and get the form fields 
> > > from the request that also gets sent to the 
> > > create_superduper_user_function. Please note I did not run this sample 
> > > code, so some bugs certainly will be there. 
> > > HTH 
> > > Cheers 
> > 
> > > On Apr 21, 4:42 pm, psychok7  wrote: 
> > > > Ejah i did that because in registration source code there are some 
> > > values 
> > > > in Profile_callback set to NONE.. should i leave it like that?? the 
> > > > comments say i should change it and equal it to my user profile. is 
> that 
> > > it 
> > > > or i am doing it the wrong way? 
> > 
> > > > On Saturday, April 21, 2012 3:29:40 PM UTC+1, Ejah wrote: 
> > 
> > > > > If I am not mistaken you are editting the Registration source 
> files. 
> > > > > There is no need to do that. 
> > > > > Simply add a new App. Create your user profile class in its 
> models.py 
> > > > > file, name it whatever you like. Add registration and your App to 
> the 
> > > > > installed_apps in your settings file. Edit the settings file and 
> make 
> > > > > your model class the userprofile USER_PROFILE=yourclassname 
> > > > > Add the urls from django-registration to your projects urls.py. 
> > > > > Register your model in the admin, syncdb and your profile will 
> show 
> > > > > up. 
> > > > > You can read the docs on djangoproject.com on how to do that, its 
> > > > > easy. 
> > > > > The docs on registration are short but accurate, and the source is 
> > > > > well documented. 
> > > > > Hth 
> > 
> > > > > On 21 apr, 15:50, Brandy  wrote: 
> > > > > > Have you created an admin.py file? It should l

Re: image KeyError

2012-04-21 Thread psychok7
ok i was copy pasting from example on the internet.. where do i check if it 
exists or not?

On Saturday, April 21, 2012 11:14:12 PM UTC+1, akaariai wrote:
>
> On Apr 21, 11:30 pm, psychok7  wrote: 
> > hi there , so i am not sure if i am doing this the right way, but 
> > im successfully able to upload files(images) and store them in my 
> defined 
> > folder  and the link in my mysql  database. 
> >  the error comes when i try to return the image with the HTTP RESPONSE 
> were 
> > i get a image keyError.. i am not sure wht i am doing wrong.. 
> > here is my code: 
> > 
> > def handle_uploaded_file(f,u): 
> > profile=u.get_profile() 
> > profile.avatar=f.name 
> > destination = open('images/users/'+f.name, 'wb+') 
> > for chunk in f.chunks(): 
> > destination.write(chunk) 
> > destination.close() 
> > profile.save() 
> > 
> > def upload_file(request,user_id): 
> > u = get_object_or_404(User, pk=user_id) 
> > if request.method == 'POST': 
> > form = UploadFileForm(request.POST, request.FILES) 
> > if form.is_valid(): 
> > handle_uploaded_file(request.FILES['file'],u) 
> > uploadedImage = form.cleaned_data['image'] 
> > 
> > return 
> HttpResponse(uploadedImage.content,mimetype="image/jpeg") 
> > else: 
> > form = UploadFileForm() 
> > 
> > c = {'form': form,'user' : u} 
> > c.update(csrf(request)) 
> > return render_to_response('accounts/upload.html', c) 
> > 
> >  
> >{% csrf_token %} 
> > 
> >{{form.as_table}} 
> >  
> >  
> >  
> > 
> > thanks in advance 
>
> Your question is very hard to answer without the full error message. 
> Some wild guesses of what is going wrong: maybe the 
> cleaned_data['image'] is missing or it isn't a file? 
>
>  - Anssi

-- 
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/-/8pI1Lg1gohkJ.
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: user registration help please

2012-04-21 Thread psychok7
yes 0.7 , well ill give it a try then :) if i run into problems i will 
bother you a little bit further

On Saturday, April 21, 2012 10:33:32 PM UTC+1, Ejah wrote:
>
> Hi, 
> What version of django-registration are you using? I assume 0.7 
> The usage of profile_callback has been removed in 0.8, a very recent 
> release actually, looking at the codebase history. 
> The finer documentation on the usage of 0.8 is made available at: 
> http://docs.b-list.org/django-registration/0.8/ 
>
> What you are looking for was originally provided for in django- 
> profiles, which integrated nicely with django-registration. 
>
> However, the way to go now is to create a new app, add your user 
> profile class there, and connect to the 
> registration.signals.user_registered signal. 
>
> Small example: 
>
> models.py (in myapp) 
> from django.db import models 
> from registration.signals import user_registered 
> from django.dispatch import receiver 
>
> class MySuperDuperUserProfile(models.Model): 
> user = models.ForeignKey(User) 
> whatever = models.CharField(max_length=100) 
> wherever = models.CharField(max_length=50) 
>
> @receiver(user_registered) 
> def create_superduper_user_profile(sender, **kwargs): 
> new_user = kwargs.pop('user', None) 
> data_dict_from_registration_form = kwargs.pop('request', 
> None).POST 
> sdup = MySuperDuperUserProfile() 
> sdup.user = new_user 
> sdup.whatever = data_dict_from_registration_form['whatever'] 
> sdup.wherever = data_dict_from_registration_form['wherever'] 
> sdup.save() 
>
> That's all folks. No messing around with existing code. You can create 
> a custom registration form in which you add your profile fields, that 
> you pass to the registration view via de url, and get the form fields 
> from the request that also gets sent to the 
> create_superduper_user_function. Please note I did not run this sample 
> code, so some bugs certainly will be there. 
> HTH 
> Cheers 
>
>
>
>
>
>
>
> On Apr 21, 4:42 pm, psychok7  wrote: 
> > Ejah i did that because in registration source code there are some 
> values 
> > in Profile_callback set to NONE.. should i leave it like that?? the 
> > comments say i should change it and equal it to my user profile. is that 
> it 
> > or i am doing it the wrong way? 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Saturday, April 21, 2012 3:29:40 PM UTC+1, Ejah wrote: 
> > 
> > > If I am not mistaken you are editting the Registration source files. 
> > > There is no need to do that. 
> > > Simply add a new App. Create your user profile class in its models.py 
> > > file, name it whatever you like. Add registration and your App to the 
> > > installed_apps in your settings file. Edit the settings file and make 
> > > your model class the userprofile USER_PROFILE=yourclassname 
> > > Add the urls from django-registration to your projects urls.py. 
> > > Register your model in the admin, syncdb and your profile will show 
> > > up. 
> > > You can read the docs on djangoproject.com on how to do that, its 
> > > easy. 
> > > The docs on registration are short but accurate, and the source is 
> > > well documented. 
> > > Hth 
> > 
> > > On 21 apr, 15:50, Brandy  wrote: 
> > > > Have you created an admin.py file? It should look something like 
> this: 
> > 
> > > > from poll.models import Poll 
> > > > from django.contrib import admin 
> > 
> > > > admin.site.register(Poll) 
> > 
> > > > On Saturday, April 21, 2012 12:28:05 AM UTC-5, psychok7 wrote: 
> > > > > hi there, i am quite new to django and i am having a little 
> trouble 
> > > > > extending my User with Userprofile. i have read lots of 
> documentation 
> > > about 
> > > > > it and i have implemented as an extension of 
> > > > >https://bitbucket.org/ubernostrum/django-registrationaversion but 
> i 
> > > am 
> > > > > not sure it works the way its supposed to. basically when i create 
> a 
> > > new 
> > > > > user (in admin view), only the basic built in fields show up, but 
> my 
> > > new 
> > > > > fields don't.. on the other hand my database seems to be ok with 
> one 
> > > table 
> > > > > for user and another for user profile with the ids matching. can 
> you 
> > > guys 
> > > > > help me and let me know wht am i doing wrong and wh

Re: user registration help please

2012-04-21 Thread psychok7
thanks guys, i also did some tests without changing the registration source 
by doing get_profile() and it seems to work fine so i guess the less i 
touch it the better

On Saturday, April 21, 2012 4:41:21 PM UTC+1, Brandy wrote:
>
> It looks correct. Is everything showing up now?
>  
>
> On Saturday, April 21, 2012 9:38:51 AM UTC-5, psychok7 wrote:
>
>> its seemed to work, thanks 
>> from django.contrib import admin
>>
>> from registration.models import RegistrationProfile , UserProfile
>>
>>
>> class RegistrationAdmin(admin.ModelAdmin):
>> list_display = ('__unicode__', 'activation_key_expired')
>> search_fields = ('user__username', 'user__first_name')
>>
>>
>> admin.site.register(RegistrationProfile, RegistrationAdmin)
>> admin.site.register(UserProfile)
>>
>> is this the correct way to do this? the associacions are there now in 
>> admin
>>
>> On Saturday, April 21, 2012 2:50:27 PM UTC+1, Brandy wrote:
>>>
>>> Have you created an admin.py file? It should look something like this:
>>>  
>>> from poll.models import Poll
>>> from django.contrib import admin
>>>  
>>> admin.site.register(Poll)
>>>  
>>>
>>> On Saturday, April 21, 2012 12:28:05 AM UTC-5, psychok7 wrote:
>>>
>>>> hi there, i am quite new to django and i am having a little trouble 
>>>> extending my User with Userprofile. i have read lots of documentation 
>>>> about 
>>>> it and i have implemented as an extension of 
>>>> https://bitbucket.org/ubernostrum/django-registration a version but i 
>>>> am not sure it works the way its supposed to. basically when i create a 
>>>> new 
>>>> user (in admin view), only the basic built in fields show up, but my new 
>>>> fields don't.. on the other hand my database seems to be ok with one table 
>>>> for user and another for user profile with the ids matching. can you guys 
>>>> help me and let me know wht am i doing wrong and whats the correct way? 
>>>> PLEASE don't refer me back to the documentation because i have read it all
>>>>
>>>> here is my code:
>>>> http://paste.ubuntu.com/939226/
>>>> http://paste.ubuntu.com/939227/
>>>> http://paste.ubuntu.com/939229/
>>>>
>>>> i also added AUTH_PROFILE_MODULE = 'registration.UserProfile' in 
>>>> settings.py
>>>>
>>>

-- 
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/-/pTCTljlgQ08J.
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: user registration help please

2012-04-21 Thread psychok7
Ejah i did that because in registration source code there are some values 
in Profile_callback set to NONE.. should i leave it like that?? the 
comments say i should change it and equal it to my user profile. is that it 
or i am doing it the wrong way?

On Saturday, April 21, 2012 3:29:40 PM UTC+1, Ejah wrote:
>
> If I am not mistaken you are editting the Registration source files. 
> There is no need to do that. 
> Simply add a new App. Create your user profile class in its models.py 
> file, name it whatever you like. Add registration and your App to the 
> installed_apps in your settings file. Edit the settings file and make 
> your model class the userprofile USER_PROFILE=yourclassname 
> Add the urls from django-registration to your projects urls.py. 
> Register your model in the admin, syncdb and your profile will show 
> up. 
> You can read the docs on djangoproject.com on how to do that, its 
> easy. 
> The docs on registration are short but accurate, and the source is 
> well documented. 
> Hth 
>
> On 21 apr, 15:50, Brandy  wrote: 
> > Have you created an admin.py file? It should look something like this: 
> > 
> > from poll.models import Poll 
> > from django.contrib import admin 
> > 
> > admin.site.register(Poll) 
> > 
> > 
> > 
> > On Saturday, April 21, 2012 12:28:05 AM UTC-5, psychok7 wrote: 
> > > hi there, i am quite new to django and i am having a little trouble 
> > > extending my User with Userprofile. i have read lots of documentation 
> about 
> > > it and i have implemented as an extension of 
> > >https://bitbucket.org/ubernostrum/django-registrationa version but i 
> am 
> > > not sure it works the way its supposed to. basically when i create a 
> new 
> > > user (in admin view), only the basic built in fields show up, but my 
> new 
> > > fields don't.. on the other hand my database seems to be ok with one 
> table 
> > > for user and another for user profile with the ids matching. can you 
> guys 
> > > help me and let me know wht am i doing wrong and whats the correct 
> way? 
> > > PLEASE don't refer me back to the documentation because i have read it 
> all 
> > 
> > > here is my code: 
> > >http://paste.ubuntu.com/939226/ 
> > >http://paste.ubuntu.com/939227/ 
> > >http://paste.ubuntu.com/939229/ 
> > 
> > > i also added AUTH_PROFILE_MODULE = 'registration.UserProfile' in 
> > > settings.py

-- 
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/-/-BUX5XxdGLQJ.
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: user registration help please

2012-04-21 Thread psychok7
its seemed to work, thanks 
from django.contrib import admin

from registration.models import RegistrationProfile , UserProfile


class RegistrationAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'activation_key_expired')
search_fields = ('user__username', 'user__first_name')


admin.site.register(RegistrationProfile, RegistrationAdmin)
admin.site.register(UserProfile)

is this the correct way to do this? the associacions are there now in admin

On Saturday, April 21, 2012 2:50:27 PM UTC+1, Brandy wrote:
>
> Have you created an admin.py file? It should look something like this:
>  
> from poll.models import Poll
> from django.contrib import admin
>  
> admin.site.register(Poll)
>  
>
> On Saturday, April 21, 2012 12:28:05 AM UTC-5, psychok7 wrote:
>
>> hi there, i am quite new to django and i am having a little trouble 
>> extending my User with Userprofile. i have read lots of documentation about 
>> it and i have implemented as an extension of 
>> https://bitbucket.org/ubernostrum/django-registration a version but i am 
>> not sure it works the way its supposed to. basically when i create a new 
>> user (in admin view), only the basic built in fields show up, but my new 
>> fields don't.. on the other hand my database seems to be ok with one table 
>> for user and another for user profile with the ids matching. can you guys 
>> help me and let me know wht am i doing wrong and whats the correct way? 
>> PLEASE don't refer me back to the documentation because i have read it all
>>
>> here is my code:
>> http://paste.ubuntu.com/939226/
>> http://paste.ubuntu.com/939227/
>> http://paste.ubuntu.com/939229/
>>
>> i also added AUTH_PROFILE_MODULE = 'registration.UserProfile' in 
>> settings.py
>>
>

-- 
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/-/rpzLNyiou7QJ.
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.



user registration help please

2012-04-21 Thread psychok7
hi there, i am quite new to django and i am having a little trouble 
extending my User with Userprofile. i have read lots of documentation about 
it and i have implemented as an extension of 
https://bitbucket.org/ubernostrum/django-registration a version but i am 
not sure it works the way its supposed to. basically when i create a new 
user (in admin view), only the basic built in fields show up, but my new 
fields don't.. on the other hand my database seems to be ok with one table 
for user and another for user profile with the ids matching. can you guys 
help me and let me know wht am i doing wrong and whats the correct way? 
PLEASE don't refer me back to the documentation because i have read it all

here is my code:
http://paste.ubuntu.com/939226/
http://paste.ubuntu.com/939227/
http://paste.ubuntu.com/939229/

i also added AUTH_PROFILE_MODULE = 'registration.UserProfile' in settings.py

-- 
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/-/v5LcwsTXIMcJ.
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.