how to description FK which contains more than 1 field

2015-08-10 Thread Holland_zwz
Hi all, I have 2 tables, one is A another is B, and B have one FK which contains more than 1 field references to A. The table struct is here: create table A ( oid int not null, types varchar(20) not null, name varchar(30) null, color varchar(20) null, constraint PK_A primary key

RE: how to description FK which contains more than 1 field

2015-08-10 Thread Dario Concilio
Hi hollandzwz, try to change to_field in related_name="entitites" Example: class UserFollower(models.Model): user_id = models.ForeignKey(User,related_name="users") follower_id = models.ForeignKey(User,related_name="followers") bye Dario Concilio Date: Mon, 10 Aug 2015 02:39:12

RE: how to description FK which contains more than 1 field

2015-08-10 Thread Dario Concilio
Hi again... I could need to read this https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys Bye Dario Date: Mon, 10 Aug 2015 02:39:12 -0700 From: holland...@gmail.com To: django-users@googlegroups.com Subject: how to description FK which contains more than 1 field Hi all, I have 2

Generic forms (ModelForm) provide HTML for a form! Can generic views (DetailView) do same?

2015-08-10 Thread Bernd Wechner
This has bamboozled me for a while. I Have a wonderful little test app I'm playing with which lists objects (ListView) and next to each object puts an edit and view link. Sort of like: - [view] [edit] Object 1 - [view] [edit] Object 2 - [view] [edit] Object 3 The ListView works like a

Re: problem with get_absolute_url()

2015-08-10 Thread Александр Мусаров
THANX A LOT -- 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

Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Ankit Agrawal
I am working on a project which has two different sets of users - Customer and Merchant. Both of these users should be able to register and login to their respective profiles. The most obvious choice to implement this that came to my mind was to make two different models Customer and

Re: Best Way to Organize Project With Overlapping Functionality

2015-08-10 Thread ringemup
Thank you, Mike, that’s helpful! On Aug 9, 2015, at 7:42 PM, Mike Dewhirst wrote: > On Monday, August 10, 2015 at 8:34:28 AM UTC+10, Nan wrote: > Hi everyone -- > > I'm building a project that allows users to create mailing lists. In order > to create a mailing list,

please suggest me, related to technologies that I should use for facebook like chat

2015-08-10 Thread JAI PRAKASH SINGH
Hello all, I want to to make a facebook like chat application in django. can you guys suggest me, what technology should I use to make it , or can you give me some links to learn it for this I will be very thankful to you guys with regards jai -- You received this message

Re: please suggest me, related to technologies that I should use for facebook like chat

2015-08-10 Thread Andrew Farrell
This is orthogonal to Django, but I would take a look at TornadIO and https://github.com/MrJoes/tornadio/tree/master/examples/chatroom On Mon, Aug 10, 2015 at 8:56 AM, JAI PRAKASH SINGH < jaiprakashsingh...@gmail.com> wrote: > Hello all, > > > I want to to make a facebook like chat

Django Community Blog not adding Posts from feed

2015-08-10 Thread Luciano Ferrari
Hi everyone, Last week I added the RSS Feed to the Django Community Blog which was approved by the Django Community. The problem is that I am not seeing any of the current posts of the feed in the django community blog page. Does anyone have this issue before? Thanks, Luciano -- You

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Avraham Serour
I personally like a profile model, but if you implement two you may have headaches when doing a reverse relation from user, you would need to check every time of the request.user is a customer or merchant. In any case what is the difference between them anyway? Why can't a user be both? On Mon,

Re: problem with using generic views

2015-08-10 Thread Doaa Hassan
No, I didn't, but I just have done and it works. Thanks :) On Saturday, August 8, 2015 at 10:42:57 PM UTC+2, James Schneider wrote: > > Did you complete the following section after changing the urls.conf? The > URL changes won't work until you modify the views.py file in the next > section. >

Re: please suggest me, related to technologies that I should use for facebook like chat

2015-08-10 Thread JAI PRAKASH SINGH
Hey Andrew, Thank you for replay, so i just want to know, if i want to implement in django will it work fine ? On Monday, August 10, 2015 at 7:38:44 PM UTC+5:30, Andrew Farrell wrote: > > This is orthogonal to Django, but I would take a look at TornadIO and >

Re: please suggest me, related to technologies that I should use for facebook like chat

2015-08-10 Thread Aaron C. de Bruyn
On Mon, Aug 10, 2015 at 7:46 AM, JAI PRAKASH SINGH wrote: > Thank you for replay, so i just want to know, if i want to implement in > django will it work fine ? That's not really a question about the language. Developers can do all sorts of amazing stuff with

How to get to a class model field through a ManyToMany field in another class

2015-08-10 Thread Александр Мусаров
I'm having two model classes Product and Category, on the one hand the Product class has a ManyToMany field ( product_categories ) which lists all the categories, a product instance may belong to, on the other hand the Category class has the category_slug field. The question is - is there any

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Robin Lery
You surely can use Choice field for either Customer or Merchant in your custom user class. On 10 Aug 2015 20:12, "Avraham Serour" wrote: > I personally like a profile model, but if you implement two you may have > headaches when doing a reverse relation from user, you would

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Carl Meyer
Hello Ankit, On 08/10/2015 09:38 AM, Ankit Agrawal wrote: > I am working on a project which has two different sets of users - > |Customer| and |Merchant|. Both of these users should be able to > register and login to their respective profiles. The most obvious choice > to implement this that came

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread James Schneider
If you want to avoid MT inheritance, look at inheriting from AbstractBaseUser using a custom abstract class where you can add your extra custom fields. Your two types of users (inheriting from your new abstract class) would then be standard, separate models. -James On Aug 10, 2015 9:24 AM, "Robin

Moving from Django 1.6 to 1.8 (relation "django_site" does not exist

2015-08-10 Thread TheBeardedTemplar
Hello, I'm trying to move a fairly large site from Django 1.6.5 to Django 1.8.3. I'm also moving from sqlite3 to postgreSQL at the same time and I'm having trouble with the migrations. Here's what I've done so far: - Installed Django 1.8.3, removed south, and installed psycopg 2.6.1 -

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
In Django, requests should not wait, since the threads are relatively heavyweight in python, and need to be a limited resource. The alternative is a large number of processes, which is also expensive. So you must design a scheme in which the client polls for a result, meaning that you cannot

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Peter Coles
Thank you for your input. I appreciate you trying to steer my away from potentially terrible design, however, I am still interested in someone addressing my main questions. Some level of service calls is inevitable in any interesting web application—even a call to an in-memory cache, like

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Ankit Agrawal
@James: Even if I implement a Custom abstract class inheriting from AbstractBaseUser, the Custom Abstract Class would have a explicit OneToOneField to the AbstractBaseUser, which essentially would mean having overheads due to JOINs as in MTI. Ankit Agrawal, IIT Bombay. On Mon, Aug 10, 2015 at

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread François Schiettecatte
Hi Specifically addressing your questions: - I would look at using shared memory to store data that you can share across processes, plenty of resources on the web that talk about this. - You might want to use a small file to store data and fcntl.flock() to control access so you are not

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Avraham Serour
> 1. What’s the most global, persisting, shared-across-requests type of data I can read & write to memory? Don't complicate your life, just store data in the database > 2. However I can do this, does this require using `threading.Lock()`? (looking around `dispatch.Signal` I see some use of it) If

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread James Schneider
That is an incorrect assumption. Abstract model classes do not generate any database tables, and are specifically designed for inheritance purposes (otherwise they are pretty much useless). It is impossible for a OneToOne field to exist that points to an abstract class.

Re: Moving from Django 1.6 to 1.8 (relation "django_site" does not exist

2015-08-10 Thread Gary Roach
On 08/10/2015 09:53 AM, TheBeardedTemplar wrote: Hello, I'm trying to move a fairly large site from Django 1.6.5 to Django 1.8.3. I'm also moving from sqlite3 to postgreSQL at the same time and I'm having trouble with the migrations. Here's what I've done so far: * Installed Django 1.8.3,

Re: Question about squashing django migrations

2015-08-10 Thread Carl Meyer
Hi Richard, On 08/01/2015 06:27 PM, Richard Brockie wrote: > Can someone please explain the implications of this note about squashing > migrations in the documentation? > > From: https://docs.djangoproject.com/en/1.7/topics/migrations/ > > "Once you’ve squashed a migration, you should not

Re: Question about squashing django migrations

2015-08-10 Thread Richard Brockie
Hi Carl, Thanks for pointing this out - it's right there! I don't know how I missed it... Thanks again, R. On Mon, Aug 10, 2015 at 11:12 AM, Carl Meyer wrote: > Hi Richard, > > On 08/01/2015 06:27 PM, Richard Brockie wrote: > > Can someone please explain the implications of

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Bill Freeman
If you have your heart set on a circuit breaker pattern (patterns are overrated, see http://www.paulgraham.com/icad.html), consider implementing it in the client. If you need a long poll solution, note that you can serve some urls from uwsgi/Django and others from tornado or twisted. If you are

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Ankit Agrawal
Hi James, Correct me if I am wrong but if I understood you correctly, I should be able to implement it this way - class User(AbstractBaseUser, PermissionsMixin): common_fields_go_her = ... objects = CustomUserManager() class Meta: abstract = True class

reload_module no longer works when using caches["default"] instead of cache

2015-08-10 Thread Shawn Milochik
TL;DR; How do you modify cache settings during testing? Specifically, enable/disable (by making TIMEOUT zero or non-zero). Full question: I had some code that looked like this: from django.core.cache import cache data = cache.get(key, {}) etc. Now it looks like this: from django.core.cache

Django Model Classes, Wrapt, and Decorator Variables

2015-08-10 Thread Utkarsh Jadhav
*Aim to achieve* - Get call stacks where specific model classes are used. (Example - MyModel.objects.save(), MyModel.objects.filter(), etc) *My Approach - * Add this in order to override *Save* and *Delete*. Class MyModelClass(CallStackMixin, models.Model) In order to override

Django Model classes, Wrapt decorator, and decorator argument

2015-08-10 Thread Utkarsh
Dear All, My aim is to obtain all unique call stacks where model classes are accessed. To implement it, I thought of overriding save(), delete(), and get_query_set() methods, as follows - class MyModelClass(CallStackMixin, models.Model) # Mixin to override save, and delete objects

Re: Moving from Django 1.6 to 1.8 (relation "django_site" does not exist

2015-08-10 Thread TheBeardedTemplar
Thanks for the settings.py suggestion Gary - I did make various changes there prior to this post. I ended up resolving the issue by running makemigrations for every app individually, then migrating. Unfortunately I'm now running into trouble with my tests - I'm hitting the same errors for my

It is a good practice to add or edit an object in the same view?

2015-08-10 Thread Neto
Hi, It is a good practice to add or edit an object in the same view or is it better to separate? *For example:* def add_edit(request, id=None): form = MyForm(request.POST or None) if request.method == 'POST': if form.is_valid(): form.save() return

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread James Schneider
On Mon, Aug 10, 2015 at 12:11 PM, Ankit Agrawal wrote: > Hi James, > > Correct me if I am wrong but if I understood you correctly, I should > be able to implement it this way - > > class User(AbstractBaseUser, PermissionsMixin): > common_fields_go_her = ... > >

How access verbose_name of a field in template?

2015-08-10 Thread Neto
How access verbose_name of a field in template? I have an object: p = Person.objects.get(pk=1) and I wanna access same verbose_name in template like it: {{ p.name.__verbose_name }}: {{ p.name }} {{ p.birth_date.__verbose_name }}: {{ p.birth_date }} *result:* Name: Maria Birth date:

Re: Writing a “circuit breaker” for use in Django

2015-08-10 Thread Peter Coles
Thank you for the pointed response, François. I was thinking about accessing some shared memory vs just doing something simpler and just being per-process. The prior sounds more thorough, but the nature of what I’d like to use it for is already OK with separate clients across machines, so

Re: Different auth user models withoout doing multi-table inheritance

2015-08-10 Thread Ankit Agrawal
On Tuesday, August 11, 2015 at 2:31:11 AM UTC+5:30, James Schneider wrote: > > On Mon, Aug 10, 2015 at 12:11 PM, Ankit Agrawal > wrote: > >> Hi James, >> >> Correct me if I am wrong but if I understood you correctly, I should >> be able to implement it this way - >>

Re: How access verbose_name of a field in template?

2015-08-10 Thread Mike Dewhirst
On 11/08/2015 10:51 AM, Neto wrote: How access verbose_name of a field in template? I would write a view which collects the verbose names and other wanted info and put it all into a single object or dict and pass that into the template, like ... obj.name_verbose_name obj.name

display readonly or not

2015-08-10 Thread Tony Peña
hi i have this on my model.admin class MyDomainAdmin(admin.ModelAdmin): list_display = ('domain', 'enabled', 'avscan', 'spamassassin', 'max_accounts') list_filter = ('enabled',) exclude = ('uid', 'gid', 'maildir') # this part is my pseudo-code logic I want but i can't solved. if

Re: How access verbose_name of a field in template?

2015-08-10 Thread Neto
If is to do that way, I prefer to do manually. I would like to access the direct verbose_name the template. Is possible that the "Django developers" could do this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group

Re: display readonly or not

2015-08-10 Thread Mike Dewhirst
On 11/08/2015 7:25 AM, Tony Peña wrote: hi i have this on my model.admin class MyDomainAdmin(admin.ModelAdmin): Â Â list_display = ('domain', 'enabled', 'avscan', 'spamassassin', 'max_accounts') Â Â list_filter = ('enabled',) Â Â exclude = ('uid', 'gid', 'maildir') # this part is my