RE: Models

2022-01-21 Thread Mike Dewhirst
Not safely. You would need to script everything behind the scenes - including migration.A safer approach might be to use a generic table which contains the necessary meta information (char, int etc) as data alongside the actual data in each row. I would also consider booking sessions with a psyc

Re: Models not found error

2021-03-28 Thread RANGA BHARATH JINKA
Hi, In BloodBank\urls.py file, Please check the include. It should contain .urls not .url at the end. So it is not able to find the urls file. All the best On Mon, Mar 29, 2021 at 2:06 AM Kasper Laudrup wrote: > On 28/03/2021 18.57, Ritika Bokde wrote: > > Can somebody help me to resolve th

Re: Models not found error

2021-03-28 Thread Kasper Laudrup
On 28/03/2021 18.57, Ritika Bokde wrote: > Can somebody help me to resolve this error > > ModuleNotFoundError: No module named 'BloodBankDetails' > It's hard to tell for sure since you're posting pictures of code instead of posting the actual code, but it seems like you haven't defined a class/m

Re: models design for student result system

2020-12-05 Thread boyuanl...@gmail.com
You can create three models:1. The student's model, contains student's information,2. The Courses' model, contains all the courses information,3. The student_course_grade model, contains all student's grade information On Friday, December 4, 2020, 10:42:37 PM PST, Dexterr Jay wrote:

Re: models design for student result system

2020-12-05 Thread Kasper Laudrup
Hi Dexterr, On 05/12/2020 07.40, Dexterr Jay wrote: image.png i need help with design of the above models for my student result system project What kind of help do you need? What have you done so far? Try to be a bit more specific. Kind regards, Kasper Laudrup -- You received this messa

Re: Models as choices

2020-04-17 Thread Esther Camilo
This guy has plenty of tutorials building complete applications. As front-end you can use Bootstrap in your templates https://simpleisbetterthancomplex.com/ On Fri, Apr 17, 2020 at 9:57 AM Denilson Antonio Avellan < denilson.d...@gmail.com> wrote: > me pueden enviar el codigo completo ? para ha

Re: Models as choices

2020-04-17 Thread Denilson Antonio Avellan
me pueden enviar el codigo completo ? para hacer un login solo la interfqaz grafica sin nada de conexion a base de datos porfavor! El vie., 17 de abr. de 2020 a la(s) 00:00, Gavin Wiener ( gavinwie...@gmail.com) escribió: > If you're serializing as JSON, that primary key is literally just integer

Re: Models as choices

2020-04-16 Thread Gavin Wiener
If you're serializing as JSON, that primary key is literally just integer then, and the foreign key relationship requires an instance of that foreign key. So you'll need to fetch an instance of the object first. I've had this issue before, that's how I resolved it. On Friday, April 17, 2020 at

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
i get this error when trying in your way: Cannot assign "2": "User.highest_degree" must be a "Degree" instance. On Thursday, April 16, 2020 at 5:31:07 PM UTC+5:30, Gavin Wiener wrote: > > Couldn't the User just have a ForeignKey on countries? > > On Thursday, April 16, 2020 at 12:52:07 PM UTC+8,

Re: Models as choices

2020-04-16 Thread Gavin Wiener
Couldn't the User just have a ForeignKey on countries? On Thursday, April 16, 2020 at 12:52:07 PM UTC+8, shreehari Vaasistha L wrote: > > how can i use model x values as choices for model y ? > > for eg: > class countries(models.Model): > country = models.CharField(max_length=200) > > def __str

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Thanks for helping me out . On Thursday, April 16, 2020 at 2:34:13 PM UTC+5:30, Kasper Laudrup wrote: > > Hi Shreehari > > On 16/04/2020 10.17, shreehari Vaasistha L wrote: > > Object of type ValueError is not JSON serializable > > > > > > getting this above error > > > > First of all, don'

Re: Models as choices

2020-04-16 Thread Kasper Laudrup
Hi Shreehari On 16/04/2020 10.17, shreehari Vaasistha L wrote: Object of type ValueError is not JSON serializable getting this above error First of all, don't highjack other unrelated threads. Create your own with a descriptive subject. You get the error because of the lines: except Exc

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Object of type ValueError is not JSON serializable getting this above error. here's my views.py class UserCreateApiView(CreateAPIView): serializer_class = UserCreateSerializer def post(self,request): try: serializer=UserCreateSerializer(data=request.data) if s

