Search Results

Search found 4150 results on 166 pages for 'markov models'.

Page 9/166 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Django admin causes high load for one model...

    - by Joe
    In my Django admin, when I try to view/edit objects from one particular model class the memory usage and CPU rockets up and I have to restart the server. I can view the list of objects fine, but the problem comes when I click on one of the objects. Other models are fine. Working with the object in code (i.e. creating and displaying) is ok, the problem only arises when I try to view an object with the admin interface. The class isn't even particularly exotic: class Comment(models.Model): user = models.ForeignKey(User) thing = models.ForeignKey(Thing) date = models.DateTimeField(auto_now_add=True) content = models.TextField(blank=True, null=True) approved = models.BooleanField(default=True) class Meta: ordering = ['-date'] Any ideas? I'm stumped. The only reason I could think of might be that the thing is quite a large object (a few kb), but as I understand it, it wouldn't get loaded until it was needed (correct?).

    Read the article

  • Django - transactions in the model?

    - by orokusaki
    Models (disregard typos / minor syntax issues. It's just pseudo-code): class SecretModel(models.Model): some_unique_field = models.CharField(max_length=25, unique=True) # Notice this is unique. class MyModel(models.Model): secret_model = models.OneToOneField(SecretModel, editable=False) # Not in the form spam = models.CharField(max_length=15) foo = models.IntegerField() def clean(self): SecretModel.objects.create(some_unique_field=self.spam) Now if I go do this: MyModel.objects.create(spam='john', foo='OOPS') # Obviously foo won't take "OOPS" as it's an IntegerField. #.... ERROR HERE MyModel.objects.create(spam='john', foo=5) # So I try again here. #... IntegrityError because SecretModel with some_unique_field = 'john' already exists. I understand that I could put this into a view with a request transaction around it, but I want this to work in the Admin, and via an API, etc. Not just with forms, or views. How is it possible?

    Read the article

  • Model in sub-directory via app_label?

    - by prometheus
    In order to place my models in sub-folders I tried to use the app_label Meta field as described here. My directory structure looks like this: project apps foo models _init_.py bar_model.py In bar_model.py I define my Model like this: from django.db import models class SomeModel(models.Model): field = models.TextField() class Meta: app_label = "foo" I can successfully import the model like so: from apps.foo.models.bar_model import SomeModel However, running: ./manage.py syncdb does not create the table for the model. In verbose mode I do see, however, that the app "foo" is properly recognized (it's in INSTALLED_APPS in settings.py). Moving the model to models.py under foo does work. Is there some specific convention not documented with app_label or with the whole mechanism that prevents this model structure from being recognized by syncdb?

    Read the article

  • In Django, using __init__() method of non-abstract parent model to record class name of child model

    - by k-g-f
    In my Django project, I have a non-abstract parent model defined as follows: class Parent(models.Model): classType = models.CharField(editable=False,max_length=50) and, say, two children models defined as follows: class ChildA(Parent): parent = models.OneToOneField(Parent,parent_link=True) class ChildB(Parent): parent = models.OneToOneField(Parent,parent_link=True) Each time I create an instance of ChildA or of ChildB, I'd like the classType attribute to be set to the strings "ChildA" or "ChildB" respectively. What I have done is added an _ _ init_ _() method to Parent as follows: class Parent(models.Model): classType = models.CharField(editable=False,max_length=50) def __init__(self,*args,**kwargs): super(Parent,self).__init__(*args,**kwargs) self.classType = self.__class__.__name__ Is there a better way to implement and achieve my desired result? One downside of this implementation is that when I have an instance of the Parent, say "parent", and I want to get the type of the child object linked with "parent", calling "parent.classType" gives me "Parent". In order to get the appropriate "ChildA" or "ChildB" value, I need to write a "_getClassType()" method to wrap a custom sql query.

    Read the article

  • Django query: Count and Group BY

    - by Tyler Lane
    I have a query that I'm trying to figure the "django" way of doing it: I want to take the last 100 calls from Call. Which is easy: calls = Call.objects.all().order_by('-call_time')[:100] However the next part I can't find the way to do it via django's ORM. I want to get a list of the call_types and the number of calls each one has WITHIN that previous queryset i just did. Normally i would do a query like this: "SELECT COUNT(id),calltype FROM call WHERE id IN ( SELECT id FROM call ORDER BY call_time DESC LIMIT 100 ) GROUP BY calltype;" I can't seem to find the django way of doing this particular query. Here are my 2 models: class Call( models.Model ): call_time = models.DateTimeField( "Call Time", auto_now = False, auto_now_add = False ) description = models.CharField( max_length = 150 ) response = models.CharField( max_length = 50 ) event_num = models.CharField( max_length = 20 ) report_num = models.CharField( max_length = 20 ) address = models.CharField( max_length = 150 ) zip_code = models.CharField( max_length = 10 ) geom = models.PointField(srid=4326) calltype = models.ForeignKey(CallType) objects = models.GeoManager() class CallType( models.Model ): name = models.CharField( max_length = 50 ) description = models.CharField( max_length = 150 ) active = models.BooleanField() time_init = models.DateTimeField( "Date Added", auto_now = False, auto_now_add = True ) objects = models.Manager()

    Read the article

  • How can I display a list of three different Models sortable by the same :attribute in rails?

    - by Angela
    I have a Campaign model which has_many Calls, Emails, and Letters. For now, these are each a separate Model with different controllers and actions (although I would like to start to think of ways to collapse them once the models and actions stabilize). They do share two attributes at least: :days and :title I would like a way to represent all the Calls, Emails, and Letters that belong_to a specific Campaign as a sortable collection (sortable by :days), in a way that outputs the model name and the path_to() for each. For example (I know the below is not correct, but it represents the kind of output/format I've been trying to do: @campaign_events.each do |campaign_event| <%= campaign_event.model_name %> <%= link_to campaign_event.title, #{model_name}_path(campaign_event) %> end Thanks so much. BTW, if this matters, I would then want to make the :days attribute editable_in_place.

    Read the article

  • How to migrate Django models from mysql to sqlite (or between any two database systems)?

    - by Daphna Shezaf
    I have a Django deployment in production that uses MySQL. I would like to do further development with SQLite, so I would like to import my existing data to an SQLite database. I There is a shell script here to convert a general MySQL dump to SQLite, but it didn't work for me (apparently the general problem isn't easy). I figured doing this using the Django models must be much easier. How would you do this? Does anyone have any script to do this?

    Read the article

  • Formatting inline many-to-many related models presented in django admin

    - by Jonathan
    I've got two django models (simplified): class Product(models.Model): name = models.TextField() price = models.IntegerField() class Invoice(models.Model): company = models.TextField() customer = models.TextField() products = models.ManyToManyField(Product) I would like to see the relevant products as a nice table (of product fields) in an Invoice page in admin and be able to link to the individual respective Product pages. My first thought was using the admin's inline - but django used a select box widget per related Product. This isn't linked to the Product pages, and also as I have thousands of products, and each select box independently downloads all the product names, it quickly becomes unreasonably slow. So I turned to using ModelAdmin.filter_horizontal as suggested here, which used a single instance of a different widget, where you have a list of all Products and another list of related Products and you can add\remove products in the later from the former. This solved the slowness, but it still doesn't show the relevant Product fields, and it ain't linkable. So, what should I do? tweak views? override ModelForms? I Googled around and couldn't find any example of such code...

    Read the article

  • Managed game frameworks with Model loading support [on hold]

    - by codymanix
    Iam looking for an alternative to XNA with support of model loading. Does anybody know when/if there if a MonoGame release is planned which includes its own content pipeline which works without XNA beeing installed? If not, what are the alternatives in managed game development? As far as I know, SlimDX and SharpDX on its own brings no functionality for loading models. Are there any open source libraries that can do that?

    Read the article

  • Django syncdb error

    - by Hulk
    /mysite/project4 class notes(models.Model): created_by = models.ForeignKey(User) detail = models.ForeignKey(Details) Details and User are in the same module i.e,/mysite/project1 In project1 models i have defined class User(): ...... class Details(): ...... When DB i synced there is an error saying Error: One or more models did not validate: project4: Accessor for field 'detail' clashes with related field . Add a related_name argument to the definition for 'detail'. How can this be solved.. thanks..

    Read the article

  • queries in django

    - by Hulk
    How to query Employee to get all the address related to the employee, Employee.Add.all() doe not work.. class Employee(): Add = models.ManyToManyField(Address) parent = models.ManyToManyField(Parent, blank=True, null=True) class Address(models.Model): address_emp = models.CharField(max_length=512) description = models.TextField() def __unicode__(self): return self.name()

    Read the article

  • Django FileField not saving to upload_to location

    - by Erik
    I have an Attachment model that has a FileField in a Django 1.4.1 app. This FileField has a callable upload_to parameter which, per the Django docs should be called when the form (and therefore the model) is saved. When I run FormTest below, the upload_to callable is never called and the file therefore does not appear in the location provided by the upload_to method. What am I doing wrong? Notice that in the passing tests in ModelTest (also below), the upload_to method works as expected. Test: from core.forms.attachments import AttachmentForm from django.test import TestCase import unittest from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.storage import default_storage def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(FormTest), ] ) class FormTest(TestCase): def test_form_1(self): filename = 'filename' f = file(filename) data = {'name':'name',} file_data = {'attachment_file':SimpleUploadedFile(f.name,f.read()),} form = AttachmentForm(data=data,files=file_data) self.assertTrue(form.is_valid()) attachment = form.save() root_directory = 'attachments' upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertTrue(attachment.attachment_file) # Fails self.assertTrue(default_storage.exists(upload_location)) # Fails Attachment Model: from django.db import models from parent_mixins import Parent_Mixin import uuid from django.db.models.signals import pre_delete,pre_save from dirtyfields import DirtyFieldsMixin def upload_to(instance,filename): return 'attachments/' + instance.directory + '/' + filename def uuid_directory_name(): return uuid.uuid4().hex class Attachment(DirtyFieldsMixin,Parent_Mixin,models.Model): attachment_file = models.FileField(blank=True,null=True,upload_to=upload_to) directory = models.CharField(blank=False,default=uuid_directory_name,null=False,max_length=32) name = models.CharField(blank=False,default=None,null=False,max_length=128) class Meta: app_label = 'core' def __str__(self): return unicode(self).encode('utf-8') def __unicode__(self): return unicode(self.name) @models.permalink def get_absolute_url(self): return('core_attachments_update',(),{'pk': self.pk}) # def save(self,*args,**kwargs): # super(Attachment,self).save(*args,**kwargs) def pre_delete_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return instance.attachment_file.delete(save=False) def pre_save_callback(sender, instance, *args, **kwargs): if not isinstance(instance, Attachment): return if not instance.attachment_file: return if instance.is_dirty(): dirty_fields = instance.get_dirty_fields() if 'attachment_file' in dirty_fields: old_attachment_file = dirty_fields['attachment_file'] old_attachment_file.delete() pre_delete.connect(pre_delete_callback) pre_save.connect(pre_save_callback) Attachment Form: from ..models.attachments import Attachment from crispy_forms.helper import FormHelper from crispy_forms.layout import Div,Layout,HTML,Field,Fieldset,Button,ButtonHolder,Submit from django import forms class AttachmentFormHelper(FormHelper): form_tag=False layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentForm(forms.ModelForm): helper = AttachmentFormHelper() class Meta: fields=('attachment_file','name') model = Attachment class AttachmentInlineFormHelper(FormHelper): form_tag=False form_style='inline' layout = Layout( Div( Div( Field('name',css_class='span4'), Field('attachment_file',css_class='span4'), Field('DELETE',css_class='span4'), css_class='span4', ), css_class='row', ), ) class AttachmentInlineForm(forms.ModelForm): helper = AttachmentInlineFormHelper() class Meta: fields=('attachment_file','name') model = Attachment UPDATE I also do testing on the Attachment model class with these unit tests -- which all pass: from core.models.attachments import Attachment from core.models.attachments import upload_to from django.test import TestCase import unittest from django.core.files.storage import default_storage from django.core.files.base import ContentFile def suite(): return unittest.TestSuite( [ unittest.TestLoader().loadTestsFromTestCase(ModelTest), ] ) class ModelTest(TestCase): def test_model_minimum_fields(self): attachment = Attachment(name='name') attachment.attachment_file.save('test.txt',ContentFile("hello world")) attachment.save() self.assertEqual(str(attachment),'name') self.assertEqual(unicode(attachment),'name') self.assertTrue(attachment.directory) # def test_model_full_fields(self): # attachment = Attachment() # attachement.save() def test_file_operations_basic(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = root_directory + '/' + attachment.directory + '/' + filename self.assertEqual(upload_to(attachment,filename),upload_location) self.assertTrue(default_storage.exists(upload_location)) def test_file_operations_delete(self): root_directory = 'attachments' filename = 'test.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename,ContentFile('test')) attachment.save() upload_location = upload_to(attachment,filename) attachment.delete() self.assertFalse(default_storage.exists(upload_location)) def test_file_operations_change(self): root_directory = 'attachments' filename_1 = 'test_1.txt' attachment = Attachment(name='name') attachment.attachment_file.save(filename_1,ContentFile('test')) attachment.save() upload_location_1 = upload_to(attachment,filename_1) self.assertTrue(default_storage.exists(upload_location_1)) filename_2 = 'test_2.txt' attachment.attachment_file.save(filename_2,ContentFile('test')) attachment.save() upload_location_2 = upload_to(attachment,filename_2) self.assertTrue(default_storage.exists(upload_location_2)) self.assertFalse(default_storage.exists(upload_location_1))

    Read the article

  • ForeignKey django 1.1.1 model

    - by Spikie
    i have class staff_name(models.Model): firstname = models.CharField(max_length=150) surname = models.CharField(max_length=150) class inventory_transaction(models.Model): staffs = models.ForeignKey(staff_name) i want to get or create staff surname and first name through inventory_transaction i used these code below inventory_transaction.objects.get_or_create(staffs_surname_contains=sname,staffs_firstname_contains=fname) i got this error "staffs_surname_contains can not be defined" what have i done wrong ? thanks

    Read the article

  • Django: Grouping by Dates and Servers

    - by TheLizardKing
    So I am trying to emulate google app's status page: http://www.google.com/appsstatus#hl=en but for backups for our own servers. Instead of service names on the left it'll be server names but the dates and hopefully the pagination will be there too. My models look incredibly similar to this: from django.db import models STATUS_CHOICES = ( ('UN', 'Unknown'), ('NI', 'No Issue'), ('IS', 'Issue'), ('NR', 'Not Running'), ) class Server(models.Model): name = models.CharField(max_length=32) def __unicode__(self): return self.name class Backup(models.Model): server = models.ForeignKey(Server) created = models.DateField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) status = models.CharField(max_length=2, choices=STATUS_CHOICES, default='UN') issue = models.TextField(blank=True) def __unicode__(self): return u'%s: %s' % (self.server, self.get_status_display()) My issue is that I am having a hell of a time displaying the information I need. Everyday a little after midnight a cron job will run and add a row for each server for that day, defaulting on status unknown (UN). My backups.html: {% extends "base.html" %} {% block content %} <table> <tr> <th>Name</th> {% for server in servers %} <th>{{ created }}</th> </tr> <tr> <td>{{ server.name }}</td> {% for backup in server.backup_set.all %} <td>{{ backup.get_status_display }}</td> {% endfor %} </tr> {% endfor %} </table> {% endblock content %} This actually works but I do not know how to get the dates to show. Obviously {{ created }} doesn't do anything but the servers don't have create dates. Backups do and because it's a cron job there should only be X number of rows with any particular date (depending on how many servers we are following for that day). Summary I want to create a table, X being server names, Y being dates starting at today while all the cells being the status of a backup. The above model and template should hopefully give you an idea what my thought process but I am willing to alter anything. Basically I am create a fancy excel spreadsheet.

    Read the article

  • Django - Can you use property as the field in an aggregation function?

    - by orokusaki
    I know the short answer because I tried it. Is there any way to accomplish this though (even if only on account of a hack)? class Ticket(models.Model): account = modelfields.AccountField() uuid = models.CharField(max_length=36, unique=True) created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['created'] @property def repair_cost(self): # cost is a @property of LineItem(models.Model) return self.lineitem_set.aggregate(models.Sum('cost'))

    Read the article

  • How to save link with tag e parameters in TextField

    - by xRobot
    I have this simple Post model: class Post(models.Model): title = models.CharField(_('title'), max_length=60, blank=True, null=True) body = models.TextField(_('body')) blog = models.ForeignKey(Blog, related_name="posts") user = models.ForeignKey(User) I want that when I insert in the form the links, the these links are saved in the body from this form: http://www.example.com or www.example.com to this form ( with tag and rel="nofollow" parameter ): <a href="http://www.example.com" rel="nofollow">www.example.com</a> How can I do this ? Thanks ^_^

    Read the article

  • How to save links with tags and parameters in TextField

    - by xRobot
    I have this simple Post model: class Post(models.Model): title = models.CharField(_('title'), max_length=60, blank=True, null=True) body = models.TextField(_('body')) blog = models.ForeignKey(Blog, related_name="posts") user = models.ForeignKey(User) I want that when I insert in the form the links, then these links are saved in the body from this form: http://www.example.com or www.example.com to this form ( with tag and rel="nofollow" parameter ): <a href="http://www.example.com" rel="nofollow">www.example.com</a> How can I do this ? Thanks ^_^

    Read the article

  • Why do game engines convert models to triangles compared to keeping it as four side polygon

    - by Grant
    I've worked using maya for animation and more film orientated projects however I am also focusing on my studies on video game development (eventually want to be either programmer or some sort of TD with programming and 3D skills). Anyways, I was talking with one of my professor and we couldn't figure out why all game engines (that I know of) convert to triangles. Anyone happen to know why game engines convert to triangles compared to leaving the models as four sided polygons? Also what are the pros and cons (if any) of doing this? Thanks in advance.

    Read the article

  • XNA clip plane effect makes models black

    - by user1990950
    When using this effect file: float4x4 World; float4x4 View; float4x4 Projection; float4 ClipPlane0; void vs(inout float4 position : POSITION0, out float4 clipDistances : TEXCOORD0) { clipDistances.x = dot(position, ClipPlane0); clipDistances.y = 0; clipDistances.z = 0; clipDistances.w = 0; position = mul(mul(mul(position, World), View), Projection); } float4 ps(float4 clipDistances : TEXCOORD0) : COLOR0 { clip(clipDistances); return float4(0, 0, 0, 0); } technique { pass { VertexShader = compile vs_2_0 vs(); PixelShader = compile ps_2_0 ps(); } } all models using this are rendered black. Is it possible to render them correctly?

    Read the article

  • How to attach two XNA models together?

    - by jeangil
    I go back on unsolved question I asked about attaching two models together, could you give me some help on this ? For example, If I want to attach together Model1 (= Main model) & Model2 ? I have to get the transformation matrix of Model1 and after get the Bone index on Model1 where I want to attach Model2 and then apply some transformation to attach Model2 to Model1 I wrote some code below about this, but It does not work at all !! (6th line of my code seems to be wrong !?) Model1TransfoMatrix=New Matrix[Model1.Bones.Count]; Index=Model1.bone[x].Index; foreach (ModelMesh mesh in Model2.Meshes) { foreach(BasicEffect effect in mesh.effects) { matrix model2Transform = Matrix.CreateScale(0.1.0f)*Matrix.CreateFromYawPitchRoll(x,y,z); effect.World= model2Transform *Model1TransfoMatrix[Index]; effect.view = camera.View; effect.Projection= camera.Projection; } mesh.draw(); }

    Read the article

  • Models from 3ds max lose their transformations when input into XNA

    - by jacobian
    I am making models in 3ds max. However when I export them to .fbx format and then input them into XNA, they lose their scaling. -It is most likely something to do with not using the transforms from the model correctly, is the following code correct -using xna 3.0 Matrix[] transforms=new Matrix[playerModel.Meshes.Count]; playerModel.CopyAbsoluteBoneTransformsTo(transforms); // Draw the model. int count = 0; foreach (ModelMesh mesh in playerModel.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = transforms[count]* Matrix.CreateScale(scale) * Matrix.CreateRotationX((float)MathHelper.ToRadians(rx)) * Matrix.CreateRotationY((float)MathHelper.ToRadians(ry)) * Matrix.CreateRotationZ((float)MathHelper.ToRadians(rz))* Matrix.CreateTranslation(position); effect.View = view; effect.Projection = projection; effect.EnableDefaultLighting(); } count++; mesh.Draw(); }

    Read the article

  • Is there a performance pentalty using in-place models/families in a large Revit project

    - by Jaips
    (I'm quite new at Revit so apologies if my concepts are a bit inaccurate) I have heard using, in-place models in Revit projects is poor practice since it can slow down a large project. However i noticed Revit also organising inplace models lumping them with the rest of the families. So my question is: Is there really any performance penalty/benefit to be had by inserting families from an external file as opposed to creating inplace models in a Revit project?

    Read the article

  • Is there a performance penalty using in-place models/families in a large Revit project

    - by Jaips
    (I'm quite new at Revit so apologies if my concepts are a bit inaccurate) I have heard using, in-place models in Revit projects is poor practice since it can slow down a large project. However I noticed Revit also organising inplace models lumping them with the rest of the families. So my question is: Is there really any performance penalty/benefit to be had by inserting families from an external file as opposed to creating inplace models in a Revit project?

    Read the article

  • Django Admin Running Same Query Thousands of Times for Model

    - by Tom
    Running into an odd . . . loop when trying to view a model in the Django admin. I have three related models (code trimmed for brevity, hopefully I didn't trim something I shouldn't have): class Association(models.Model): somecompany_entity_id = models.CharField(max_length=10, db_index=True) name = models.CharField(max_length=200) def __unicode__(self): return self.name class ResidentialUnit(models.Model): building = models.CharField(max_length=10) app_number = models.CharField(max_length=10) unit_number = models.CharField(max_length=10) unit_description = models.CharField(max_length=100, blank=True) association = models.ForeignKey(Association) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) def __unicode__(self): return '%s: %s, Unit %s' % (self.association, self.building, self.unit_number) class Resident(models.Model): unit = models.ForeignKey(ResidentialUnit) type = models.CharField(max_length=20, blank=True, default='') lookup_key = models.CharField(max_length=200) jenark_id = models.CharField(max_length=20, blank=True) user = models.ForeignKey(User) is_association_admin = models.BooleanField(default=False, db_index=True) show_in_contact_list = models.BooleanField(default=False, db_index=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) _phones = {} home_phone = None work_phone = None cell_phone = None app_number = None account_cache_key = None def __unicode__(self): return '%s' % self.user.get_full_name() It's the last model that's causing the problem. Trying to look at a Resident in the admin takes 10-20 seconds. If I take 'self.association' out of the __unicode__ method for ResidentialUnit, a resident page renders pretty quickly. Looking at it in the debug toolbar, without the association name in ResidentialUnit (which is a foreign key on Resident), the page runs 14 queries. With the association name put back in, it runs a far more impressive 4,872 queries. The strangest part is the extra queries all seem to be looking up the association name. They all come from the same line, the __unicode__ method for ResidentialUnit. Each one is the exact same thing, e.g., SELECT `residents_association`.`id`, `residents_association`.`jenark_entity_id`, `residents_association`.`name` FROM `residents_association` WHERE `residents_association`.`id` = 1096 ORDER BY `residents_association`.`name` ASC I assume I've managed to create a circular reference, but if it were truly circular, it would just die, not run 4000x and then return. Having trouble finding a good Google or StackOverflow result for this.

    Read the article

  • Return template as string - Django

    - by Ninefingers
    Hi All, I'm still not sure this is the correct way to go about this, maybe not, but I'll ask anyway. I'd like to re-write wordpress (justification: because I can) albeit more simply myself in Django and I'm looking to be able to configure elements in different ways on the page. So for example I might have: Blog models A site update message model A latest comments model. Now, for each page on the site I want the user to be able to choose the order of and any items that go on it. In my thought process, this would work something like: class Page(models.Model) Slug = models.CharField(max_length=100) class PageItem(models.Model) Page = models.ForeignKey(Page) ItemType = models.CharField(max_length=100) InstanceNum = models.IntegerField() # all models have primary keys. Then, ideally, my template would loop through all the PageItems in a page which is easy enough to do. But what if my page item is a site update as opposed to a blog post? Basically, I am thinking I'd like to pull different item types back in different orders and display them using the appropriate templates. Now, I thought one way to do this would be to, in views.py, to loop through all of the objects and call the appropriate view function, return a bit of html as a string and then pipe that into the resultant template. My question is - is this the best way to go about doing things? If so, how do I do it? If not, which way should I be going? I'm pretty new to Django so I'm still learning what it can and can't do, so please bear with me. I've checked SO for dupes and don't think this has been asked before...

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >