Customizing field widgets and classes from model.Field (aka fields, fields and widgets)

2022-12-01 Thread Bernd Wechner
and form fields are not clearly differentiated, The hierarchy appears to be roughly as follows:     Models specify model fields. Model fields implement a formfield() method which supplies a Form Field. The modelform_factory can create model forms and accepts dictionaries of form field classes

Django Tutorial: please help rewrite form on classes?

2021-03-18 Thread Alexey
I can't rewrite the mysite/polls form into classes.help me. I get different errors every time.     {% csrf_token %}     {{ form.as_p }}     # forms.py: from django import forms from .models import Choice class VoteForm(forms.ModelForm):     choices = [(ch.pk, ch.choice_text) for ch in

Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Dennis Triplett
Thank you Cbh Bnh... I need to know what commands are available in Django and this is exactly what I was looking for. Thanks again. On Tuesday, June 23, 2020 at 5:44:46 PM UTC-7, Dennis Triplett wrote: > > I have been looking for a Django Reference Manual to let me know what >

Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Cbh Bnh
...@gmail.com a écrit : > I have been looking for a Django Reference Manual to let me know what > classes, or Djanago tools > > are allowed in its calling syntax... Example > > > from django.urls import path > from MyApplication import views > > > What I am look

Re: Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-24 Thread Cbh Bnh
, dlt1...@gmail.com a écrit : > I have been looking for a Django Reference Manual to let me know what > classes, or Djanago tools > > are allowed in its calling syntax... Example > > > from django.urls import path > from MyApplication import views > > > What I

Django Reference Manual on what classes can be used with views, urls, etc...

2020-06-23 Thread Dennis Triplett
I have been looking for a Django Reference Manual to let me know what classes, or Djanago tools are allowed in its calling syntax... Example from django.urls import path from MyApplication import views What I am looking for is an explanation of what things can be imported with URLS

Re: can we create two different model classes in one application?

2020-05-10 Thread Kasper Laudrup
Hi Vipul, On 10/05/2020 08.31, vipul shinde wrote: I'm trying to create my own custom form instead of the UserCreationForm that we import in the third website..for which I need two different models, one for making the user and the other to accept a text from the user created through

can we create two different model classes in one application?

2020-05-10 Thread vipul shinde
I'm trying to create my own custom form instead of the UserCreationForm that we import in the third website..for which I need two different models, one for making the user and the other to accept a text from the user created through the previous model. Is this possible? -- You received

Django Middleware vs. DRF Permission Classes for Validations

2019-10-17 Thread Dinesh Dass Subramanian
and some will be applicable to APIs on a need basis. I need to know the best approach on whether I could have a custom middleware for validations based on API endpoints or should I use Permission classes of DRF for validations based on API endpoints? -- You received this message because you

Re: Novice questions about Pagination syntax and classes in general

2019-06-01 Thread John Bagiliko
I will answer question two. I'm not sure I understand your question 1. The "objects" is query method of every Django model. You use it to query. Contacts should be in your models.py and you should import Contacts in your views.py before you can use it. On Sun, Jun 2, 2019, 1:08 AM drone4four

Novice questions about Pagination syntax and classes in general

2019-06-01 Thread drone4four
As part of the official Django doc on Pagination , take a look at the listing function: def listing(request): contact_list = Contacts.objects.all() paginator = Paginator(contact_list, 25) # Show 25

I cannot import my model classes in order to add data to my database

2019-04-04 Thread Demayne Collins
below is the code. When I try t import the class Membership I get an error message saying "*ModuleNotFoundError: No module named 'membership'" * * at the python IDLE. I need to create an object from the class by instantiating a variable.. It appears my object class is not being recognized. *

[Python] How to get list of Classes and etc in a py file or Module ?

2019-01-18 Thread regtech
Hello, I wanna get the list of Classes and other definitions in a python file, I tried : dir( __package__ ) it returns some string, but not get what i needing. Some help me? Thank u! -- You received this message because you are subscribed to the Google Groups "Django users&q

Re: Can I define classes in Django settings, and how can I override such settings in tests?

2018-12-27 Thread Derek
' else: logo = 'generic' Your classes can use also directly use these settings in a similar way On Thursday, 27 December 2018 10:18:28 UTC+2, Uri Even-Chen wrote: > > Hi, > > We are using Django for Speedy Net and Speedy Match > <https://github.com/speedy-net/speedy-net&

Re: Can I define classes in Django settings, and how can I override such settings in tests?

2018-12-27 Thread Ira Abbott
urrently Django > 1.11.17, we can't upgrade to a newer version of Django because of one of our > requirements, django-modeltranslation). I want to define some of our settings > as classes. For example: > > class UserSettings(object): > MIN_USERNAME_LENGTH = 6 &g

Can I define classes in Django settings, and how can I override such settings in tests?

2018-12-27 Thread אורי
Hi, We are using Django for Speedy Net and Speedy Match <https://github.com/speedy-net/speedy-net> (currently Django 1.11.17, we can't upgrade to a newer version of Django because of one of our requirements, django-modeltranslation). I want to define some of our settings as classes. For e

Re: does django pdf documentation has all of the existing functions and classes?

2018-09-09 Thread Andréas Kühne
ngo pdf documentation has all of the existing functions and > classes and modules of django framework? > I just wanted to know if I read that pdf documentation that has about 1900 > pages then i learned all about the django or not. > > -- > You received this message becau

does django pdf documentation has all of the existing functions and classes?

2018-09-08 Thread Amirhosein Majidi
does django pdf documentation has all of the existing functions and classes and modules of django framework? I just wanted to know if I read that pdf documentation that has about 1900 pages then i learned all about the django or not. -- You received this message because you are subscribed

Re: Importing classes from one app to another in a project

2018-06-26 Thread Jason
I would suggest you read on how python imports work https://docs.python.org/3/tutorial/modules.html#more-on-modules On Tuesday, June 26, 2018 at 12:07:45 PM UTC-4, john speny wrote: > > How do you import a class I have created, from forms. Py in the cart app > to views. Py in the shop app >

Re: Django Templates and Conditional CSS classes

2017-11-11 Thread PASCUAL Eric
Hi, Since it is static (i.e. never modified), the CSS classes dictionary (statemap) could be extracted from the function and promoted as a module global variable, to avoid it being reconstructed each time the filter is invoked. This will not cut the processing time in half, but small streams

Re: Django Templates and Conditional CSS classes

2017-11-11 Thread treyd
Omar (and everybody else who responded), Thanks for that ideas and putting a method on the model to return the appropriate CSS class based on the state. I think that would be the cleanest solution if I am going to bite the bullet and put this template-specific logic on the model. It got me

Re: Django Templates and Conditional CSS classes

2017-11-11 Thread Omar Helal
Hi treyd, I think idea of updating the model and storing it in the db is a bit overkill, however you could create an @propery on the model that will do that logic for you and return the css class for you. e.g. @property def css_class(self): if self.state is SUCHANDSUCH: return

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread treyd
Thanks, all, for the info. Looks like the best way to clean this up is to make the model have some knowledge of the CSS class I want to use and make a method to get it. I like that, but I was unsure about sticking view information into the model. Probably the best solution is javascript

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Vijay Khemlani
You can also add a "state_css_class" (or something) method to your object class and just call ... the method should be quite simple On Fri, Nov 10, 2017 at 7:01 PM, Adam Simon wrote: > > You can pass the class from either the model or the view into the > template.

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Adam Simon
You can pass the class from either the model or the view into the template. For example, you can assign a class to a button with a variable: <|button> And then the class would have to be defined in your style somewhere On Fri, Nov 10, 2017 at 1:37 PM treyd wrote: > At some

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread treyd
At some point I plan on figuring out how to do more intelligent front-end in-browser stuff (Angular, etc) which yeah would definitely help me here but I was wondering if there was a Django-only way of doing this. On Friday, November 10, 2017 at 3:51:09 PM UTC-5, Adam wrote: > > > Are you open

Re: Django Templates and Conditional CSS classes

2017-11-10 Thread Adam Simon
Are you open to using JavaScript in the front end? It would make it really easy On Fri, Nov 10, 2017 at 12:40 PM treyd wrote: > Hello, > > I am trying to render a model field in a django template, and, based on > the value of the field, I want to specify a different CSS class.

Django Templates and Conditional CSS classes

2017-11-10 Thread treyd
Hello, I am trying to render a model field in a django template, and, based on the value of the field, I want to specify a different CSS class. Right now, my solution is this: {{ myobject.state }} This works, but seems like a really ugly solution and a bunch of logic in the template. Is

Django View classes and database selection

2017-10-29 Thread Sören Mindorf
Hi all, I've two databases connected in my setup. One default (sqlite) for Djano and one postgressql (pgsql, NOT managed) for my postfix. In my AddDomainView(CreateView) I can access the pgsql database and I can add Domains to the pgsql-database but in my DeleteDomain(DeleteView) I can't because

I AM NOT ABLE TO IMPORT CLASSES FROM MY MODELS WHEN AM TRYING TO RUN A QUERY

2017-09-13 Thread Abdul-Waris Dawuda
When i run this command in the django shell when am trying to make query to my databse i get this problem. Kindly help me out: >>>from app.models import Artist Traceback (most recent call last): File "", line 1, in File ".\app\models.py", line 8, in class Artist(models.Model): File

How to set default css classes for all built-in form widgets

2016-12-25 Thread jxrossel
Merry Christmas to you ! Short version: is it possible to define a set of default css classes that Django should use whenever rendering a form ? Long version: The context is as follows: I would like to use the css classes defined in the w3.css framework for all my forms ( http

Re: Model classes as containers to objects of another model

2016-07-19 Thread James Schneider
On Jul 19, 2016 12:16 PM, "Ajay D" wrote: > > Hi All, > > I am fairly new to Django and find myself in the need to write to the group. > > I have a django model "A", which has an "items" attribute. "items" is a list with objects of another django model "B" (there are no

Model classes as containers to objects of another model

2016-07-19 Thread Ajay D
Hi All, I am fairly new to Django and find myself in the need to write to the group. I have a django model "A", which has an "items" attribute. "items" is a list with objects of another django model "B" (there are no relationships between A and B). Everytime I create a new instance of "A", I

Re: Additional magic with methods of a classes

2016-07-03 Thread Derek
This is not a clear problem. If English is not easy for you, then perhaps add a code sample or two to show what you mean? On Sunday, 3 July 2016 11:55:34 UTC+2, Seti Volkylany wrote: > > Django`s methods may can only method_name.short_description, > method_name.boolean and

Additional magic with methods of a classes

2016-07-03 Thread Seti Volkylany
Django`s methods may can only method_name.short_description, method_name.boolean and method_name.admin_order_field an attributes or exists yet? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving

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

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

Re: same field in two classes

2015-08-03 Thread Javier Guerra Giraldez
On Sun, Aug 2, 2015 at 5:54 PM, Robin Lery wrote: > You can use inheritance. Or content type. Or use signals to get the value of > salary from one model and save it to another model. or choose the right place to store it and don't duplicate information. -- Javier --

Re: same field in two classes

2015-08-02 Thread Robin Lery
You can use inheritance. Or content type. Or use signals to get the value of salary from one model and save it to another model. On 2 Aug 2015 23:38, "Alex Heyden" wrote: > Sorry, I think there might be a bit of a language barrier. What do you > mean by "take the value of

Re: same field in two classes

2015-08-02 Thread Alex Heyden
Sorry, I think there might be a bit of a language barrier. What do you mean by "take the value of employee salary to payroll salary?" On Sun, Aug 2, 2015 at 12:12 PM, Giovanny Vizcaya wrote: > Good day,i'm new in django and i'm doing a project, i have a class >

same field in two classes

2015-08-02 Thread Giovanny Vizcaya
Good day,i'm new in django and i'm doing a project, i have a class "Employee" with atribute "salary", same time i have class "Payroll" with atribute "salary", how can i take the value of employee salary to payroll salary? thank you in advance for answers -- You received this message because

Get Call Stacks for Classes in Models

2015-05-26 Thread Utkarsh
Hi! So, there is a huge Django app with multiple classes in Model. I am interested in getting call stacks of some classes. I have few questions in the approach and few questions regarding the implementation. I am using Django 1.4.20 and python 2.7 1. What if we decide to write a decorator

Re: Django comments app - adding each field of comments app to div classes

2014-11-21 Thread Collin Anderson
>> Name >> > value="" aria-required="true" placeholder="Your Name"> >> >> >> >> and other div classes to fill in mame , email, url and comments. >> >> >> Django comments app's >> &

Re: Django comments app - adding each field of comments app to div classes

2014-11-20 Thread Code
-required="true" placeholder="Your Name"> > > > > and other div classes to fill in mame , email, url and comments. > > > Django comments app's > > {% get_comment_form for post as form %} > > > allows manually render fields l

Django comments app - adding each field of comments app to div classes

2014-11-20 Thread Code
I am using django comments app and am using bootstrap template for UI. In bootstrap I have; Name and other div classes to fill in mame , email, url and comments. Django comments app's {% get_comment_form for post as form %} allows manually render fields like

Re: How do I save an object under two different classes using the admin page

2014-09-04 Thread Alex Chiaranda
Hi, in your admin.py you can implement your own version for the save_model function. Follow the documentation: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.save_model Regards, On Wednesday, September 3, 2014 3:36:42 PM UTC-3, Alejandro Greppi

How do I save an object under two different classes using the admin page

2014-09-03 Thread Alejandro Greppi
I have an application that has defined these models: class Manufacturer(models.Model): manufacturer = models.CharField(max_length=40, unique=True) def __str__(self): return self.manufacturer and class DeviceModel(models.Model): model = models.CharField(max_length=20,

Re: FormWizard confirmation step logic and Allow dynamic form classes with WizardView

2014-05-12 Thread Fabio Caritas Barrionuevo da Luz
/thenewguy/django_formwizard_mixins/pull/2 Em quarta-feira, 7 de maio de 2014 17h43min57s UTC-3, Fabio Caritas Barrionuevo da Luz escreveu: > > Hello django users. > > About the ticket 21644[1] - "FormWizard needs confirmation step logic" > and ticket 21667[2] - &q

FormWizard confirmation step logic and Allow dynamic form classes with WizardView

2014-05-07 Thread Fabio Caritas Barrionuevo da Luz
Hello django users. About the ticket 21644[1] - "FormWizard needs confirmation step logic" and ticket 21667[2] - "Allow dynamic form classes with WizardView" I would like your opinions about the proposed implementation by user nickname123[3]. Remember that an implementat

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-04 Thread Alessandro Caruso
I've moved the forms definition into a separated forms.py file (as suggested by a member of the italian group) and it seems to work. I'll do some tests in the next days then post the correct version. Il giorno venerdì 4 aprile 2014 12:36:17 UTC+2, Alessandro Caruso ha scritto: > > Hi Liam, >

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-04 Thread Alessandro Caruso
Hi Liam, first let me thank you for your time. The relationship in Videoconference is written using the explicit string form because at first I thought it could be a circular import problem, but it could be written as User without affecting the problem positively. I'll try to init the form

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-04 Thread Liam J Thompson
Hi Alex My first thought is that this has something to do with the M2M field stated in Class Videoconference. I'm not 100% sure though, I've only recently started using this type of relationship and I find them rather confusing. I didn't understand why '''

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-04 Thread Alessandro Caruso
Thanks Liam Il giorno giovedì 3 aprile 2014 19:05:28 UTC+2, Liam Thompson ha scritto: > > Hi Alex > > Let me have another look through your code and I'll try to come up with > something useful. > > Liam > > > > > On 03/04/2014 18:20, Alessandro Caruso wrote: > > I got the traceback (thanks

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-03 Thread Liam J Thompson
Hi Alex Let me have another look through your code and I'll try to come up with something useful. Liam On 03/04/2014 18:20, Alessandro Caruso wrote: I got the traceback (thanks to a middleware which collects it and a send it back to the ajax request even if DEBUG=False) Environment:

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-03 Thread Alessandro Caruso
I got the traceback (thanks to a middleware which collects it and a send it back to the ajax request even if DEBUG=False) Environment: Request Method: POST Request URL: http://server:8080/assets/edit/videoconference/30 Django Version: 1.4.5 Python Version: 2.7.3 Installed Applications:

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-02 Thread Liam J Thompson
Hi Alex You might try that command, it's quick through the shell. I suppose there are many ways to do forms, but I've populated my modelforms through an __init__ to make sure its loaded fresh for every form requested, not just on the loading of the server. So object versus class if that

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-02 Thread Alessandro Caruso
erver regardless of DEBUG >> Value) >> - I try to edit the form (i.e. it works as aspected when inserting a new >> record with no Videoconference instance passed to the form) >> >> If I remove the viewers filed from the Videoconference class the problem >>

Re: Problems with ManyToManyFields from Base and Derived Classes

2014-04-02 Thread Liam Thompson
that case the class is no different from Room, > PersonalComputer or Projector classes) > I've tried to use related_name with both managers field of the Asset class > and viewers of the Videoconference class but with no success. > > I hope I've been clear enough. > > Tha

Problems with ManyToManyFields from Base and Derived Classes

2014-04-02 Thread Alessandro Caruso
. it works as aspected when inserting a new record with no Videoconference instance passed to the form) If I remove the viewers filed from the Videoconference class the problem disappears (in that case the class is no different from Room, PersonalComputer or Projector classes) I've tr