Re: Models as choices

2020-04-16 Thread shreehari Vaasistha L
Object of type ValueError is not JSON serializable getting this above error On Thursday, April 16, 2020 at 12:57:16 PM UTC+5:30, Antje Kazimiers wrote: > > with a Foreign Key field, one-to-many relationship: > > https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ > > Antje >

Re: Models as choices

2020-04-16 Thread Antje Kazimiers
with a Foreign Key field, one-to-many relationship: https://docs.djangoproject.com/en/3.0/topics/db/examples/many_to_one/ Antje On 4/16/20 6:52 AM, shreehari Vaasistha L wrote: > how can i use model x values as choices for model y ? > > for eg: > | > classcountries(models.Model): >  country =mod

Re: models

2019-05-08 Thread Mohammad Etemaddar
The one who should have foreign key is is filter, box and barel to shelf. Then you can access them from shelf: Shelf0.boxs Shelf0.barels And shelf0.filters Note that you can set the relation_name in foreign key so that you can use the related name instead of filters, boxs and barels On Wed, 8 May

Re: models and forms

2019-04-29 Thread Nelson Varela
What do you have so far. show some code or explain what you have so far On Monday, April 22, 2019 at 1:40:06 PM UTC+2, Shereyne Casimsiman wrote: > > I am current making a project and django is very new to me, I've been > following tutorials but it did not answer my concern.. > My project is to b

Re: Models

2019-04-04 Thread Mike Dewhirst
On 4/04/2019 5:52 pm, John Crosby wrote: Hi all, does any one have any good tips or resources to help me get my head around designing models? Everyone would love to dive in and help but it is just a tad too soon. You need to follow the tutorial and marry the polls models with the way you pe

Re: Models in admin view

2019-03-03 Thread 'Amitesh Sahay' via Django users
Hello Raghav,  Once you register something in admin.py, you should see  that update in the admin page. Login there and click on "candidates" , now you can add the candidates multiple times. Regards, Amitesh Sahay91-750 797 8619 On Friday, 1 March, 2019, 6:34:56 pm IST, raghav b wrote:

Re: Models in admin view

2019-03-01 Thread Andréas Kühne
Hi, You can look here: https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin This is the functionality you want. Regards, Andréas Den fre 1 mars 2019 kl 14:05 skrev raghav b < raghav.balasubraman...@gmail.com>: > I have created two apps with the name

Re: Models which link to Groups (by ForeignKey)

2018-09-10 Thread Benjamin SOULAS
Ow, ok, I got it, thx a lot But in order to create this object (retrieve my groups from the ORM), should I implement something specific? Because for my request, I just want to specify the group names and then, in my app, retrieve those, create my link between the groups... I thought I had to r

Re: Models which link to Groups (by ForeignKey)

2018-09-10 Thread Jason
https://stackoverflow.com/questions/2642613/what-is-related-name-used-for-in-django As you can see there, its for the relation from Group to GroupLinker. That relation name is the same for both fields, so you need to specify something unique. -- You received this message because you are subsc

Re: models that are not tables but not abstract

2018-03-29 Thread Avraham Serour
Currently for things like this I create a view and serializer that are not related to any model. Of course I lose some introspection code that expect a model, but for the most part I'm able to make an API endpoint with data not from the ORM. Can you elaborate more on your use case? On Thu, Mar 2

Re: Models not appearing in Admin page.

2017-04-25 Thread Vijay Khemlani
Register in in the admin.py file https://docs.djangoproject.com/en/1.11/intro/tutorial02/#make-the-poll-app-modifiable-in-the-admin On Tue, Apr 25, 2017 at 9:46 AM, Ratul Shams wrote: > Hey Pythonistas! > I was working on Django and made a Model, but its not appearing on my > Django Admin page

Re: Models/Foreign Keys best practice

