Re: django.db.utils.DatabaseError: value too long for type character varying(50)

2012-07-13 Thread James Rivett-Carnac
An old post, but I just had the same problem.

On Monday, 20 September 2010 22:51:30 UTC+8, Valentin Golev wrote:
>
> Hello, 
>
> I'm trying to deploy my Django application with PostgreSQL. While 
> trying to insert an object to the database, I'm getting the following 
> error: 
>
>
> django.db.utils.DatabaseError: value too long for type character 
> varying(50) 
>
>
> My application were working fine on SQLite. I guess it has something 
> to do with encoding (my data in in Cyrillic). I thought Django should 
> truncate in on the application level, but it obviously doesn't. What 
> can I do (except for truncating data by myself every time)?

-- 
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/-/_YEERIgzG8sJ.
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: Incorrect post URL on invalid form submissions

2012-07-13 Thread Kevin
I refactored this into a single view (similar to the Django form example) 
and it's working fine...not to mention it's much more DRY.

Feel free to disregard!

Kevin

On Friday, July 13, 2012 3:00:03 PM UTC-5, Kevin wrote:
>
> I'm new to Django so hopefully this will be trivial to solve.
>
> I have a table of data I display in a view along with a simple form to add 
> a new row of data to the table:
>
> def my_data_view(request, data_id):
> myData = MyData.objects.get(pk=data_id)
> if request.method == 'POST':
> myForm = MyForm(request.POST)
> else:
> myForm = MyForm()
> return render_to_response('myapp/mydata.html',
>   { 'my_data' : myData,
> 'my_form' : myForm,},
>   
> context_instance=RequestContext(request))   
>
> def add_new_row(request, data_id):
> myData = MyData.objects.get(pk=data_id)
> if request.method == 'POST':
> myForm = MyForm(request.POST)
> if myForm.is_valid():
> # TODO insert new time into DB
> return HttpResponseRedirect(reverse('myapp.views.mydata', 
> args=(myData.id,)))
> return my_data_view(request, data_id)
>
> This works when I submit a valid form. However submitting an invalid form 
> directs me from myapp/mydata/3 to myapp/mydata/addNewRow/3 which means when 
> I submit the corrected form it posts to myapp/addNewRow/addNewRow/3 which 
> is obviously not what I want. Any suggestions?
>
> Thanks much!
>
> Kevin
>

-- 
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/-/YjQRiYfGyokJ.
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: Extend user model: class inheritance or OneToOneField?

2012-07-13 Thread Ernesto Guevara
Hi!

I prefer using OnetoOne with a pre_delete signal to remove user from a
pirncipal object instance:

from django.contrib.auth.models import User
from django.db.models.signals import pre_delete
from django.dispatch import receiver

class Customer(User):
user = models.OneToOneField(User)

@receiver(pre_delete, sender=Customer)
def delete_user_customer(sender, instance, **kwargs):
user = User.objects.filter(pk=instance.user.id)
if user:
user.delete()

class Seller(User):
user = models.OneToOneField(User)

@receiver(pre_delete, sender=Seller)
def delete_user_seller(sender, instance, **kwargs):
user = User.objects.filter(pk=instance.user.id)
if user:
user.delete()



2012/7/13 sdonk 

> Hi,
> I'm starting a new project and for the first time I need to extend the
> User model.
> I read the documentation and I googled a lot to try to figure out what is
> the best approach but I got confused.
>
> What's the the best approach?
>
> Class inheritance:
>
> from django.contrib.gis.db import models
> from django.contrib.auth.models import User, UserManager
>
> class myUser(User):
> birthday = models.DateField(null=True, blank=True)
> address = models.CharField(max_length=255, null=True, blank=True)
>
> objects = UserManager()
>
> Or OneToOneField (as doc suggests)
>
>
> from django.contrib.gis.db import models
> from django.contrib.auth.models import User
> from django.db.models.signals import post_save
>
> class myUser(User):
> user = models.OneToOneField(User)
> birthday = models.DateField(null=True, blank=True)
> address = models.CharField(max_length=255, null=True, blank=True)
>
> def __unicode__(self):
>   return u'%s' % self.user
>
> def create_user_profile(sender, instance, created, **kwargs):
> if created:
> myUser.objects.create(user=instance)
>
> post_save.connect(create_user_profile, sender=User)
>
> Thanks,
>
> Alex
>
>  --
> 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/-/KtEPwiHoWbUJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Where to delete model image?

