sorry, that doesn't make sense. maybe that was meant for a different post?
On Monday, March 25, 2019 at 6:58:01 PM UTC-5, LIGHTNING OMEGA 2 636 wrote:
-- On Monday, March 25, 2019 at 6:58:01 PM UTC-5, LIGHTNING OMEGA 2 636 wrote:
Just letting you know that, I've read msg and reviewed you code. Although these are interview objects, it uses word tokens. Key words such as those used in this code are handled well by utilizing Natural Language Processing (NLP) methods. Mapping and Regular Expressions (Regex) do alot of the work in Python, R, React JavaScript etc. Now I need to see if Turbo Pascal supports these libraries of code. If it's okay, maybe Tomorrow or Thurs will work as far as meeting is concerned.On Mon, Mar 25, 2019 at 7:07 PM Keegen Knapp <kee...@gmail.com> wrote:I'm trying to write a custom app where you can add new plants in the admin. Then create a list view, category view and detailed view. You can see my error and code below. Any help is greatly appreciated!!--Error -
models.py -from django.db import modelsfrom cms.models.fields import PlaceholderFieldfrom django.db.models.signals import pre_save#create a basic species modelclass Species(models.Model):name = models.CharField(max_length=50, unique=True) def __unicode__(self):return self.nameclass Plant(models.Model):name = models.CharField(max_length=50, unique=True) #textfield to choose seasonseason = models.TextField()#automatically adds a created date, good for ordering plants by dates etcpub_date = models.DateField(auto_now_add=True) #automatically adds slug, requires Auto slugslug = models.SlugField(max_length=70, unique=True) #FK's to a species modelspecies = models.ForeignKey(Species)#life cyclelife_cycle = models.CharField(max_length=60) #add a upload section for specification sheetsposition = models.TextField()#take advantage of the CMS's placeholders for images, much more flexible than file_uploadimage = PlaceholderField('plant_images', related_name="image") #again description, take advantage of the CMS capabilities.description = PlaceholderField('plant_description', related_name="description") views.pyfrom django.shortcuts import render_to_responsefrom django.template import RequestContextclass ProductDetailView(DetailView):model = Planttemplate_name = 'plants/detail.html'urls.pyfrom plants.views import PlantDetailViewurlpatterns = patterns('plants.views',url(r'^(?P<slug>[\w-]+)/$', PlantDetailView.as_view()),)from cms.app_base import CMSAppfrom cms.apphook_pool import apphook_poolfrom django.utils.translation import ugettext_lazy as _class PlantsApp(CMSApp):name = _("Plants") # give your app a name, this is requiredurls = ["plants.urls"] # link your app to url configuration(s)def get_urls(self, page=None, language=None, **kwargs):return ["plants.urls"]apphook_pool.register(PlantsApp) # register your app apps.py -class PlantsConfig(AppConfig):name = 'plants'verbosename = "Plants"admin.py -from django.contrib import adminfrom .models import Plant, Speciesfrom aldryn_apphooks_config.admin import ModelAppHookConfig, BaseAppHookConfigclass PlantAdmin(ModelAppHookConfig, admin.ModelAdmin):search_fields = ['name']readonly_fields = ['slug']ordering = ['name']passadmin.site.register(Plant, PlantAdmin)class SpeciesAdmin(admin.ModelAdmin): search_fields = ['name']ordering = ['name']passadmin.site.register(Species, SpeciesAdmin)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users .
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5c0d1e5- .3962-48ce-8fdc-a082c37ddba5% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c24e261a-99a0-4095-a63b-faacc3d2cb7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:
Post a Comment