2017-02-24 Thread Richard Jackson
Hi Melvyn, This worked perfectly, and definitely helped with my own understanding, thank you! For the sake of formatting I've included my interpretation of your suggestion: # models.py from django.db import models from django.utils import timezone class Performance(models.Model): perform

Re: Models/Foreign Keys best practice

2017-02-22 Thread Richard Jackson
Hi Melvyn - great reply, thank you so much for taking the time to help! I've got to head out now but will reply tomorrow - just wanted to leave an initial thank you note! Rich On Wednesday, February 22, 2017 at 5:01:36 PM UTC, Melvyn Sopacua wrote: > > Hi Richard, > > > > good questions and

Re: Models/Foreign Keys best practice

2017-02-22 Thread Melvyn Sopacua
Hi Richard, good questions and your initial data model defines your application challenges. It is by far the most important step in application design, so it's important to get it "as right as possible". On Wednesday 22 February 2017 06:25:24 Richard Jackson wrote: > The app lists performanc

Re: Models/Foreign Keys best practice

2017-02-22 Thread Luvpreet Singh
Hi Richard, I am facing a difficulty here. Can you please tell me that how to iterate over this queryset , performance.ensemble_set.all() ?? Thanks. On Wednesday, February 22, 2017 at 7:55:24 PM UTC+5:30, Richard Jackson wrote: > > Hi all, > > I'm putting together my first app, closely modell

Re: models foreign key

2017-01-15 Thread Michal Petrucha
On Thu, Jan 12, 2017 at 01:40:43AM -0800, jeffreyequizuvero wrote: > > > *This is about the models foreign key, I have two tables and i used foreign > key to connect these tables however after i did migration it's not working. > Is there any wrong with my code? * I can see that you have a comm

Re: models foreign key

2017-01-15 Thread Melvyn Sopacua
On Monday 16 January 2017 07:55:28 Jeffrey Uvero wrote: > *I am using oracle. * > > *actually I used the procedure before and it was successful, but now i > used same procedure but it didn't work. * Make sure that the tool you use to "see the connection between these tables" is not the problem.

Re: models foreign key

2017-01-15 Thread Jeffrey Uvero
*I am using oracle. * *actually I used the procedure before and it was successful, but now i used same procedure but it didn't work. * On Sun, Jan 15, 2017 at 12:16 AM, Melvyn Sopacua wrote: > On Friday 13 January 2017 07:42:17 Jeffrey Uvero wrote: > > > *there's no problem appeared but when I

Re: models foreign key

2017-01-14 Thread Melvyn Sopacua
On Friday 13 January 2017 07:42:17 Jeffrey Uvero wrote: > *there's no problem appeared but when I go to my database, there's no > connection with these two table.. there should be a connection between > two same name column.(foreign key)* > Correction with my code above. How did you determine th

Re: models foreign key

2017-01-12 Thread Jeffrey Uvero
*there's no problem appeared but when I go to my database, there's no connection with these two table.. there should be a connection between two same name column.(foreign key)* Correction with my code above. *Author_code = models.ForeignKey(Author, to_field='Author_code', on_delete=models.CASCADE)

Re: models foreign key

2017-01-12 Thread jorrit787
What exactly isn't working? Are you getting an error message? I can see a few potential problems: - You're missing a quotation mark around Author_code in the *to_field* parameter; - The fields on both models have the same name, this might cause problems. On Thursday, January 12,

Re: Models of Speedy Net

2016-08-18 Thread Uri Even-Chen
Thank you Asad and Avraham! *Uri Even-Chen* [image: photo] Phone: +972-54-3995700 Email: u...@speedy.net Website: http://www.speedysoftware.com/uri/en/

Re: Models of Speedy Net

2016-08-18 Thread Avraham Serour
It doesn't matter, you should decide on something and stick to it, consistency is more important than some suggestion you read somewhere. What your suggested seems fair, write on your documentation that you decided this and ask politely for contributions to follow this style On Aug 18, 2016 3:08

Re: Models of Speedy Net

2016-08-18 Thread Asad Jibran Ahmed
Sorry, I just checked and I'm wrong about the ordering of elements in a class. The reason the constants need to be first is because you are using them when defining your fields. But other than that, the order doesn't matter. Here's the code that I used to check this: def get_const(): print