2012-07-13 Thread Ernesto Guevara
Hi!

I have this old code here.

# forms.py

class UploadFileForm(ModelForm):
title = forms.CharField(max_length=250 ,label="Nome:")
original_image = forms.ImageField(label="Imagem:")

class Meta:
model = Photo

# models.py

from django.dispatch import receiver
from django.db.models.signals import pre_delete

class Photo(models.Model):
title = models.CharField(max_length=255)
pub_date = models.DateField(auto_now = True)
original_image = models.ImageField(upload_to='photos')
slug_photo = AutoSlugField(populate_from=('title'), unique=True,
max_length=255, overwrite=True)
model = models.ForeignKey(Model, blank=True, null=True)

@receiver(pre_delete, sender=Photo)
def delete_image(sender, instance, **kwargs):
os.remove(unicode(instance.original_image.path)) # remove the image
from folder "photos"


# views.py

def upload_photo(request):
if request.method == 'POST':
model = get_object_or_404(Model,
pk=request.POST.get("model"))
form = UploadForm(request.POST, request.FILES)
photo_exist = Photo.objects.filter(model__id = model.id)
if not photo_exist:
if form.is_valid():
form.save()
messages.add_message(request, messages.SUCCESS, 'Image save
succesfull!')
return HttpResponseRedirect(reverse('detail_model',
args=[model.slug]))
else:
return
render_to_response('project/app/detail.html',locals(),context_instance=RequestContext(request))

else:
if form.is_valid():
photo_exist.delete()
form.save()
messages.add_message(request, messages.SUCCESS, 'Image
update succesfull!')
return HttpResponseRedirect(reverse('detail_model',
args=[model.slug]))
else:
photo = Photo.objects.get(model__id = model.id)  # send the
photo to detail page
return
render_to_response('project/app/detail.html',locals(),context_instance=RequestContext(request))



2012/7/13 m.paul 

> Hi All,
>
> I have a Model with an image field and I want to be able to change the
> image using a ModelForm. When changing the image, the old image should be
> deleted and replaced by the new image.
>
> I have tried to do this in the clean method of the ModelForm like this:
>
> def clean(self):
> cleaned_data = super(ModelForm, self).clean()
>
> old_profile_image = self.instance.image
> if old_profile_image:
> old_profile_image.delete(save=False)
> return cleaned_data
>
> This works fine unless the file indicated by the user is not correct (for
> example if its not an image), which result in the image being deleted
> without any new images being saved. I would like to know where is the best
> place to delete the old image? By this I mean where can I be sure that the
> new image is correct before deleting the old one? I prefer to do this in my
> ModelForm class if possible but doing it in the Model class would also be
> acceptable.
>
> --
> 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/-/kB0VSrr9O1MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: Form 'POST' to a database

2012-07-13 Thread JJ Zolper
Thank you so much for the clarification!

On Friday, July 13, 2012 5:24:18 PM UTC-4, Jani Tiainen wrote:
>
> You still need to call result.is_valid() since it actually runs actual 
> validation rules.
>
> Very basic form processing is usually done like this:
>
> so in case of GET you return empty form. in case of invalid POST you 
> return form with values and error messages.
>
> After successful POST you do redirect-after-post to avoid problems with 
> browser history back-button.
>
> def form_view(request):
> if request.method == 'POST':
> form = MyForm(request.POST)
> if form.is_valid():
> form.save()
> return HttpResponseRedirect("/some/result/form")
> else:
> form = MyForm()
> return HttpResponse("form/form.html", { 'form': form })
>
> On Thu, Jul 12, 2012 at 4:44 AM, JJ Zolper  wrote:
>
>> I was able to make it work!
>>
>> from django.core.context_processors import csrf
>> from django.template import RequestContext
>> from django.http import HttpResponseRedirect
>> from django.http import HttpResponse
>> from django.shortcuts import render_to_response
>> from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm
>>
>> def about(request):
>> AboutMadtrakInstance = AboutMadtrak()
>> result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
>>  result.save()
>> return HttpResponse('It worked?!? Of course it did. I knew that.')
>>
>> def about_form(request):
>> return render_to_response('about_form.html', context_instance = 
>> RequestContext(request))
>>
>> I ended up looking at ModelForms and trying that since I was having 
>> issues.
>>
>> So does this method handle all validation and security issues for me?
>>
>> Or do I still need a "result.is_valid()" among other things?
>>
>>
>> On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>>>
>>> Hey,
>

>>> yeah, it basicly is. Just a very, very basic example (And sorry if i 
>>> could highlight this as code, i didnt find something in the format-menu :/ 
>>> ).
>>> Of course you should validate your input first. And if you just want to 
>>> edit a Model within a form, you should check on the ModelForm-Class 
>>> https://docs.**djangoproject.com/en/dev/**topics/forms/modelforms/
>>>
>>> def vote(request, poll_id):
>>> try:
>>> obj = YourModel.objects.get(pk=poll_**id)
>>> obj.attributea = request.POST['attributea']
>>> obj.attributeb = request.POST['attributeb']
>>> obj.save()
>>> return HttpResponse(validparamshere)
>>> except ObjectDoesNotExist:
>>> return HttpResponse(show_some_error)
>>>
>>>  
>  -- 
>> 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/-/JTdViX4I6HEJ.
>>
>> 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.
>>
>
>
>
> -- 
> 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/-/_yuwhnXo7ssJ.
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.



Tasking? A fluid user experience with Uploading Media.

2012-07-13 Thread JJ Zolper
Hello everyone,

So I'm pretty new to trying to develop a way to manage tasking. What do I 
mean tasking? Well here is an example:

Let's say I want for part of my website for people to be able to create an 
account and and fill in a lot of fields of data but also 
to be able to upload files. For example lets say I want them to be able to 
upload music files to my site and organize them, etc.
I don't want to load the server down to the point where it crashes or 
anything so I want this uploading of files to be tasked
and somewhat in the background.

I've heard of things like RabbitMQ or Redis and other various things like 
Celery but I really would like some brilliant advice
from the community of django as to any ideas about how to go about this. 
Think of my need like youtube you are uploading a video
but at the same time you can edit fields of information about that video or 
other various things. Except for me there could be much more than just that.
A new user could be uploading media/music files or something at the same 
time as uploading a video of themselves. I want it to be efficient and fast
to the point where it all gets updated but the user can leave this task 
going and leave the page that is updating the file and just check back in 
and 
see a status. In my programming mind this sounds like asynchronous tasking 
of some sort. With little experience in this realm I could use
some help. Any ideas about allow a fluent and fluid setup for my problem to 
solve would be great.

I'm looking for a logical, efficient but also fairly fast way to go about 
trying to head up these tasks to allow for a good user experience.

Thanks for your time,

JJ Zolper

-- 
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/-/j08gcaYM_sAJ.
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 Admin - Index of Entry Being Edited

2012-07-13 Thread lubos
Hello,

I need a way of getting index of the table entry which is being currently 
edited. I think that digging this from url would be the best, as I may need 
it anywhere in admin.py. How could I do it?

Thank you in advance for any suggestion,

Lubos

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



Extend user model: class inheritance or OneToOneField?

2012-07-13 Thread sdonk
Hi,
I'm starting a new project and for the first time I need to extend the User 
model.
I read the documentation and I googled a lot to try to figure out what is 
the best approach but I got confused.

What's the the best approach?

Class inheritance:

from django.contrib.gis.db import models
from django.contrib.auth.models import User, UserManager

class myUser(User):
birthday = models.DateField(null=True, blank=True)
address = models.CharField(max_length=255, null=True, blank=True)

objects = UserManager()

Or OneToOneField (as doc suggests)


from django.contrib.gis.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save

class myUser(User):
user = models.OneToOneField(User)
birthday = models.DateField(null=True, blank=True)
address = models.CharField(max_length=255, null=True, blank=True)

def __unicode__(self):
  return u'%s' % self.user

def create_user_profile(sender, instance, created, **kwargs):
if created:
myUser.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)

Thanks,

Alex

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



Where to delete model image?

2012-07-13 Thread m.paul
 

Hi All,

I have a Model with an image field and I want to be able to change the 
image using a ModelForm. When changing the image, the old image should be 
deleted and replaced by the new image. 

I have tried to do this in the clean method of the ModelForm like this:

def clean(self):
cleaned_data = super(ModelForm, self).clean()

old_profile_image = self.instance.image
if old_profile_image:
old_profile_image.delete(save=False)
return cleaned_data

This works fine unless the file indicated by the user is not correct (for 
example if its not an image), which result in the image being deleted 
without any new images being saved. I would like to know where is the best 
place to delete the old image? By this I mean where can I be sure that the 
new image is correct before deleting the old one? I prefer to do this in my 
ModelForm class if possible but doing it in the Model class would also be 
acceptable. 

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



Announcement: django-s3-cache - Amazon S3 cache backend

2012-07-13 Thread Alexander Todorov
Hi everyone,
I see people are using this list for small announcements so here it is :)