Re: apps referencing username field in custom user classes

2013-06-24 Thread Russell Keith-Magee
On Tue, Jun 25, 2013 at 7:58 AM, Victor Rajewski wrote: > I agree that none of these suggestions are particularly onerous, and I > have implemented a suitable work-around for my project. > > However, looking at the bigger picture: > >- In django <= 1.4, all user objects

Re: apps referencing username field in custom user classes

2013-06-24 Thread Victor Rajewski
I agree that none of these suggestions are particularly onerous, and I have implemented a suitable work-around for my project. However, looking at the bigger picture: - In django <= 1.4, all user objects had a username field, which many apps came to rely on as a human-readable unique

Re: apps referencing username field in custom user classes

2013-06-24 Thread Russell Keith-Magee
On Mon, Jun 24, 2013 at 1:51 PM, Victor Rajewski wrote: > Thanks Russ, > > This solves the problem from one end, however in my case the wrong end, as > it would require the app I'm using (and presumably many > other apps relying on the username field) to be re-written;

Re: apps referencing username field in custom user classes

2013-06-23 Thread Victor Rajewski
Thanks Russ, This solves the problem from one end, however in my case the wrong end, as it would require the app I'm using (and presumably many other apps relying on the username field) to be re-written; besides which, USERNAME_FIELD is not present in the User model of django <= 1.4 so every

Re: apps referencing username field in custom user classes

2013-06-23 Thread Russell Keith-Magee
On Mon, Jun 24, 2013 at 5:43 AM, Victor Rajewski wrote: > I have a custom minimal user model subclassing AbstractBaseUser, > containing little more than an email address, for use with > django-social-auth. However, I'm using an externally-developed app which > queries the

apps referencing username field in custom user classes

2013-06-23 Thread Victor Rajewski
I have a custom minimal user model subclassing AbstractBaseUser, containing little more than an email address, for use with django-social-auth. However, I'm using an externally-developed app which queries the user model using the username field, which in my case does not exist, resulting in a

Re: Django Python Understanding Classes with an example

2013-04-22 Thread Gabriel
Hey, it would be better if you told us what's happening when you run this code, what errors are you getting and all... But one thing I noticed on the last line: You don't need to send self to your read_file function, but you do need to specify that you're calling the function from your object,

Django Python Understanding Classes with an example

2013-04-22 Thread sparky
I'm just learning Python and Django. **Could someone tell me where I'm going wrong with below?** What I want to do is something like this csvobject = CSVViewer(file) rows = csvobject.get_row_count() This is what I have so far. Remember this is all new to me so I'm looking for a an

TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types in models/fields/related.py line 955

2013-01-17 Thread Derek Edwards
7/dist-packages/Django-1.4.2-py2.7.egg/django/db/models/fields/related.py", > > line 955, in get_default >if isinstance(field_default, self.rel.to): > > TypeError: isinstance() arg 2 must be a class, type, or tuple of classes > and types > Here's the Referral model for

Calculated attributes of ModelAdmin classes

2012-10-19 Thread Daniele Procida
I have a ModelAdmin class. Sometimes, I want it to include a certain field in the fieldsets, and sometimes I don't (whether it does or not would be the result of a calculation on the instance that is being edited in the admin). How can I make the fieldsets attribute a calculated value,

Re: Abstract classes and inhertience

2012-09-16 Thread Stephen Anto
Hi, Have you tried to fetch all data from models like Model.objects.all() It it is the way to fetch all data. Thank you for visitingFor Django On Mon, Sep 17, 2012 at 6:50 AM, Lachlan Musicman wrote: >

Abstract classes and inhertience

2012-09-16 Thread Lachlan Musicman
Hola, I have an abstract base class, Person, with three children: Applicants, Students and Staff. I have two questions. As per docs ($PATH/topics/db/managers.html#custom-managers-and-model-inheritance) I have three managers for the Abstract class: people = models.Manager() men = MaleManager()

Re: Acessing data on Model/Detail classes

2012-07-06 Thread Melvyn Sopacua
should be able to access the data that will be > save on related classes on the same transaction. Yes, in the form, the view and the template. But there's no relationship there either. There's simply a collection of named data and because you know the names you can make the relationship.

Re: Acessing data on Model/Detail classes

2012-07-06 Thread Fabiano Martins
eptually I think that, how I can access the data that will be saved on the Master class, I should be able to access the data that will be save on related classes on the same transaction. Now I've made a new test: I created a method "clean()" on Product class, and see that from it I ca

Re: Acessing data on Model/Detail classes

2012-07-05 Thread Melvyn Sopacua
On 5-7-2012 21:46, Fabiano Martins wrote: > I'm novice on Django, and I have a problem that I can't resolve through > documentation. > > I like to make a validation on Model.clear() of the master class method based > on > data of your detail classes, but it returns

Acessing data on Model/Detail classes

2012-07-05 Thread Fabiano Martins
Hi, I'm novice on Django, and I have a problem that I can't resolve through documentation. I like to make a validation on Model.clear() of the master class method based on data of your detail classes, but it returns always a empty set. This example

Re: Where admin classes should be registered ?

2012-06-28 Thread Shane Shane Bichel
jjcjgxydhfxydzh On Wed, Jun 27, 2012 at 12:54 AM, Alireza Savand <alireza.sav...@gmail.com>wrote: > Hi > Common way to create [model|admin] classes is implement and create them in > [models|admin].py file. > But as standard non-django way is to create a python p

Re: Where admin classes should be registered ?

2012-06-28 Thread Alireza Savand
Yes, But when my models.py/admin.py reach to +2000 line then django standard way not gonna help. That's why i seperate the classes into files and pkgs. I'm wonder is there any performance issue on this approach, since each class is in separate file, when i import them i'm sure python should find

Re: Where admin classes should be registered ?

2012-06-27 Thread Daniel Roseman
On Wednesday, 27 June 2012 08:54:07 UTC+1, Alireza Savand wrote: > > Hi > Common way to create [model|admin] classes is implement and create them in > [models|admin].py file. > But as standard non-django way is to create a python package named admin > for AdminClass es

Re: Where admin classes should be registered ?

2012-06-27 Thread Alireza Savand
As your approach, at admin/__init__.py i have to from myapp.admin.ouradmin import * That means import all of the classes inside that files. On Wed, Jun 27, 2012 at 2:54 PM, Matt Schinckel <m...@schinckel.net> wrote: > I generally register admin models where I define them, and

Re: Where admin classes should be registered ?

2012-06-27 Thread Matt Schinckel
I generally register admin models where I define them, and then just import that file in admin/__init__.py If you are getting multiple registration errors, it may be that your app appears twice in sys.path (perhaps as app, and project.app?). That's generally a Bad Thing(tm). Matt. -- You

Where admin classes should be registered ?

2012-06-27 Thread Alireza Savand
Hi Common way to create [model|admin] classes is implement and create them in [models|admin].py file. But as standard non-django way is to create a python package named admin for AdminClass es and create a file for each admin class. But i couldn't find any standard way to register those admin

PRG with View classes

2012-04-17 Thread dmitry b
hi, Is there out of the box support for the PRG pattern with Django's new class-based views? If not, what's a good/preferred way of implementing one? Thanks D. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the

Re: Way to isolate inherited model classes?

2012-03-05 Thread Michael Elkins
On Mon, Feb 27, 2012 at 09:18:22AM -0600, Gene horodecki wrote: Hi there. I have a multi-table inheritance in my main application like this: MailItem->Parcel->LargeParcel Now I want to have a separate application called 'dispatch' that serves as a staging area as information comes in about

Way to isolate inherited model classes?

2012-02-27 Thread Gene horodecki
Hi there. I have a multi-table inheritance in my main application like this: MailItem->Parcel->LargeParcel Now I want to have a separate application called 'dispatch' that serves as a staging area as information comes in about the parcels. So I want a single table that has a row that

Re: Different classes uses different databases

2012-02-21 Thread kalyani ram
irw...@gmail.com> wrote: > Hello there, > > I have to create two (or more) classes, and rows of classes are stored > in different databases. > > I've read about > multi-db:https://docs.djangoproject.com/en/dev/topics/db/multi-db/ > - that's clear for me. (Or may be I'm confu

Different classes uses different databases

2012-02-21 Thread airween
Hello there, I have to create two (or more) classes, and rows of classes are stored in different databases. I've read about multi-db: https://docs.djangoproject.com/en/dev/topics/db/multi-db/ - that's clear for me. (Or may be I'm confused...) Is it the only way to handle the databases

Proper way of building model classes in app using 2 databases

2012-01-30 Thread Piotr Wierzgała
Hi, I'm writting an app which uses 2 databases and I'm wondering how I should build model classes for tables from second database (which I only use to read data). I have a models.py module in my app's package where I defined all the model classes I needed. I also defined there model classes from

Re: Django or python question about classes

2011-11-30 Thread youpsla
m_valid(self, form, **kwargs): > >        some code > > > class MyUpdateView(CreateView): > >    . > >    def form_valid(self, form, **kwargs): > >        some code > > > The both form_valid() methods are exactly the same (Only the > > dispatch() method

Re: Django or python question about classes

2011-11-28 Thread Tom Evans
. >    def form_valid(self, form, **kwargs): >        some code > > class MyUpdateView(CreateView): >    . >    def form_valid(self, form, **kwargs): >        some code > > The both form_valid() methods are exactly the same (Only the > dispatch() method di

Django or python question about classes

2011-11-28 Thread youpsla
): . def form_valid(self, form, **kwargs): some code The both form_valid() methods are exactly the same (Only the dispatch() method differ from both classes). My question is : is there a way of doing this more in a DRY way ? Thanks in advance. Best regards Alain -- You received

Multiple Inheritence of Abstract Base Model Classes, or plain Mixins?

2011-06-22 Thread br
I asked a similar question a few days ago but got no response. Since then, I've poked around SO and come up with a few potential ways to do it, but wonder if there is a *correct* Django way to do it or if there are hidden problems lurking behind one of them. Basically I have a few different base

Re: Is multiple inheritance with abstract model classes ok?

2011-06-22 Thread Kevin Renskers
Perfectly fine! -- 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/-/6Vp_0w_sz_cJ. To post to this group, send email to django-users@googlegroups.com. To

Is multiple inheritance with abstract model classes ok?

2011-06-20 Thread br
If I have three different abstract model base classes . . . I'd like to use them in multiple inheritance, sort of like Mixins. Any problems with this? E.g., class TaggableBase(models.Model): . . . class Meta: abstract = True class TimeStampedBase(models.Model): . . . class

Abstract base classes, multiple inheritance and field removal

2011-05-26 Thread Justin
Hello All, I have a situation where I would like to combine two fields from two abstract child classes into a parent class. class A(model): field = MyField() class Meta: abstract = True class B(model): field = MyField() class Meta: abstract = True class C(A, B

Re: how to list all model classes within admin that extends another model?

2011-05-15 Thread garagefan
e each ClientObject listed to link to it's admin page. > Right now i just have the portfolio application w/ the Portfolio class > extending the ClientObjects class. Ultimately, i also wouldnt mind a > list of classes that extend the ClietObjects class to be listed w/ an > "add blahbla

Re: how to list all model classes within admin that extends another model?

2011-05-15 Thread garagefan
also wouldnt mind a list of classes that extend the ClietObjects class to be listed w/ an "add blahblahblah" to client link that pops open an admin popup On May 15, 7:42 pm, Shawn Milochik <sh...@milochik.com> wrote: > Try this: > > http://docs.djangoproject.com

Re: how to list all model classes within admin that extends another model?

2011-05-15 Thread Shawn Milochik
Try this: http://docs.djangoproject.com/en/1.3/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin -- 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

how to list all model classes within admin that extends another model?

2011-05-15 Thread garagefan
building a client management application for myself in one application model, called client_management, i have class Client(models.Model): active = models.BooleanField(_('active client'), default=False) name = models.CharField(max_length=250) logo = models.ImageField(upload_to="logos")

Re: Problems importing model classes that reference each other...

2011-05-15 Thread Leo
As Shawn said, if you really must have both apps refer to the other's models, then then they're not really separate apps. If you're just trying to resolve a generic circular-reference problem, remember that ForeignKey can also take the name of a class as its first argument, see

Re: Problems importing model classes that reference each other...

2011-05-14 Thread Shawn Milochik
If you have two models that need to explicitly refer to each other then they should probably be in the same app. If they need to be in two apps, you can have a foreign key in one and from the other use the RelatedManager to access the first. You'll have to make these decisions based upon

  1   2   3   4   >