Re: Models of Speedy Net

2016-08-18 Thread Asad Jibran Ahmed
The ordering of your attributes and methods inside the model class doesn't have to do with Django, it has to do with Python. Inside a class, the ordering doesn't matter as far as I understand. All of these documents you will find are thus just conventions to follow. You could come up with your

Re: Models of Speedy Net

2016-08-18 Thread Uri Even-Chen
By the way, I found this document and I changed the order of elements in our models accordingly. But what about def __init__? And this document is for Django developers, what about Django users? Is there anoth

Re: Models and relationships

2015-07-07 Thread Rafael E. Ferrero
Nice!! Chris good work !! -- Rafael E. Ferrero 2015-07-06 20:15 GMT-03:00 Chris Strasser : > WOO HOO !.. success ... thanks everyone... > just needed a nudge in the right direction I will tackle the > templates tomorrow and see where that takes me. > > On Mon, Jul 6, 2015 at 2:24 PM, Rafae

Re: Models and relationships

2015-07-06 Thread Chris Strasser
WOO HOO !.. success ... thanks everyone... just needed a nudge in the right direction I will tackle the templates tomorrow and see where that takes me. On Mon, Jul 6, 2015 at 2:24 PM, Rafael E. Ferrero wrote: > contacts = Contacts.objects.select_related() > > -- > Rafael E. Ferrero > > 201

Re: Models and relationships

2015-07-06 Thread Rafael E. Ferrero
contacts = Contacts.objects.select_related() -- Rafael E. Ferrero 2015-07-06 13:51 GMT-03:00 Florian Schweikert : > On 06/07/15 14:04, Chris Strasser wrote: > > my problem is with reverse lookups (i think it is called) the docs say > that i can access entries through blog.entry,(by lowercaseing

Re: Models and relationships

2015-07-06 Thread Florian Schweikert
On 06/07/15 14:04, Chris Strasser wrote: > my problem is with reverse lookups (i think it is called) the docs say that i > can access entries through blog.entry,(by lowercaseing the class) > it appears to me that i have the same setup with contact and location but i > am getting errors ?? I thin

Re: Models and relationships

2015-07-06 Thread Vijay Khemlani
Try with Contact.objects.all()[0] On Mon, Jul 6, 2015 at 1:03 PM, Chris Strasser wrote: > I tried and this happens: > > from main.models import Contact > > >>> contact = Contact.all()[0] > > Traceback (most recent call last): > > File "", line 1, in > > AttributeError: type object 'Contact'

Re: Models and relationships

2015-07-06 Thread Chris Strasser
I tried and this happens: from main.models import Contact >>> contact = Contact.all()[0] Traceback (most recent call last): File "", line 1, in AttributeError: type object 'Contact' has no attribute 'all' >>> ?? any ideas ? On Mon, Jul 6, 2015 at 8:43 AM, Sadaf Noor wrote: > If you ha

Re: Models and relationships

2015-07-06 Thread Rafael E. Ferrero
For start you don't need to specify the primary key (orgid for example) [1] In foreingkeys you need to use related names [2] In views use select_related() [3] [1] https://docs.djangoproject.com/en/1.8/ref/models/fields/#primary-key [2] https://docs.djangoproject.com/en/1.8/ref/models/fields/#fore

Re: Models and relationships

2015-07-06 Thread Sadaf Noor
If you have at least one entry in contact with a valid location, then it should work: from app.models import Contact > contact = Contact.all()[0] > print contact.locationid.locationname 2015-07-06 18:04 GMT+06:00 Chris Strasser : > Hi ,I am fairly new to Django and am struggling with models hop

Re: models, peeking to next record - maybe

2015-02-09 Thread Tim Chase
On 2015-02-07 22:05, Vijay Khemlani wrote: > The direct solution would be something like this in your view > > events = Event.objects.order_by('event_date') > > event_tuples = [] > last_date_seen = None > > for event in events: > if last_date_seen: > date_difference = event.date - la

Re: models, peeking to next record - maybe

2015-02-08 Thread Thomas Rega
Alternatively use the 'latest()' method of the django ORM to figure out which is the latest event: https://docs.djangoproject.com/en/1.7/ref/models/querysets/#latest 2015-02-08 2:05 GMT+01:00 Vijay Khemlani : > The direct solution would be something like this in your view > > events = Event.object

Re: models, peeking to next record - maybe

2015-02-07 Thread Vijay Khemlani
The direct solution would be something like this in your view events = Event.objects.order_by('event_date') event_tuples = [] last_date_seen = None for event in events: if last_date_seen: date_difference = event.date - last_date_seen else: date_difference = None even

Re: models, peeking to next record - maybe

2015-02-07 Thread Lachlan Musicman
My initial suggestion would be to utilise the "order by" option, and order by date. Then, on each model have a find_next function and a until_next function. The first would work out which was the next event, the other the time. They could be coupled, but keeping them separate means you can utilis

Re: Models not appearing in db. Am I missing something?

2014-12-16 Thread Mario Gudelj
Pgadmin3 is the bomb. Try that gui tool On 16/12/2014 4:40 pm, "Shazwi Suwandi" wrote: > Hey guys, > > I figured it was a problem with the app I'm using for the db. I went to > use another app and now the tables are showing. Silly me. Thanks Mario and > David for your helpful advice. :) > > On Tu

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread Shazwi Suwandi
Hey guys, I figured it was a problem with the app I'm using for the db. I went to use another app and now the tables are showing. Silly me. Thanks Mario and David for your helpful advice. :) On Tuesday, 16 December 2014 13:33:36 UTC+8, Shazwi Suwandi wrote: > > Hey Mario, > > The output I get

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread Shazwi Suwandi
Hey Mario, The output I get when I use makemigrations is 0001_initial.py: - Create model Member. I've double checked: - The 'Member' model is in core/models.py - 'Core' is inside project/settings.py I use python manage.py shell and I accessed the 'User' object and the linked

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread Mario Gudelj
What's the output of your makemigrations command? If those models are inside core/models.py and your app is inside installed apps in settings this should totally work. The default name for the table will be appname_modelname. Do you get an error when accessing the model? How are you checking the db

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread Shazwi Suwandi
Hey David, You're right, I have to practise writing tests along with my codes. However, just to clarify, data input and output works. I can call the data in the Member object. I'm just confused as to why the Member table does not show up in my postgres database. It's weird. Nevertheless, I'll

Re: Models not appearing in db. Am I missing something?

2014-12-15 Thread David Palao
Hello, >From your post I understand you did not write unittests for your models? I would recommend to write some sensible tests for them and start tracing your problem from the failures you should get. Best, David 2014-12-15 8:15 GMT+01:00 Shazwi Suwandi : > I've added 'core' to settings.py file

Re: Models not appearing in db. Am I missing something?

2014-12-14 Thread Shazwi Suwandi
I've added 'core' to settings.py file under INSTALLED_APPS too. On Monday, 15 December 2014 15:10:12 UTC+8, Shazwi Suwandi wrote: > > from django.db import models > from django.contrib.auth.models import User > > # CORE APPLICATION > # Create your models here. > class Member(models.Model): > u

Re: models get_absolute_url issue

2014-09-10 Thread Eddilbert Macharia
Hello andrew, Thank you for the reply, found where my problem was on my url.py i had done this url(r'^resource/(?P)', ResourceDetailView.as_view(), > name='resource_detail'), > instead of this > url(r'^resource/(?P\d+)', ResourceDetailView.as_view(), > name='resource_detail'), > i was l

Re: models get_absolute_url issue

2014-09-10 Thread Andrew Pinkham
Hi Eddilbert, What are the URL patterns for the two views? I suspect a problem with `pk_url_kwarg`, but I am surprised by the error output. If that is not the problem: Does this error occur if you do not override the `form_class` of `ResourceCreateView`? Could you supply the code for `CreateRes

Re: Models inside tests - Django 1.7 problem

2014-09-05 Thread Benjamin Scherrey
I'm not sure what the specific issue with migrations is but this article has a nice trick (intended for making temporary models/tables) that would allow you to bring in a model and get it to sync whenever you like. I'd suggest putting this in your test setUp() method. It uses 'syncdb' cause it's pr

Re: models

2014-07-05 Thread Dean
You could start here http://www.djangobook.com/en/2.0/chapter05.html and look at a 1/3 down the page at the heading 'Your First Model'. Taking 'events' as an example, think about the data you need to record. For example, each event normally has a title, location, start date and time, end date a

Re: Models and Admin Site Question

2014-05-06 Thread G Z
Thank you so much I dont know why i didnt catch that. Can you help me with my other post abotu urls? -- 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-user

Re: Models and Admin Site Question

2014-05-06 Thread C. Kirby
It looks like you have an indentation error. your __unicode__ method is should be a method in the Customer class, so it should be indented inside it. Right now it is outside the class namespace On Tuesday, May 6, 2014 11:44:46 AM UTC-5, G Z wrote: > > so in my models .py file I have > > > from

Re: Models at one place vs. separate places

2013-05-08 Thread Rafael E. Ferrero
Hello Parin, i do create separates apps... also every app have his own models and his own views, and his own templates, etc... the deal its how you can connect the differents apps. (I create another app who connect the others apps, i mean for a new project i create this connection app in base of th

Re: models i18n

2013-03-07 Thread Roberto López López
Yes, I meant that. It works great, and fits perfectly my needs. I give it an AAA+ Thanks again. On 03/07/2013 02:58 PM, Johan ter Beest wrote: > > On Mar 6, 2013, at 4:20 PM, Roberto López López wrote: > >> >> Thanks for your suggestion Johan. >> >> Just another question, which I've not se

Re: models i18n

2013-03-07 Thread Johan ter Beest
On Mar 6, 2013, at 4:20 PM, Roberto López López wrote: > > Thanks for your suggestion Johan. > > Just another question, which I've not seen answered in the > documentation: is there any custom filter/tag to access those translated > fields from a template? Thanks If you do {% load i18n %} som

Re: models i18n

2013-03-06 Thread Roberto López López
Thanks for your suggestion Johan. Just another question, which I've not seen answered in the documentation: is there any custom filter/tag to access those translated fields from a template? Thanks Best, Roberto On 03/05/2013 10:39 PM, Johan ter Beest wrote: > > On Mar 5, 2013, at 10:31 PM, Ro

Re: models i18n

2013-03-05 Thread Johan ter Beest
On Mar 5, 2013, at 10:31 PM, Roberto López López wrote: > Hi guys, > > I am developing a django application and between my requirements there > is being able to set the model fields into different languages. > > For example: > > class Employee(models.Model): >position = models.CharField()

Re: models for KML file

2012-09-11 Thread Melvyn Sopacua
Op 11 sep. 2012 11:07 schreef "Coulson Thabo Kgathi" het volgende: > > Somebody help with using kml files to plot points on maps using geodjango > Please read and understand the Geodjango tutorial and Gdal layermapping API. If you need help understanding that, ask specific questions about parts t

Re: Models relationship

2012-08-24 Thread Melvyn Sopacua
On 23-8-2012 20:15, Kurtis Mullins wrote: > class Factory(models.Model): > # Assuming suppliers and customers are just two sides of the same > relationship > suppliers = models.ManyToManyField("self", related_name="customers") > > Then simply query accordingly: > > factory_a = Factory.ob

Re: Models relationship

2012-08-23 Thread Kurtis Mullins
Hello Fernando, Just as a quick example, you could do something like this: class Factory(models.Model): # Assuming suppliers and customers are just two sides of the same relationship suppliers = models.ManyToManyField("self", related_name="customers") Then simply query accordingly: fact

Re: Models: Referencing A Model In Another App and Different Project

2012-07-29 Thread JJ Zolper
"As a general remark related to the issues that JJ has described... are there perhaps - or rather, should there be - pointers from the Django site that discuss some good practices to the overall approach of designing and building sites/projects/apps/databases - as opposed to the technical nitty

Re: Models: Referencing A Model In Another App and Different Project

2012-07-29 Thread Derek
As a general remark related to the issues that JJ has described... are there perhaps - or rather, should there be - pointers from the Django site that discuss some good practices to the overall approach of designing and building sites/projects/apps/databases - as opposed to the technical nitty-

Re: Models: Referencing A Model In Another App and Different Project

2012-07-28 Thread JJ Zolper
Okay well atleast im learning from my mistake! The reason I thought multiple projects was needed was because in each settings file I was tied to a database and i felt I need 5 databases. But it seems clear that i dont need that many projects. When you said "you should allocate webserver locatio

Re: Models: Referencing A Model In Another App and Different Project

2012-07-27 Thread Melvyn Sopacua
On 27-7-2012 6:17, JJ Zolper wrote: > You are probably right to be honest. I might be overdoing it with > seperating things apart. I guess sometimes I'm too efficient! > > Here's some more to chew on though: > > I also want to point out the reason why I am trying to bring one model into > anoth

Re: Models: Referencing A Model In Another App and Different Project

2012-07-26 Thread JJ Zolper
You are probably right to be honest. I might be overdoing it with seperating things apart. I guess sometimes I'm too efficient! Here's some more to chew on though: I also want to point out the reason why I am trying to bring one model into another. MadTrak/ manage.py MadTrak/

RE: Models: Referencing A Model In Another App and Different Project

2012-07-26 Thread michael.pimmer.ext
I'm not sure whether there is a good solution for this problem with the prerequisites you mentioned. Just because you import onde model doesn't mean you have full access to the underlying database of another project. If nobody comes up with a better idea (I never tried something similar), here is

Re: Models, field like a list

2012-03-19 Thread Jani Tiainen
Hi, All depends on a few factors will simple foreign key or many to many be correct solution. If single model B can be assigned only on a single model A then foreign key from B to A is right choice. But if requirement is that model B can be assigned multiple times to model A then it's definitely

Re: Models, field like a list

2012-03-19 Thread Dmitry Zimnukhov
Hi, If you want to retrieve list of related models with one to many relation, you can do it with related manager, without adding a field to model A. So, if you have model B like this: class B(models.Model): a = models.ForeignKey(A) you can get related B objects like this: a_instance.b_set.all()

Re: models and NULL in postgres

2012-03-15 Thread hack
Ahhh, that makes sense. Thanks. :) On Thursday, March 15, 2012 10:19:47 PM UTC-4, dstufft wrote: > > Django uses an empty string instead of a NULL for an empty value for > CharField and Charfield subclasses > > On Thursday, March 15, 2012 at 10:18 PM, hack wrote: > > Something is a little st

Re: models and NULL in postgres

2012-03-15 Thread Donald Stufft
Django uses an empty string instead of a NULL for an empty value for CharField and Charfield subclasses On Thursday, March 15, 2012 at 10:18 PM, hack wrote: > Something is a little strange with my database. My models have fields where > the value is set as blank=True to allow null values. M

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-09 Thread JohnA
Glad you were able to resolve your problem. I use multi-table inheritance a lot and so far it always "just works" without me having to worry about or fiddle with the internal ids that Django uses to connect the derived class rows to the base class ones. -- John On Feb 8, 1:25 pm, Artyom Chernetz

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-09 Thread Jean-Mark
You can also use the south application to manage migrations. pip install south Then add 'south' to the list of installed apps. To start off you can do ./manage.py schemamigration --initial appname ./manage.py migrate appname Then whenever you make a change to your models: ./manage.py schemamigra

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-08 Thread Artyom Chernetzov
Thanks, everybody, problem was: I add ForeignKey field in object after dbsync. I just needed to reset database, it solve 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.co

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-07 Thread akaariai
On Feb 7, 8:26 pm, Artyom Chernetzov wrote: > Here is model structure: Client is User, Client can be corporate or person: > >     class Client(User): >         #fields > >     class ClientCorporate(Client): >         #fields > >     class ClientPerson(Client): >         #fields > > And client can

Re: Models inheritance in django: how to change PK "_ptr_id" on "id"?

2012-02-07 Thread Andre Terra
I just read your e-mail quick and somewhat carelessly, so forgive me if I'm missing something. Here's a list of things for you to check: * Have you defined your Client model with abstract = True in its Meta options?[1] * Have you syncdb'd[2]? * If you must name your pk something else, just follo

Re: models queryset and permissions

2011-01-05 Thread MarcoS
Hi Danfi, thanks for your reply. This help me! On 5 Gen, 10:06, Danfi wrote: > Esame: > name = models.Foreignkey(User) > ... > > Then queryset=Esame.name.get_rows_with_permission(Ecg(),'add') > > On 1月4日, 下午8时02分, MarcoS wrote: > > > Hi people, probably I'm making a mountain out of a molehill bu

Re: models queryset and permissions

2011-01-05 Thread Danfi
Esame: name = models.Foreignkey(User) ... Then queryset=Esame.name.get_rows_with_permission(Ecg(),'add') On 1月4日, 下午8时02分, MarcoS wrote: > Hi people, probably I'm making a mountain out of a molehill but I > can't figure > how to solve this problem; > > I've a form with a ModelMultipleChoiceField

Re: models queryset and permissions

2011-01-04 Thread MarcoS
The ModelMultipleChoicheField will return Esame objects -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@g

Re: models don't show in tamplate

2010-12-03 Thread wayne
Are you seeing anything? I mean, is the rest of the template rendering fine? There are only two things that I notice: the extra dict you pass with the template_object_name (why not put it in info_dict?), and while I'm not fluent in spanish, are you iterating through the variable 'object_list'?

Re: Models not being updated when accessed by multiple processes

2010-11-26 Thread Iqbal Abdullah
After a bit more of searching I've finally figured out what I wanted is "atomic updates". Using the F() expression seems to be the best solution without much code overhaul: http://stackoverflow.com/questions/280075/atomic-operations-in-django http://efreedom.com/Question/1-1598932/Atomic-Increment

Re: Models not being updated when accessed by multiple processes

2010-11-23 Thread Iqbal Abdullah
Since we only run the application on a single server we're using file based locking; fail_to_get_lock() and release_lock() tries to create a file in the tmp directory with the user's unique identification data, and release_lock() deletes it. What I don't understand is, even if the save() method is

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread JeeyoungKim
I'm wondering, how are fail_to_get_lock and release_lock implemented? It would be some kind of multiprocess lock, which seems overly complicated.. using save() in this case is cumbersome, because save() is not threadsafe... you'll have to try to maintain your own lock. If you only want to impleme

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread Iqbal Abdullah
Hi Steve, Ops, yes, I forgot to include the object.save() in the pseudo code above. Yes, we're actually saving it: 1 object = MyModel.object.get(id=1) 2 print object.value# starting value is 5 3 while object.fail_to_get_lock(): 4sleep(5) 5 object = MyModel.object.get(id=1) # Re-get the o

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread Steve Holden
On 11/19/2010 5:35 PM, Iqbal Abdullah wrote: > Hi, > > This might be a gotcha on the models side, but I would like > clarification and guidance on how to write the code better concerning > multiple process accessing the same data via models. > > I have a backend script that runs the following cod

Re: Models Tutorial Django

2010-05-11 Thread Karen Tracey
On Tue, May 11, 2010 at 6:15 AM, HelloWorld wrote: > Hi Jirka > > Thanks for your answer! > > By structure I mean, I just followed the tutorial and am not sure if > the position and order of these tutorial code is right in my code: > > class Poll(models.Model): ># ... > def __unicode__(se

Re: Models Tutorial Django

2010-05-11 Thread Daniel Roseman
On May 11, 11:15 am, HelloWorld wrote: > Hi Jirka > > Thanks for your answer! > > By structure I mean, I just followed the tutorial and am not sure if > the position and order of these tutorial code is right in my code: > > class Poll(models.Model): >     # ... >     def __unicode__(self): >      

Re: Models Tutorial Django

2010-05-11 Thread Jirka Vejrazka
Hmm, I can't see anything wrong with your code, so I'm gonna go to the basics - how about your code indentation? Is the "def __unicode__()" the same way as your model field definitions? The __unicode__() function must be part of your Poll class, not standalone. Cheers Jirka On 11/05/2010,

Re: Models Tutorial Django

2010-05-11 Thread HelloWorld
Hi Jirka Thanks for your answer! By structure I mean, I just followed the tutorial and am not sure if the position and order of these tutorial code is right in my code: class Poll(models.Model): # ... def __unicode__(self): return self.question class Choice(models.Model): #

  1   2   3   >