I've just released a (what appears to be) working version of a custom cache 
backend which stores data into Amazon Simple Storage Service (S3). It is 
largely based on the existing filesystem backend with some minor additions. 
It depends on django-storages which implements the actual storage to S3 and 
Boto. 

You can check it out at http://pypi.python.org/pypi/django-s3-cache/ or 
https://github.com/atodorov/django-s3-cache. Hope you find it useful!

I did some manual testing from the console and all appeared to be working 
nicely. In the next few days I will be adding this to my site www.dif.io 
and see how it behaves in production. 

If you wonder why I built it, here's the answer: I need a cache to lower 
the load on my DB server and prepare the site for better times when it will 
have much more users, but I didn't want to maintain my own memcached 
cluster or pay top dollars to Amazon ElastiCache. Storage in S3 is way 
cheaper compared to  other options and is ideal for for startup sites which 
are not heavily utilized. 

Regards,
Alex.

-- 
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/-/YejB52QB0sAJ.
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: Form 'POST' to a database

2012-07-13 Thread Jani Tiainen
You still need to call result.is_valid() since it actually runs actual
validation rules.

Very basic form processing is usually done like this:

so in case of GET you return empty form. in case of invalid POST you return
form with values and error messages.

After successful POST you do redirect-after-post to avoid problems with
browser history back-button.

def form_view(request):
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect("/some/result/form")
else:
form = MyForm()
return HttpResponse("form/form.html", { 'form': form })

On Thu, Jul 12, 2012 at 4:44 AM, JJ Zolper  wrote:

> I was able to make it work!
>
> from django.core.context_processors import csrf
> from django.template import RequestContext
> from django.http import HttpResponseRedirect
> from django.http import HttpResponse
> from django.shortcuts import render_to_response
> from MadTrak.manageabout.models import AboutMadtrak, AboutMadtrakForm
>
> def about(request):
> AboutMadtrakInstance = AboutMadtrak()
> result = AboutMadtrakForm(request.POST, instance=AboutMadtrakInstance)
> result.save()
> return HttpResponse('It worked?!? Of course it did. I knew that.')
>
> def about_form(request):
> return render_to_response('about_form.html', context_instance =
> RequestContext(request))
>
> I ended up looking at ModelForms and trying that since I was having issues.
>
> So does this method handle all validation and security issues for me?
>
> Or do I still need a "result.is_valid()" among other things?
>
>
> On Wednesday, July 11, 2012 11:51:19 AM UTC-4, Andre Schemschat wrote:
>>
>> Hey,

>>>
>> yeah, it basicly is. Just a very, very basic example (And sorry if i
>> could highlight this as code, i didnt find something in the format-menu :/
>> ).
>> Of course you should validate your input first. And if you just want to
>> edit a Model within a form, you should check on the ModelForm-Class
>> https://docs.**djangoproject.com/en/dev/**topics/forms/modelforms/
>>
>> def vote(request, poll_id):
>> try:
>> obj = YourModel.objects.get(pk=poll_**id)
>> obj.attributea = request.POST['attributea']
>> obj.attributeb = request.POST['attributeb']
>> obj.save()
>> return HttpResponse(validparamshere)
>> except ObjectDoesNotExist:
>> return HttpResponse(show_some_error)
>>
>>
  --
> 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/-/JTdViX4I6HEJ.
>
> 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.
>



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



m2m through intermediate model: template friendly syntax not working. dj1.3

2012-07-13 Thread brycenesbitt
I'm able to get an intermediate m2m model to show data, but not with the 
template-friendly "_set" syntax:

category= models.Category.objects.select_related().get(pk=pk)
entries = 
category.entry.order_by('-temp_sort_order').filter(temp_sort_order__gte=0)
for entry in entries:
assert isinstance(entry, models.Entry)
ce = models.CategoryEntry2.objects.get(entry=entry, 
category=category)
pprint('1: ' + ce.wiki + str(entry.ce))
foo = entry.ce_set.get(category=category) #'Entry' object has no 
attribute 'ce_set'
pprint('2: ' + foo.wiki + str(foo.ce))  #'Entry' object has no 
attribute 'ce_set'
for entry in category.ce_set.all:   #'Category' object has no 
attribute 'ce_set'
pprint('1: ' + entry.wiki)

Any ideas?

class Category(models.Model):
title   = models.CharField(max_length=1024,null=True,blank=True)
entry   = models.ManyToManyField(Entry,null=True,blank=True,
 related_name='ce',
 through='CategoryEntry2',
 )

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



m2m through problem: object has no attribute 'ce_set'

2012-07-13 Thread bn
I'm trying to get a template to iterate through and print intermediate 
model data.  Can you look at this and point out what is wrong?  I've tried 
to follow the django docs closely:

def category_detail(request, pk):
category= models.Category.objects.select_related().get(pk=pk)
entries = 
category.entry.order_by('-temp_sort_order').filter(temp_sort_order__gte=0)
for entry in entries:
assert isinstance(entry, models.Entry)

ce = models.CategoryEntry2.objects.get(entry=entry, 
category=category)
pprint('1: ' + ce.wiki + str(entry.ce))# works perfectly

#foo = entry.ce_set.get(category=category) #'Entry' object has no 
attribute 'ce_set'
#pprint('2: ' + foo.wiki + str(foo.ce))  #'Entry' object has no 
attribute 'ce_set'
for entry in category.ce_set.all:   #'Category' object has no 
attribute 'ce_set'
assert isinstance(entry, models.Entry)
pprint('1: ' + entry.wiki)

return render_to_response('category.html'...)

The Category model has a related_name of 'ce'.:

class Category(models.Model):
title   = models.CharField(max_length=1024,null=True,blank=True)
entry   = models.ManyToManyField(Entry,null=True,blank=True,
 related_name='ce',
 through='CategoryEntry2',
 )



-- 
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/-/OHaEVYtohSYJ.
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: Is upgrading to a newer Django version generally hassle-free?

2012-07-13 Thread Carlos Daniel Ruvalcaba Valenzuela
On Fri, Jul 13, 2012 at 1:14 PM, sadpluto  wrote:
>  I have is whether transitioning to newer versions of Django
> is generally easy and well documented. I can only imagine that it is, but I
> haven't found convincing evidence while searching online. It would be great
> to see what's the consensus of experienced developers.

Generally it is, I still have stuff I did on the pre 1.0 versions and
still works with some minor adjustments on the newest 1.4 version.
While it usually is ok to upgrade django versions the best practice is
to test before deploying to production, some times what brokes is 3th
party apps so is better to have an environment similar to production
for testing before final deployment when upgrading versions.

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



Re: Internationalized URL different per language

2012-07-13 Thread Daniel Geržo

On 13.7.2012 21:48, galgal wrote:

I need to make an urlpattern different for each language, but following
to the same view.

for example:
url(r'^category/(?P[\w-]+)/, 'news.views.category',
name='category'), in english
url(r'^kategoria/(?P[\w-]+)/, 'news.views.category',
name='category'), in polish

if you have EN set, "kategoria" won't work. Is it possible?


https://docs.djangoproject.com/en/dev/topics/i18n/translation/#language-prefix-in-url-patterns


--
S pozdravom / Best regards
  Daniel Gerzo

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



Is upgrading to a newer Django version generally hassle-free?

2012-07-13 Thread sadpluto
Hello! I'm desperately trying to settle on a development stack, and by far 
Django has attracted me the most. The major concern (premature 
optimization?) I have is whether transitioning to newer versions of Django 
is generally easy and well documented. I can only imagine that it is, but I 
haven't found convincing evidence while searching online. It would be great 
to see what's the consensus of experienced developers.

Thank you very much for your help.

Cheers,

S.P.

-- 
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/-/FIVASS2KYhkJ.
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: Internationalized URL different per language

2012-07-13 Thread Markus Gattol
Have a look at https://github.com/trapeze/transurlvania

On Friday, 13 July 2012 21:48:54 UTC+2, galgal wrote:
>
> I need to make an urlpattern different for each language, but following to 
> the same view.
>
> for example:
> url(r'^category/(?P[\w-]+)/, 'news.views.category', 
> name='category'), in english
> url(r'^kategoria/(?P[\w-]+)/, 'news.views.category', 
> name='category'), in polish
>
> if you have EN set, "kategoria" won't work. Is it possible?
>

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



Incorrect post URL on invalid form submissions

2012-07-13 Thread Kevin
I'm new to Django so hopefully this will be trivial to solve.

I have a table of data I display in a view along with a simple form to add 
a new row of data to the table:

def my_data_view(request, data_id):
myData = MyData.objects.get(pk=data_id)
if request.method == 'POST':
myForm = MyForm(request.POST)
else:
myForm = MyForm()
return render_to_response('myapp/mydata.html',
  { 'my_data' : myData,
'my_form' : myForm,},
  
context_instance=RequestContext(request))   
   
def add_new_row(request, data_id):
myData = MyData.objects.get(pk=data_id)
if request.method == 'POST':
myForm = MyForm(request.POST)
if myForm.is_valid():
# TODO insert new time into DB
return HttpResponseRedirect(reverse('myapp.views.mydata', 
args=(myData.id,)))
return my_data_view(request, data_id)

This works when I submit a valid form. However submitting an invalid form 
directs me from myapp/mydata/3 to myapp/mydata/addNewRow/3 which means when 
I submit the corrected form it posts to myapp/addNewRow/addNewRow/3 which 
is obviously not what I want. Any suggestions?

Thanks much!

Kevin

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



Incorrect post URL on failed form validation

2012-07-13 Thread Kevin
I'm new to Django so hopefully this will be trivial to solve.

I have a table of data I display in a view along with a simple form to add 
a new row of data to the table:

def my_data_view(request, data_id):
myData = MyData.objects.get(pk=data_id)
if request.method == 'POST':
myForm = MyForm(request.POST)
else:
myForm = MyForm()
return render_to_response('myapp/mydata.html',
  { 'my_data' : myData,
'my_form' : myForm,},
  context_instance=RequestContext(request))


def add_new_row(request, data_id):
myData = MyData.objects.get(pk=data_id)
if request.method == 'POST':
myForm = MyForm(request.POST)
if myForm.is_valid():
# TODO insert new time into DB
return HttpResponseRedirect(reverse('senslog.views.mydata', 
args=(myData.id,)))
return my_data_view(request, data_id)

This works when I submit a valid form. However submitting an invalid form 
directs me from myapp/mydata/3 to myapp/mydata/addNewRow/3 which means when 
I submit the corrected form it posts to myapp/addNewRow/addNewRow/3 which 
is obviously not what I want. Any suggestions?

Thanks much!

Kevin

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



Internationalized URL different per language

2012-07-13 Thread galgal
I need to make an urlpattern different for each language, but following to 
the same view.

for example:
url(r'^category/(?P[\w-]+)/, 'news.views.category', name='category'), 
in english
url(r'^kategoria/(?P[\w-]+)/, 'news.views.category', 
name='category'), in polish

if you have EN set, "kategoria" won't work. Is it possible?

-- 
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/-/AY6AQuWxzEcJ.
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: Oracle error when filtering on one2many related TextField (nclob)

2012-07-13 Thread Ian
On Thursday, July 12, 2012 9:27:30 AM UTC-6, The Bear wrote:
>
> I get this error:
>
> *** DatabaseError: ORA-06502: PL/SQL: numeric or value error: character 
> string buffer too small 
> ORA-06512: at line 1
>
> This is a database encoding issue; see:

https://code.djangoproject.com/ticket/11580

As I understand it, the DBMS_LOB.SUBSTR call is trying to take the first 
4000 characters of some NCLOB and pack them into a 4000-byte buffer.  The 
problem arises when you're using an encoding where those 4000 characters 
take up more than 4000 bytes.  You might try the code patch in that ticket 
and see if it clears up the error.

Ian

-- 
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/-/f0pTxq1QBwkJ.
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: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-13 Thread Javier Guerra Giraldez
On Fri, Jul 13, 2012 at 6:25 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> Sadly, the original is not available due to bad sound quality, poor planning
> and out of date information.

then count me in!

(not that i prefer to see it recorded, i just wanted to check a 'preview')

-- 
Javier

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



Re: ajax loading html

2012-07-13 Thread Daniel Svonava
Hi,

If this is just a one-off thing, the simplest way might be just symlinking 
that html file to a folder where you serve your static assets from (e.g. 
page_media).

Cheers,
Daniel

On Thursday, July 12, 2012 11:19:07 PM UTC+2, ledzgio wrote:
>
> Hi,
>
> I have to load with ajax (using qtip2) a certain HTML file, and I have to 
> specify a URL to the html page, that is located within the template 
> directory. I have tried but the path doesn't mach. Should I have to add a 
> line to the urls.py and views.py? or can I load that HTML page in other 
> way? if yes, how can I load that page?
>
> 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/-/nG0IxxjrLN4J.
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 base Facebook Games

2012-07-13 Thread Martin Vincent
Looking to hire Django dev with experience in web development  please email 
at mvinc...@isolutionspro.com or call me at 310 751 0833 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/-/vvK-p670zVIJ.
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: Pls help me to solve this error.

2012-07-13 Thread Sergiy Khohlov
paste your url.py and model.py

2012/7/13 mickey :
> I had uploaded image of error.
>
> --
> 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/-/4QFMHRLMN58J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

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



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



Re: Django Egypt

2012-07-13 Thread Dott. Tegagni Alessandro
Hi!
I'm a Italian User of django. If possible join in your groups, I believe in
cooperation of different culture, We work in technology and the share is
fundamental.
Can I enter in this group?

Best regards

Alessandro

*Dott. Tegagni Alessandro*
Consulente nel settore delle Tecnologie Informatiche
Siti Web e Applicazioni Mobile

Ufficio di Cremona:
Via Fatebenefratelli, 2 - 26100 Cremona (Cr)
Tel. 333/9118728
P.Iva 01521350197

Sito Web 


("Le informazioni contenute nella presente comunicazione possono essere
riservate e sono, comunque, destinate alle persone o alla società sopra
indicati. La diffusione, distribuzione e/o copiatura del documento
trasmesso da parte di qualsiasi soggetto diverso dal destinatario è
proibita, sia ai sensi dell'art.616 c.p.c. che ai sensi del D.Lgs.n.
196/2003.

Se avete ricevuto questo messaggio per errore, vi preghiamo cortesemente di
cancellarlo ed informarci immediatamente.")



2012/7/13 hossam algaladi 

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

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



Re: Django Egypt

2012-07-13 Thread hossam algaladi
thanks, eng randa

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



Django Egypt

2012-07-13 Thread Randa Hisham
Django Egypt
new group on facebook

https://www.facebook.com/groups/480998031926391/

-- 
Randa Hesham
Software Developer

Twitter:@ro0oraa 
FaceBook:Randa Hisham 

ٍ

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



Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-13 Thread worldnomad
+1 Would Love to See 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/-/I0BLSdmNO3gJ.
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.



Database Router result of error message

2012-07-13 Thread Thibault
Hello,

I would like to use multiple database to save model of each application of 
my project on separate database.

I have an issue with Django 1.4 on Python 2.6. I have created a Database 
Router using the official documentation but when I run the server, i have 
this error message:

django.core.exceptions.ImproperlyConfigured: Error importing database 
> router MyBeeDBRouter: "cannot import name connection"


How i can fix it please?

Here we can found my database router and an abstract of my settings.py 

dbrouter.py: http://pastebin.com/ejMXYDd9

settings.py: http://pastebin.com/QeqyF9eH

Thank you.

-- 
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/-/q72BEkcwIkQJ.
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: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-13 Thread Cal Leeming [Simplicity Media Ltd]
Hi Javier,

Sadly, the original is not available due to bad sound quality, poor
planning and out of date information.

That is partially the reason why I'm doing it again :)

Cal

On Fri, Jul 13, 2012 at 4:38 AM, Javier Guerra Giraldez
wrote:

> On Thu, Jul 12, 2012 at 2:37 PM, Cal Leeming [Simplicity Media Ltd]
>  wrote:
> > Just a reminder that the poll will be closing in two days time, if you
> > haven't already booked, please do so now!
>
> I thought somebody asked this but can't find it now...  is there any
> recording of the first one available anywhere? (the 40mil one)
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: use same database across various applications in a django project?

2012-07-13 Thread Burhan
sounds like a great idea! I never thought of this. thanks again :)

On Friday, July 13, 2012 12:33:30 AM UTC+2, Burhan wrote:
>
> Hi,
>
> I have a project which has two applications, app_1 and app_2, when I run 
> "python manage.py syncdb" it creates tables defined in model.py (same for 
> both apps), but it creates tables like app_1_table1, app_1_table1, 
> app_2_table1, app_2_table2, however, i want both applications use the same 
> table prefix rather two different prefix.
>
> more precisely I want my both apps use same model and one single database.
>
> any help in this regard would be appreciated.
>
> Thanks,
> Burhan
>

-- 
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/-/pGT5R9es-okJ.
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: use same database across various applications in a django project?

2012-07-13 Thread Сергей Фурсов
Why do you define this model in app1 and in app2? Define it only in app1
and import it in app2 where you need (models, views, etc)

2012/7/13 Burhan 

> Hi,
>
> Thanks for the relpy, i set db_name under as meta information, now i am
> getting this error
>
> django.db.utils.DatabaseError: table "mytable_author" already exists
>
> this is because, for the app1 python syncdb has already created this
> table, now it attempts to create the same tables for app2.
>
> is it possible to use the same model class for both app, at the moment
> models.py is placed in both app1 and app2.
>
>
>
> regards
> Burhan
>
> On Friday, July 13, 2012 12:33:30 AM UTC+2, Burhan wrote:
>>
>> Hi,
>>
>> I have a project which has two applications, app_1 and app_2, when I run
>> "python manage.py syncdb" it creates tables defined in model.py (same for
>> both apps), but it creates tables like app_1_table1, app_1_table1,
>> app_2_table1, app_2_table2, however, i want both applications use the same
>> table prefix rather two different prefix.
>>
>> more precisely I want my both apps use same model and one single database.
>>
>> any help in this regard would be appreciated.
>>
>> Thanks,
>> Burhan
>>
>  --
> 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/-/-HSSLSfEuwoJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: use same database across various applications in a django project?

2012-07-13 Thread Burhan
Hi,

Thanks for the relpy, i set db_name under as meta information, now i am 
getting this error

django.db.utils.DatabaseError: table "mytable_author" already exists

this is because, for the app1 python syncdb has already created this table, 
now it attempts to create the same tables for app2.

is it possible to use the same model class for both app, at the moment 
models.py is placed in both app1 and app2.



regards
Burhan

On Friday, July 13, 2012 12:33:30 AM UTC+2, Burhan wrote:
>
> Hi,
>
> I have a project which has two applications, app_1 and app_2, when I run 
> "python manage.py syncdb" it creates tables defined in model.py (same for 
> both apps), but it creates tables like app_1_table1, app_1_table1, 
> app_2_table1, app_2_table2, however, i want both applications use the same 
> table prefix rather two different prefix.
>
> more precisely I want my both apps use same model and one single database.
>
> any help in this regard would be appreciated.
>
> Thanks,
> Burhan
>

-- 
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/-/-HSSLSfEuwoJ.
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 Mario Gudelj
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 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.